修改wechat commands 注入方式

This commit is contained in:
JaguarJack 2020-07-02 14:01:47 +08:00
parent 26e26b60a7
commit e51cbc6850
3 changed files with 54 additions and 62 deletions

View File

@ -16,21 +16,17 @@ class CatchWechatService extends ModuleService
public function register() public function register()
{ {
parent::register(); parent::register();
$this->registerCommand();
} }
/** /**
* register command * register command
* *
* @time 2020年06月24日 * @time 2020年06月24日
* @return void * @return array
*/ */
public function registerCommand() public function loadCommands()
{ {
$this->commands([ return [__NAMESPACE__, __DIR__ . DIRECTORY_SEPARATOR . 'command'];
SyncUsersCommand::class,
]);
} }
/** /**

View File

@ -8,14 +8,11 @@
* @copyright By CatchAdmin * @copyright By CatchAdmin
* @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt * @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\Command;
use think\console\Input; use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output; use think\console\Output;
use catcher\CatchAdmin;
class WechatCommand extends Command class WechatCommand extends Command
{ {

View File

@ -1,51 +1,50 @@
<?php <?php
/** /**
* @filename route.php * @filename route.php
* @date 2020/6/7 * @date 2020/6/7
* @project https://github.com/yanwenwu/catch-admin * @project https://github.com/yanwenwu/catch-admin
* @document http://doc.catchadmin.com * @document http://doc.catchadmin.com
* @author JaguarJack <njphper@gmail.com> * @author JaguarJack <njphper@gmail.com>
* @copyright By CatchAdmin * @copyright By CatchAdmin
* @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt * @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt
*/ */
$router->group('wechat', function () use ($router){ $router->group('wechat', function () use ($router){
// 公众号粉丝 // 公众号粉丝
$router->group('official/users', function () use ($router){ $router->group('official/users', function () use ($router){
$router->get('', '\catchAdmin\wechat\controller\Users@index'); $router->get('', '\catchAdmin\wechat\controller\Users@index');
$router->put('remark/<id>/<remark>', '\catchAdmin\wechat\controller\Users@remark'); $router->put('remark/<id>/<remark>', '\catchAdmin\wechat\controller\Users@remark');
$router->put('block/<id>', '\catchAdmin\wechat\controller\Users@block'); $router->put('block/<id>', '\catchAdmin\wechat\controller\Users@block');
$router->put('tag/<id>', '\catchAdmin\wechat\controller\Users@tag'); $router->put('tag/<id>', '\catchAdmin\wechat\controller\Users@tag');
$router->get('sync', '\catchAdmin\wechat\controller\Users@sync'); $router->get('sync', '\catchAdmin\wechat\controller\Users@sync');
}); });
// 粉丝标签 // 粉丝标签
$router->group('official/tags', function () use ($router){ $router->group('official/tags', function () use ($router){
$router->resource('', '\catchAdmin\wechat\controller\Tags'); $router->resource('', '\catchAdmin\wechat\controller\Tags');
$router->get('sync', '\catchAdmin\wechat\controller\Tags@sync'); $router->get('sync', '\catchAdmin\wechat\controller\Tags@sync');
}); });
// 微信菜单 // 微信菜单
$router->group('official/menus', function () use ($router){ $router->group('official/menus', function () use ($router){
$router->resource('', '\catchAdmin\wechat\controller\Menus'); $router->resource('', '\catchAdmin\wechat\controller\Menus');
$router->post('sync', '\catchAdmin\wechat\controller\Menus@sync'); $router->post('sync', '\catchAdmin\wechat\controller\Menus@sync');
}); });
// 图文管理 // 图文管理
$router->group('official/graphic', function () use ($router){ $router->group('official/graphic', function () use ($router){
$router->resource('', '\catchAdmin\wechat\controller\Graphic'); $router->resource('', '\catchAdmin\wechat\controller\Graphic');
}); });
// 微信回复管理 // 微信回复管理
$router->group('official/reply', function () use ($router){ $router->group('official/reply', function () use ($router){
$router->get('', '\catchAdmin\wechat\controller\Reply@index'); $router->get('', '\catchAdmin\wechat\controller\Reply@index');
$router->post('', '\catchAdmin\wechat\controller\Reply@save'); $router->post('', '\catchAdmin\wechat\controller\Reply@save');
$router->delete('<id>', '\catchAdmin\wechat\controller\Reply@delete'); $router->delete('<id>', '\catchAdmin\wechat\controller\Reply@delete');
$router->put('enable/<id>', '\catchAdmin\wechat\controller\Reply@disOrEnable'); $router->put('enable/<id>', '\catchAdmin\wechat\controller\Reply@disOrEnable');
}); });
// 微信上传 // 微信上传
$router->group('official/upload', function () use ($router){ $router->group('official/upload', function () use ($router){
$router->post('/image', '\catchAdmin\wechat\controller\Upload@image'); $router->post('/image', '\catchAdmin\wechat\controller\Upload@image');
$router->post('/file', '\catchAdmin\wechat\controller\Upload@file'); $router->post('/file', '\catchAdmin\wechat\controller\Upload@file');
}); });
})->middleware('auth'); })->middleware('auth');
// 消息 // 消息
$router->rule('wechat', '\catchAdmin\wechat\controller\Message@done', 'GET|POST'); $router->rule('wechat', '\catchAdmin\wechat\controller\Message@done', 'GET|POST');