mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
合并微信同步指令
This commit is contained in:
parent
7ee4141d0f
commit
986da27207
@ -33,6 +33,11 @@ class Fans extends Command
|
|||||||
*/
|
*/
|
||||||
protected $module = ['list', 'tags', 'black'];
|
protected $module = ['list', 'tags', 'black'];
|
||||||
|
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this->setName('xadmin:fansall')->setDescription('[获取]同步远程的微信用户');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行指令
|
* 执行指令
|
||||||
* @param Input $input
|
* @param Input $input
|
||||||
@ -41,8 +46,11 @@ class Fans extends Command
|
|||||||
*/
|
*/
|
||||||
protected function execute(Input $input, Output $output)
|
protected function execute(Input $input, Output $output)
|
||||||
{
|
{
|
||||||
|
$message = '';
|
||||||
foreach ($this->module as $m) {
|
foreach ($this->module as $m) {
|
||||||
if (method_exists($this, $fun = "_{$m}")) $this->$fun();
|
if (method_exists($this, $fun = "_{$m}")) {
|
||||||
|
$message .= $this->$fun();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +58,7 @@ class Fans extends Command
|
|||||||
* 同步微信粉丝列表
|
* 同步微信粉丝列表
|
||||||
* @param string $next
|
* @param string $next
|
||||||
* @param integer $done
|
* @param integer $done
|
||||||
|
* @return string
|
||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
* @throws \think\Exception
|
* @throws \think\Exception
|
||||||
@ -75,12 +84,14 @@ class Fans extends Command
|
|||||||
}
|
}
|
||||||
$this->output->comment('微信粉丝数据同步完成!');
|
$this->output->comment('微信粉丝数据同步完成!');
|
||||||
$this->output->newLine();
|
$this->output->newLine();
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步粉丝黑名单列表
|
* 同步粉丝黑名单列表
|
||||||
* @param string $next
|
* @param string $next
|
||||||
* @param integer $done
|
* @param integer $done
|
||||||
|
* @return string
|
||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
@ -99,11 +110,17 @@ class Fans extends Command
|
|||||||
}
|
}
|
||||||
$this->output->comment('微信黑名单数据同步完成!');
|
$this->output->comment('微信黑名单数据同步完成!');
|
||||||
$this->output->newLine();
|
$this->output->newLine();
|
||||||
|
if (empty($result['total'])) {
|
||||||
|
return '同步微信用户0人';
|
||||||
|
} else {
|
||||||
|
return "同步微信用户{$result['total']}人";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步粉丝标签列表
|
* 同步粉丝标签列表
|
||||||
* @param integer $index
|
* @param integer $index
|
||||||
|
* @return string
|
||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
* @throws \think\Exception
|
* @throws \think\Exception
|
||||||
@ -128,6 +145,7 @@ class Fans extends Command
|
|||||||
}
|
}
|
||||||
$this->output->comment('微信粉丝标签数据同步完成!');
|
$this->output->comment('微信粉丝标签数据同步完成!');
|
||||||
$this->output->newLine();
|
$this->output->newLine();
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 官方网站: http://demo.thinkadmin.top
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 开源协议 ( https://mit-license.org )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
||||||
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace app\wechat\command\fans;
|
|
||||||
|
|
||||||
use app\wechat\command\Fans;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步全部粉丝指令
|
|
||||||
* Class FansAll
|
|
||||||
* @package app\wechat\command\fans
|
|
||||||
*/
|
|
||||||
class FansAll extends Fans
|
|
||||||
{
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->module = ['list', 'black', 'tags'];
|
|
||||||
$this->setName('xsync:fansall')->setDescription('[同步]所有微信粉丝的数据');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 官方网站: http://demo.thinkadmin.top
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 开源协议 ( https://mit-license.org )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
||||||
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace app\wechat\command\fans;
|
|
||||||
|
|
||||||
use app\wechat\command\Fans;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 粉丝黑名单指令
|
|
||||||
* Class FansBlack
|
|
||||||
* @package app\wechat\command\fans
|
|
||||||
*/
|
|
||||||
class FansBlack extends Fans
|
|
||||||
{
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->module = ['black'];
|
|
||||||
$this->setName('xsync:fansblack')->setDescription('[同步]微信黑名单粉丝数据');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 官方网站: http://demo.thinkadmin.top
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 开源协议 ( https://mit-license.org )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
||||||
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace app\wechat\command\fans;
|
|
||||||
|
|
||||||
use app\wechat\command\Fans;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 粉丝列表指令管理
|
|
||||||
* Class FansList
|
|
||||||
* @package app\wechat\command\fans
|
|
||||||
*/
|
|
||||||
class FansList extends Fans
|
|
||||||
{
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->module = ['list'];
|
|
||||||
$this->setName('xsync:fanslist')->setDescription('[同步]微信粉丝的全部列表');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 官方网站: http://demo.thinkadmin.top
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | 开源协议 ( https://mit-license.org )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|
||||||
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace app\wechat\command\fans;
|
|
||||||
|
|
||||||
use app\wechat\command\Fans;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 粉丝标签指令
|
|
||||||
* Class FansTags
|
|
||||||
* @package app\wechat\command\fans
|
|
||||||
*/
|
|
||||||
class FansTags extends Fans
|
|
||||||
{
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->module = ['tags'];
|
|
||||||
$this->setName('xsync:fanstags')->setDescription('[同步]粉丝的标签记录数据');
|
|
||||||
}
|
|
||||||
}
|
|
@ -71,7 +71,7 @@ class Fans extends Controller
|
|||||||
public function sync()
|
public function sync()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
sysqueue('同步用户数据', "xsync:fansall", 1, [], 0);
|
sysqueue('同步用户数据', "xadmin:fansall", 1, [], 0);
|
||||||
$this->success('创建任务成功,请等待完成!');
|
$this->success('创建任务成功,请等待完成!');
|
||||||
} catch (HttpResponseException $exception) {
|
} catch (HttpResponseException $exception) {
|
||||||
throw $exception;
|
throw $exception;
|
||||||
|
@ -3,10 +3,5 @@
|
|||||||
use think\Console;
|
use think\Console;
|
||||||
|
|
||||||
Console::starting(function (Console $console) {
|
Console::starting(function (Console $console) {
|
||||||
$console->addCommands([
|
$console->addCommand('app\wechat\command\Fans');
|
||||||
'app\wechat\command\fans\fansAll',
|
|
||||||
'app\wechat\command\fans\fansBlack',
|
|
||||||
'app\wechat\command\fans\fansList',
|
|
||||||
'app\wechat\command\fans\fansTags',
|
|
||||||
]);
|
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user