Update Push.php

This commit is contained in:
Anyon 2019-07-18 10:39:52 +08:00
parent 71e4ccc7f9
commit 3ec8df3ac7

View File

@ -324,14 +324,15 @@ class Push extends Controller
if ($subscribe) { if ($subscribe) {
try { try {
$user = WechatService::WeChatUser()->getUserInfo($this->openid); $user = WechatService::WeChatUser()->getUserInfo($this->openid);
return FansService::set(array_merge($user, ['subscribe' => '1'])); return FansService::set(array_merge($user, ['subscribe' => '1', 'appid' => $this->appid]));
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error(__METHOD__ . " {$this->openid} 粉丝信息获取失败,{$e->getMessage()}"); Log::error(__METHOD__ . " {$this->openid} get userinfo faild. {$e->getMessage()}");
return false; return false;
} }
} } else {
$user = ['subscribe' => '0', 'openid' => $this->openid, 'appid' => $this->appid]; $user = ['subscribe' => '0', 'openid' => $this->openid, 'appid' => $this->appid];
return data_save('WechatFans', $user, 'openid', ['appid' => $this->appid]); return data_save('WechatFans', $user, 'openid', ['appid' => $this->appid]);
} }
}
} }