|
@@ -28,7 +28,7 @@ func (this *PhoneUtil) Log(userId, operation, value string) {
|
|
|
|
|
|
// 获取微信关联字段
|
|
|
func (this *PhoneUtil) getWxRelationMap(userId string) *map[string]interface{} {
|
|
|
- rData, _ := this.UserMgoDB.FindById("user", userId, `{"s_unionid":1,"s_name":1,"s_nickname":1,"s_headimageurl":1}`)
|
|
|
+ rData, _ := this.UserMgoDB.FindById("user", userId, `{"s_unionid":1,"s_name":1,"s_nickname":1,"s_headimageurl":1,"s_rsource":1}`)
|
|
|
if rData == nil || len(*rData) == 0 {
|
|
|
return nil
|
|
|
}
|
|
@@ -47,6 +47,10 @@ func (this *PhoneUtil) getUserPhone(userId string) (phone string) {
|
|
|
|
|
|
// 绑定微信
|
|
|
func (this *PhoneUtil) bindWeixin(phoneUserId string, wxRelationMap *map[string]interface{}, opera string) error {
|
|
|
+ rSource := qutil.InterfaceToStr((*wxRelationMap)["s_rsource"])
|
|
|
+ if rSource == "" {
|
|
|
+ delete(*wxRelationMap, "s_rsource") //防止来源覆盖
|
|
|
+ }
|
|
|
if !this.UserMgoDB.UpdateById("user", phoneUserId, map[string]interface{}{
|
|
|
"$set": wxRelationMap,
|
|
|
}) {
|
|
@@ -80,7 +84,10 @@ func (this *PhoneUtil) bindPhone(weixinUserId, phone, email, opera, s_rsource st
|
|
|
data := map[string]interface{}{
|
|
|
"s_m_phone": phone,
|
|
|
"l_bindphonetime": time.Now().Unix(),
|
|
|
- "s_rsource": s_rsource,
|
|
|
+ //"s_rsource": s_rsource,
|
|
|
+ }
|
|
|
+ if s_rsource != "" {
|
|
|
+ data["s_rsource"] = s_rsource //防止来源覆盖
|
|
|
}
|
|
|
if EmailPattern.MatchString(email) {
|
|
|
data["s_email"] = email
|