浏览代码

fix:修复用户绑定

zqbao 9 月之前
父节点
当前提交
13df2dd62d
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 1 1
      controllers/wechat.go
  2. 7 0
      services/user.go

+ 1 - 1
controllers/wechat.go

@@ -59,7 +59,7 @@ func (this *WechatController) Notify() {
 		<Content><![CDATA[%s]]></Content>
 		</xml>`
 		createTime := strconv.FormatInt(time.Now().Unix(), 10)
-		WxId := "gh_5dc508325c6f" // 研公众号原始id
+		WxId := "gh_5dc508325c6f" // 弘则投研公众号原始id
 		xmlTpl = fmt.Sprintf(xmlTpl, openId, WxId, createTime, contactMsg)
 
 		if item.MsgType == "event" {

+ 7 - 0
services/user.go

@@ -143,6 +143,13 @@ func BindUser(unionId, openId, phone, email, areaCode string) (userItem *models.
 		userRecord.UserId = userId
 		er = userRecord.Update([]string{"user_id"})
 		if er != nil {
+			err = errors.New("获取用户关注记录失败")
+			return
+		}
+		userItem.IsSubscribed = true
+		er = userItem.Update([]string{"is_subscribed"})
+		if er != nil {
+			err = errors.New("获取用户关注记录失败")
 			return
 		}
 	}