From 3ec8df3ac70fecb7b22c3c9fca7917320e42bd72 Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 18 Jul 2019 10:39:52 +0800 Subject: [PATCH] Update Push.php --- application/wechat/controller/api/Push.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/application/wechat/controller/api/Push.php b/application/wechat/controller/api/Push.php index 3af2cd38a..4349284b2 100644 --- a/application/wechat/controller/api/Push.php +++ b/application/wechat/controller/api/Push.php @@ -324,14 +324,15 @@ class Push extends Controller if ($subscribe) { try { $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) { - Log::error(__METHOD__ . " {$this->openid} 粉丝信息获取失败,{$e->getMessage()}"); + Log::error(__METHOD__ . " {$this->openid} get userinfo faild. {$e->getMessage()}"); return false; } + } else { + $user = ['subscribe' => '0', 'openid' => $this->openid, 'appid' => $this->appid]; + return data_save('WechatFans', $user, 'openid', ['appid' => $this->appid]); } - $user = ['subscribe' => '0', 'openid' => $this->openid, 'appid' => $this->appid]; - return data_save('WechatFans', $user, 'openid', ['appid' => $this->appid]); } }