|
@@ -211,6 +211,16 @@ func BindWxUser(openid,mobile,email string) (wxUser *models.WxUserItem,err error
|
|
|
return
|
|
|
}
|
|
|
userRecord.UserId = userId
|
|
|
+
|
|
|
+ if userRecord.NickName == ""{
|
|
|
+ oldUserRecord, err := models.GetUserThirdRecordByUserId(userId)
|
|
|
+ if err == nil && oldUserRecord != nil{
|
|
|
+
|
|
|
+ if oldUserRecord.NickName != ""{
|
|
|
+ _ = models.ModifyUserRecordInfo(userRecord.OpenId,oldUserRecord.NickName, oldUserRecord.Headimgurl, oldUserRecord.City, oldUserRecord.Province, oldUserRecord.Country, oldUserRecord.Sex, userId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
formatWxUserAndUserRecord(wxUser,userRecord)
|
|
|
return
|
|
@@ -226,11 +236,18 @@ func WxLogin(code string,wxAccessToken *WxAccessToken,wxUserInfo *WxUserInfo)(to
|
|
|
|
|
|
|
|
|
firstLogin = 1
|
|
|
+
|
|
|
+QUERY_WX_USER:
|
|
|
wxUser, wxUserErr := GetWxUserItemByOpenId(openId)
|
|
|
if wxUserErr == ERR_NO_USER_RECORD{
|
|
|
_,recordErr := AddUserRecord(openId,unionId,wxUserInfo.Nickname,"",wxUserInfo.Province,wxUserInfo.City,wxUserInfo.Country,wxUserInfo.Headimgurl,"",utils.WxPlatform,wxUserInfo.Sex,0)
|
|
|
- err = recordErr
|
|
|
- return
|
|
|
+
|
|
|
+ if recordErr != nil{
|
|
|
+ err = recordErr
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ goto QUERY_WX_USER
|
|
|
}else if wxUserErr == ERR_USER_NOT_BIND{
|
|
|
|
|
|
|