mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update Fans.php
This commit is contained in:
parent
22aff02257
commit
1104f1096a
@ -101,7 +101,10 @@ class Fans extends Command
|
|||||||
* @return string
|
* @return string
|
||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
|
* @throws \think\admin\Exception
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function _black($next = '', $done = 0)
|
public function _black($next = '', $done = 0)
|
||||||
{
|
{
|
||||||
@ -112,7 +115,7 @@ class Fans extends Command
|
|||||||
foreach (array_chunk($result['data']['openid'], 100) as $chunk) {
|
foreach (array_chunk($result['data']['openid'], 100) as $chunk) {
|
||||||
$this->app->db->name('WechatFans')->where(['is_black' => '0'])->whereIn('openid', $chunk)->update(['is_black' => '1']);
|
$this->app->db->name('WechatFans')->where(['is_black' => '0'])->whereIn('openid', $chunk)->update(['is_black' => '1']);
|
||||||
}
|
}
|
||||||
$this->output->writeln("--> 共计同步微信黑名单{$result['total']}人");
|
$this->setQueueProgress(2, "共计同步微信黑名单{$result['total']}人");
|
||||||
$next = $result['total'] > $done ? $result['next_openid'] : null;
|
$next = $result['total'] > $done ? $result['next_openid'] : null;
|
||||||
}
|
}
|
||||||
$this->output->comment('--> Wechat blacklist data synchronization completed');
|
$this->output->comment('--> Wechat blacklist data synchronization completed');
|
||||||
@ -131,6 +134,7 @@ class Fans extends Command
|
|||||||
* @throws \WeChat\Exceptions\InvalidResponseException
|
* @throws \WeChat\Exceptions\InvalidResponseException
|
||||||
* @throws \WeChat\Exceptions\LocalCacheException
|
* @throws \WeChat\Exceptions\LocalCacheException
|
||||||
* @throws \think\Exception
|
* @throws \think\Exception
|
||||||
|
* @throws \think\admin\Exception
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
@ -143,8 +147,8 @@ class Fans extends Command
|
|||||||
$count = count($list['tags']);
|
$count = count($list['tags']);
|
||||||
foreach ($list['tags'] as &$tag) {
|
foreach ($list['tags'] as &$tag) {
|
||||||
$tag['appid'] = $appid;
|
$tag['appid'] = $appid;
|
||||||
$indexString = str_pad(++$index, strlen($count), '0', STR_PAD_LEFT);
|
$progress = str_pad(++$index, strlen($count), '0', STR_PAD_LEFT);
|
||||||
$this->output->writeln("({$indexString}/{$count}) -> {$tag['name']}");
|
$this->setQueueProgress(2, "({$progress}/{$count}) -> {$tag['name']}");
|
||||||
}
|
}
|
||||||
$this->app->db->name('WechatFansTags')->where(['appid' => $appid])->delete();
|
$this->app->db->name('WechatFansTags')->where(['appid' => $appid])->delete();
|
||||||
$this->app->db->name('WechatFansTags')->insertAll($list['tags']);
|
$this->app->db->name('WechatFansTags')->insertAll($list['tags']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user