|
@@ -191,10 +191,11 @@ func BindWxUser(openid, mobile, email string) (wxUser *models.WxUserItem, err er
|
|
|
CreatedTime: time.Now(),
|
|
|
FirstLogin: 1,
|
|
|
Enabled: 1,
|
|
|
- RegisterPlatform: 1,
|
|
|
+ RegisterPlatform: 4,
|
|
|
RegisterTime: time.Now(),
|
|
|
Mobile: mobile,
|
|
|
Email: email,
|
|
|
+ IsRegister: 1,
|
|
|
}
|
|
|
tmpUserId, addUserErr := models.AddWxUser(user)
|
|
|
if err != nil {
|
|
@@ -220,11 +221,11 @@ func BindWxUser(openid, mobile, email string) (wxUser *models.WxUserItem, err er
|
|
|
userRecord.UserId = userId
|
|
|
|
|
|
//如果当前该第三方用户信息的昵称为空串的话,那么需要去查询该用户的第一个绑定信息的数据作为来源做数据修复
|
|
|
- if userRecord.NickName == ""{
|
|
|
+ if userRecord.NickName == "" {
|
|
|
oldUserRecord, err := models.GetUserThirdRecordByUserId(userId)
|
|
|
- if err == nil && oldUserRecord != nil{
|
|
|
+ if err == nil && oldUserRecord != nil {
|
|
|
//如果该用户绑定的第一条数据的头像信息不为空串,那么就去做新数据的修复
|
|
|
- if oldUserRecord.NickName != ""{
|
|
|
+ if oldUserRecord.NickName != "" {
|
|
|
_ = models.ModifyUserRecordByDetail(userRecord.OpenId, userRecord.UnionId, oldUserRecord.NickName, oldUserRecord.Headimgurl, oldUserRecord.City, oldUserRecord.Province, oldUserRecord.Country, oldUserRecord.Sex, userId)
|
|
|
}
|
|
|
}
|
|
@@ -251,7 +252,7 @@ QUERY_WX_USER:
|
|
|
//先添加第三方信息(openid等信息)
|
|
|
_, recordErr := AddUserRecord(openId, unionId, wxUserInfo.Nickname, "", wxUserInfo.Province, wxUserInfo.City, wxUserInfo.Country, wxUserInfo.Headimgurl, wxUserInfo.SessionKey, utils.WxPlatform, wxUserInfo.Sex, 0)
|
|
|
//如果插入失败,那么直接将错误信息返回
|
|
|
- if recordErr != nil{
|
|
|
+ if recordErr != nil {
|
|
|
err = recordErr
|
|
|
return
|
|
|
}
|
|
@@ -372,4 +373,4 @@ func AddUserRecord(openId, unionId, nickName, realName, province, city, country,
|
|
|
}
|
|
|
userRecord.UserRecordId = int(recordId)
|
|
|
return
|
|
|
-}
|
|
|
+}
|