From 1e43ec64facc5e7f57b2f356ec1a6b121cdb0e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 13 Sep 2021 16:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1=E9=BB=91?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/wechat/command/Fans.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/wechat/command/Fans.php b/app/wechat/command/Fans.php index 6b232514e..9b11199dd 100644 --- a/app/wechat/command/Fans.php +++ b/app/wechat/command/Fans.php @@ -102,11 +102,13 @@ class Fans extends Command */ public function _black(string $next = '', int $done = 0): string { + $wechat = WechatService::WeChatUser(); $this->setQueueProgress("开始更新黑名单的微信用户"); - [$map, $data, $wechat] = [['is_black' => 0], ['is_black' => 1], WechatService::WeChatUser()]; while (!is_null($next) && is_array($result = $wechat->getBlackList($next)) && !empty($result['data']['openid'])) { foreach (array_chunk($result['data']['openid'], 100) as $chunk) { - $this->app->db->name('WechatFans')->where($map)->whereIn('openid', $chunk)->update($data); + $done += count($chunk); + $map = [['is_black', '=', 0], ['openid', 'in', $chunk]]; + $this->app->db->name('WechatFans')->where($map)->update(['is_black' => 1]); } $next = $result['total'] > $done ? $result['next_openid'] : null; }