Browse Source

feat:xiugai

wangchuanjin 8 months ago
parent
commit
340be6f5a3
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/jfw/modules/publicapply/src/oneclick/entity/entity.go

+ 6 - 6
src/jfw/modules/publicapply/src/oneclick/entity/entity.go

@@ -266,7 +266,7 @@ func (o *OneClickInfo) ProcessPhone(phone string) (map[string]interface{}, error
 	returnData := map[string]interface{}{}
 	// 绑定
 	if o.ActionType == "B" { // 绑定手机号
-		token, err := o.bindPhone(phone)
+		token, err := o.bindPhone(phone, false)
 		if err != nil {
 			return nil, err
 		} else if token != "" {
@@ -287,7 +287,7 @@ func (o *OneClickInfo) ProcessPhone(phone string) (map[string]interface{}, error
 }
 
 // 绑定手机号
-func (o *OneClickInfo) bindPhone(phone string) (string, error) {
+func (o *OneClickInfo) bindPhone(phone string, isAccountMerge bool) (string, error) {
 	var (
 		mgoUserId, _ = o.Session.Get("mgoUserId").(string)
 		token        = ""
@@ -310,7 +310,7 @@ func (o *OneClickInfo) bindPhone(phone string) (string, error) {
 		}
 		o.Session.Set("relationPhoneId", relationPhoneId)
 		var err error
-		token, err = AccountMerge(phone, "", mgoUserId, o.Session)
+		token, err = AccountMerge(phone, "", mgoUserId, o.Session, isAccountMerge)
 		mgoUserId, _ = o.Session.Get("mgoUserId").(string)
 		go o.saveLog(mgoUserId, "o_bind")
 		if err != nil {
@@ -367,7 +367,7 @@ func (o *OneClickInfo) phoneLogin(phone string) (map[string]interface{}, error)
 		userPhone := common.InterfaceToStr(o.Session.Get("phone"))
 		userId := common.InterfaceToStr(o.Session.Get("userId"))
 		if userId != "" && userPhone == "" {
-			if _, err := o.bindPhone(phone); err == nil {
+			if _, err := o.bindPhone(phone, true); err == nil {
 				jy.JyAppCreateSession(db.Mgo, o.Session, userId, 0, *o.ResponseWriter, true, config.Middleground, config.Config.AppPushServiceRpc, config.Config.Criticality)
 			} else if err.Error() == PhoneHasBind {
 				//已经绑定过手机号
@@ -527,7 +527,7 @@ func (o *OneClickInfo) phoneLogin(phone string) (map[string]interface{}, error)
 }
 
 // 绑定
-func AccountMerge(phone, email, mgoUserId string, sess *httpsession.Session) (token string, err error) {
+func AccountMerge(phone, email, mgoUserId string, sess *httpsession.Session, isAccountMerge bool) (token string, err error) {
 	if userinfo := config.Compatible.Select(mgoUserId, `{"s_unionid":1,"s_name":1,"s_nickname":1,"s_headimageurl":1,"l_registedate":1,"i_ispush":1,"i_applystatus":1,"i_sex":1,"s_country":1,"s_province":1,"s_city":1,"s_m_openid":1,"a_m_openid":1,"base_user_id":1,"s_newsource":1,"l_registedate":1}`); userinfo != nil && len(*userinfo) > 0 {
 		//新用户时间
 		onLineTime, _ := time.ParseInLocation(date.Date_Full_Layout, config.Config.AccountMergeOnline, time.Local)
@@ -559,7 +559,7 @@ func AccountMerge(phone, email, mgoUserId string, sess *httpsession.Session) (to
 				//用户中台存储  结束
 				jy.CreateUserMerge(db.Mgo, db.Mysql, sess, config.Middleground).FlushSession(mgoUserId) //刷新session
 			}
-		} else if onLineTime.Before(reg) { //新微信用户直接绑定
+		} else if isAccountMerge || onLineTime.Before(reg) { //新微信用户直接绑定
 			data := map[string]interface{}{
 				"s_unionid":      (*userinfo)["s_unionid"],
 				"s_name":         (*userinfo)["s_name"],