wangkaiyue 5 жил өмнө
parent
commit
4355eef2d1

+ 13 - 2
common/src/qfw/util/jy/user_merge.go

@@ -49,10 +49,10 @@ func AutoMerge(mg mongodb.MongodbSim, sess *httpsession.Session) (bool, error) {
 
 	thisNull, otherNull := func() (t, o bool) {
 		t, o = true, true
-		if len(*qutil.ObjToMap((*thisUser)["o_jy"])) > 2 || (*thisUser)["o_vipjy"] != nil {
+		if checNullkeyset((*qutil.ObjToMap((*thisUser)["o_jy"]))["a_key"]) || (*thisUser)["o_vipjy"] != nil {
 			t = false
 		}
-		if len(*qutil.ObjToMap((*otherUser)["o_jy"])) > 2 || (*otherUser)["o_vipjy"] != nil {
+		if checNullkeyset((*qutil.ObjToMap((*otherUser)["o_jy"]))["a_key"]) || (*otherUser)["o_vipjy"] != nil {
 			o = false
 		}
 		if !t && !o { //账户都不为空
@@ -104,6 +104,17 @@ func AutoMerge(mg mongodb.MongodbSim, sess *httpsession.Session) (bool, error) {
 	return true, nil
 }
 
+func checNullkeyset(a_key interface{}) bool {
+	if a_key == nil {
+		return false
+	}
+	arr, ok := a_key.([]interface{})
+	if ok && len(arr) > 0 {
+		return true
+	}
+	return false
+}
+
 func MergeData(mg mongodb.MongodbSim, saveRes, otherRes *map[string]interface{}) bool {
 	for k, v := range *otherRes {
 		if _, ok := (*saveRes)[k]; !ok {