Update FansService.php

This commit is contained in:
邹景立 2022-03-18 22:34:32 +08:00
parent 8049a21c27
commit 801788a3f2

View File

@ -32,9 +32,6 @@ class FansService extends Service
* @param array $user 粉丝信息 * @param array $user 粉丝信息
* @param string $appid 微信APPID * @param string $appid 微信APPID
* @return boolean * @return boolean
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
public function set(array $user, string $appid = ''): bool public function set(array $user, string $appid = ''): bool
{ {
@ -46,9 +43,9 @@ class FansService extends Service
} }
if ($appid !== '') $user['appid'] = $appid; if ($appid !== '') $user['appid'] = $appid;
unset($user['privilege'], $user['groupid']); unset($user['privilege'], $user['groupid']);
$this->app->event->trigger('WechatFansUpdate', $user);
foreach ($user as $k => $v) if ($v === '') unset($user[$k]); foreach ($user as $k => $v) if ($v === '') unset($user[$k]);
return !!data_save(WechatFans::class, $user, 'openid'); $this->app->event->trigger('WechatFansUpdate', $user);
return !!WechatFans::mUpdate($user, 'openid');
} }
/** /**