Quellcode durchsuchen

Merge branch 'master' of https://jygit.jydev.jianyu360.cn/moapp/jypkg

wangshan vor 4 Monaten
Ursprung
Commit
d6eca0e85a
1 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen
  1. 12 11
      common/src/qfw/util/jy/userPhoneUtil.go

+ 12 - 11
common/src/qfw/util/jy/userPhoneUtil.go

@@ -76,10 +76,11 @@ func (this *PhoneUtil) unBindWeixin(phoneUserId, opera string) error {
 }
 
 // 绑定手机号
-func (this *PhoneUtil) bindPhone(weixinUserId, phone, email, opera string) error {
+func (this *PhoneUtil) bindPhone(weixinUserId, phone, email, opera, s_rsource string) error {
 	data := map[string]interface{}{
 		"s_m_phone":       phone,
 		"l_bindphonetime": time.Now().Unix(),
+		"s_rsource":       s_rsource,
 	}
 	if EmailPattern.MatchString(email) {
 		data["s_email"] = email
@@ -124,7 +125,7 @@ func (this *PhoneUtil) buildRelation(wxUserId, phoneUserId, phone string, wxRela
 	if err := this.bindWeixin(phoneUserId, wxRelationMap, opera); err != nil {
 		return err
 	}
-	if err := this.bindPhone(wxUserId, phone, qutil.InterfaceToStr((*wxRelationMap)["s_email"]), opera); err != nil {
+	if err := this.bindPhone(wxUserId, phone, qutil.InterfaceToStr((*wxRelationMap)["s_email"]), opera, gconv.String((*wxRelationMap)["s_rsource"])); err != nil {
 		return err
 	}
 	return nil
@@ -146,8 +147,8 @@ func (this *PhoneUtil) QueryRelation(phone string) (wId, pId string, err error)
 	relationUser, _ := this.UserMgoDB.Find("user", map[string]interface{}{
 		"i_appid": 2,
 		"$or": []map[string]interface{}{
-			map[string]interface{}{"s_phone": phone},
-			map[string]interface{}{"s_m_phone": phone},
+			{"s_phone": phone},
+			{"s_m_phone": phone},
 		},
 	}, nil, `{"s_phone":1}`, false, -1, -1)
 	if relationUser == nil || len(*relationUser) == 0 {
@@ -226,7 +227,7 @@ param wxUserId:绑定手机号的微信
 func (this *PhoneUtil) BindPhone(wxUserId, relationPhoneId, phone, email string, wxRelationMap *map[string]interface{}) error {
 	if relationPhoneId == "" {
 		//单独绑定手机号
-		return this.bindPhone(wxUserId, phone, email, "BindPhone")
+		return this.bindPhone(wxUserId, phone, email, "BindPhone", gconv.String((*wxRelationMap)["s_rsource"]))
 	} else {
 		//绑定及建立双向关联
 		return this.buildRelation(wxUserId, relationPhoneId, phone, wxRelationMap, "BindPhone")
@@ -250,11 +251,11 @@ func (this *PhoneUtil) ChangePhoneIsOccupy(phone string, isWxAndNeedMerge bool)
 		relationUser, _ := this.UserMgoDB.Find("user", map[string]interface{}{
 			"i_appid": 2,
 			"$or": []map[string]interface{}{
-				map[string]interface{}{ //存在手机号未绑定微信的用户
+				{ //存在手机号未绑定微信的用户
 					"s_unionid": map[string]interface{}{"$exists": 1},
 					"s_phone":   phone,
 				},
-				map[string]interface{}{ //手机号已绑定
+				{ //手机号已绑定
 					"s_m_phone": phone,
 				},
 			},
@@ -272,10 +273,10 @@ func (this *PhoneUtil) ChangePhoneIsOccupy(phone string, isWxAndNeedMerge bool)
 		if this.UserMgoDB.Count("user", map[string]interface{}{
 			"i_appid": 2,
 			"$or": []map[string]interface{}{
-				map[string]interface{}{ //手机号用户
+				{ //手机号用户
 					"s_m_phone": phone,
 				},
-				map[string]interface{}{ //手机号已被绑定的用户
+				{ //手机号已被绑定的用户
 					"s_phone": phone,
 				},
 			},
@@ -305,10 +306,10 @@ func (this *PhoneUtil) BindWeixinIsOccupy(phone, unionId string) (exists bool, r
 			"s_unionid": unionId,
 			"s_phone":   map[string]interface{}{"$exists": 0},
 			"$or": []map[string]interface{}{
-				map[string]interface{}{
+				{
 					"s_m_phone": map[string]interface{}{"$exists": 0},
 				},
-				map[string]interface{}{
+				{
 					"s_m_phone": phone,
 				},
 			},