diff --git a/catch/wechat/CatchWechatService.php b/catch/wechat/CatchWechatService.php index 116a3ea..53f9262 100644 --- a/catch/wechat/CatchWechatService.php +++ b/catch/wechat/CatchWechatService.php @@ -16,21 +16,17 @@ class CatchWechatService extends ModuleService public function register() { parent::register(); - - $this->registerCommand(); } /** * register command * * @time 2020年06月24日 - * @return void + * @return array */ - public function registerCommand() + public function loadCommands() { - $this->commands([ - SyncUsersCommand::class, - ]); + return [__NAMESPACE__, __DIR__ . DIRECTORY_SEPARATOR . 'command']; } /** diff --git a/catch/wechat/command/WechatCommand.php b/catch/wechat/command/WechatCommand.php index 3716325..6dc17f4 100644 --- a/catch/wechat/command/WechatCommand.php +++ b/catch/wechat/command/WechatCommand.php @@ -8,14 +8,11 @@ * @copyright By CatchAdmin * @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt */ -namespace catcher\command\publish; +namespace catchAdmin\wechat\command; use think\console\Command; use think\console\Input; -use think\console\input\Argument; -use think\console\input\Option; use think\console\Output; -use catcher\CatchAdmin; class WechatCommand extends Command { diff --git a/catch/wechat/route.php b/catch/wechat/route.php index 66be840..45770d4 100644 --- a/catch/wechat/route.php +++ b/catch/wechat/route.php @@ -1,51 +1,50 @@ - - * @copyright By CatchAdmin - * @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt - */ - -$router->group('wechat', function () use ($router){ - // 公众号粉丝 - $router->group('official/users', function () use ($router){ - $router->get('', '\catchAdmin\wechat\controller\Users@index'); - $router->put('remark//', '\catchAdmin\wechat\controller\Users@remark'); - $router->put('block/', '\catchAdmin\wechat\controller\Users@block'); - $router->put('tag/', '\catchAdmin\wechat\controller\Users@tag'); - $router->get('sync', '\catchAdmin\wechat\controller\Users@sync'); - }); - // 粉丝标签 - $router->group('official/tags', function () use ($router){ - $router->resource('', '\catchAdmin\wechat\controller\Tags'); - $router->get('sync', '\catchAdmin\wechat\controller\Tags@sync'); - }); - // 微信菜单 - $router->group('official/menus', function () use ($router){ - $router->resource('', '\catchAdmin\wechat\controller\Menus'); - $router->post('sync', '\catchAdmin\wechat\controller\Menus@sync'); - }); - // 图文管理 - $router->group('official/graphic', function () use ($router){ - $router->resource('', '\catchAdmin\wechat\controller\Graphic'); - }); - // 微信回复管理 - $router->group('official/reply', function () use ($router){ - $router->get('', '\catchAdmin\wechat\controller\Reply@index'); - $router->post('', '\catchAdmin\wechat\controller\Reply@save'); - $router->delete('', '\catchAdmin\wechat\controller\Reply@delete'); - $router->put('enable/', '\catchAdmin\wechat\controller\Reply@disOrEnable'); - }); - // 微信上传 - $router->group('official/upload', function () use ($router){ - $router->post('/image', '\catchAdmin\wechat\controller\Upload@image'); - $router->post('/file', '\catchAdmin\wechat\controller\Upload@file'); - }); -})->middleware('auth'); - -// 消息 -$router->rule('wechat', '\catchAdmin\wechat\controller\Message@done', 'GET|POST'); - + + * @copyright By CatchAdmin + * @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt + */ + +$router->group('wechat', function () use ($router){ + // 公众号粉丝 + $router->group('official/users', function () use ($router){ + $router->get('', '\catchAdmin\wechat\controller\Users@index'); + $router->put('remark//', '\catchAdmin\wechat\controller\Users@remark'); + $router->put('block/', '\catchAdmin\wechat\controller\Users@block'); + $router->put('tag/', '\catchAdmin\wechat\controller\Users@tag'); + $router->get('sync', '\catchAdmin\wechat\controller\Users@sync'); + }); + // 粉丝标签 + $router->group('official/tags', function () use ($router){ + $router->resource('', '\catchAdmin\wechat\controller\Tags'); + $router->get('sync', '\catchAdmin\wechat\controller\Tags@sync'); + }); + // 微信菜单 + $router->group('official/menus', function () use ($router){ + $router->resource('', '\catchAdmin\wechat\controller\Menus'); + $router->post('sync', '\catchAdmin\wechat\controller\Menus@sync'); + }); + // 图文管理 + $router->group('official/graphic', function () use ($router){ + $router->resource('', '\catchAdmin\wechat\controller\Graphic'); + }); + // 微信回复管理 + $router->group('official/reply', function () use ($router){ + $router->get('', '\catchAdmin\wechat\controller\Reply@index'); + $router->post('', '\catchAdmin\wechat\controller\Reply@save'); + $router->delete('', '\catchAdmin\wechat\controller\Reply@delete'); + $router->put('enable/', '\catchAdmin\wechat\controller\Reply@disOrEnable'); + }); + // 微信上传 + $router->group('official/upload', function () use ($router){ + $router->post('/image', '\catchAdmin\wechat\controller\Upload@image'); + $router->post('/file', '\catchAdmin\wechat\controller\Upload@file'); + }); +})->middleware('auth'); + +// 消息 +$router->rule('wechat', '\catchAdmin\wechat\controller\Message@done', 'GET|POST'); \ No newline at end of file