|
@@ -158,8 +158,8 @@ func formatWxUser(wxUser *models.WxUserItem, platform int) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//用户绑定
|
|
|
-func BindWxUser(openid, mobile, email string, areaNum, registerPlatform int) (wxUser *models.WxUserItem, err error) {
|
|
|
+// BindWxUser 用户绑定
|
|
|
+func BindWxUser(openid, mobile, email string, areaNum, registerPlatform int) (wxUser *models.WxUserItem, errMsg string, err error) {
|
|
|
source := 1 //绑定来源,1:微信端,2:pc网页端,3:查研观向小程序,4:每日咨询
|
|
|
if mobile == "" && email == "" {
|
|
|
err = errors.New("手机号或邮箱必填一个")
|
|
@@ -234,6 +234,14 @@ func BindWxUser(openid, mobile, email string, areaNum, registerPlatform int) (wx
|
|
|
//如果存在该手机号/邮箱,那么需要校验
|
|
|
if userRecord.UserId > 0 && userRecord.UserId != userId {
|
|
|
err = errors.New(fmt.Sprint("用户已绑定其他账户,已绑定的用户编号:", userRecord.UserId, ",不允许重复绑定"))
|
|
|
+ currUser, _ := models.GetWxUserItemByUserId(userRecord.UserId)
|
|
|
+ if currUser != nil {
|
|
|
+ currBindAccount := currUser.Mobile
|
|
|
+ if currBindAccount == `` {
|
|
|
+ currBindAccount = currUser.Email
|
|
|
+ }
|
|
|
+ errMsg = "微信已绑定其它账户:" + currBindAccount
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
if userRecord.UserId == 0 {
|