Эх сурвалжийг харах

手机号绑定、更改校验手机号存在

wangkaiyue 4 жил өмнө
parent
commit
15c540fcc0

+ 8 - 8
entbase/src/service/phone/phone.go

@@ -48,10 +48,10 @@ func (a *Action) Bind() {
 			return
 			return
 		}
 		}
 		//绑定手机号
 		//绑定手机号
-		if bindOK, appid := VarCurrentUser.BindPhone(userId, phone); bindOK {
-			if appid == 2 {
-				go jy.AutoMerge(Mysql, MQFW, a.Session())
-			}
+		if bindOK, _ := VarCurrentUser.BindPhone(userId, phone); bindOK {
+			//if appid == 2 {
+			//	go jy.AutoMerge(Mysql, MQFW, a.Session())
+			//}
 			status = 1 //绑定成功
 			status = 1 //绑定成功
 			mylist := Mysql.SelectBySql(`SELECT id,name from entniche_info 
 			mylist := Mysql.SelectBySql(`SELECT id,name from entniche_info 
 				where phone=? and status=0 order by convert(name using gbk) COLLATE gbk_chinese_ci asc`, phone)
 				where phone=? and status=0 order by convert(name using gbk) COLLATE gbk_chinese_ci asc`, phone)
@@ -207,7 +207,7 @@ func (a *Action) Replace(operation string) {
 					status = 1
 					status = 1
 				}
 				}
 			} else if operation == "me" { //个人
 			} else if operation == "me" { //个人
-				replace_status, appid := VarCurrentUser.ReplacePhone(userId, newphone, ent_id)
+				replace_status, _ := VarCurrentUser.ReplacePhone(userId, newphone, ent_id)
 				if replace_status == -1 {
 				if replace_status == -1 {
 					a.ServeJson(Result{Data: M{"status": -3}, Error_msg: "绑定失败,该手机号已绑定"})
 					a.ServeJson(Result{Data: M{"status": -3}, Error_msg: "绑定失败,该手机号已绑定"})
 					return
 					return
@@ -215,9 +215,9 @@ func (a *Action) Replace(operation string) {
 					a.ServeJson(Result{Data: M{"status": -4}, Error_msg: "绑定失败,该手机号已存在"})
 					a.ServeJson(Result{Data: M{"status": -4}, Error_msg: "绑定失败,该手机号已存在"})
 					return
 					return
 				} else if replace_status == 1 {
 				} else if replace_status == 1 {
-					if appid == 2 {
-						go jy.AutoMerge(Mysql, MQFW, a.Session())
-					}
+					//if appid == 2 {
+					//	go jy.AutoMerge(Mysql, MQFW, a.Session())
+					//}
 					status = 1
 					status = 1
 				}
 				}
 			}
 			}

+ 1 - 1
entniche/src/service/phone/phone.go

@@ -33,7 +33,7 @@ func (a *Action) Bind() {
 		}
 		}
 		//查询是否绑定过微信号
 		//查询是否绑定过微信号
 		if bindOk, _ := VarCurrentUser.BindPhone(userId, phone); bindOk {
 		if bindOk, _ := VarCurrentUser.BindPhone(userId, phone); bindOk {
-			go jy.AutoMerge(MQFW, a.Session())
+			//go jy.AutoMerge(MQFW, a.Session())
 			status = 1 //绑定成功
 			status = 1 //绑定成功
 		} else {
 		} else {
 			status = 0 //已经绑定过
 			status = 0 //已经绑定过

+ 2 - 2
nicheinsight/src/service/phone/phone.go

@@ -40,7 +40,7 @@ func (a *Action) Bind() {
 		}
 		}
 		//绑定手机号
 		//绑定手机号
 		if bindOk, _ := VarCurrentUser.BindPhone(userId, phone); bindOk {
 		if bindOk, _ := VarCurrentUser.BindPhone(userId, phone); bindOk {
-			go jy.AutoMerge(MQFW, a.Session())
+			//go jy.AutoMerge(MQFW, a.Session())
 			status = 1 //绑定成功
 			status = 1 //绑定成功
 			//查询有没有所属的企业
 			//查询有没有所属的企业
 			ents := []M{}
 			ents := []M{}
@@ -105,7 +105,7 @@ func (a *Action) Replace() {
 			status = -5 //更改后的手机号已再企业员工下
 			status = -5 //更改后的手机号已再企业员工下
 		} else if replace_status == 1 {
 		} else if replace_status == 1 {
 			status = 1
 			status = 1
-			go jy.AutoMerge(MQFW, a.Session())
+			//go jy.AutoMerge(MQFW, a.Session())
 		}
 		}
 	}
 	}
 	a.ServeJson(Result{Data: M{"status": status}})
 	a.ServeJson(Result{Data: M{"status": status}})

+ 25 - 12
public/src/ent/entity/entity.go

@@ -99,26 +99,39 @@ func (c *CurrentUser) PhoneIsOccupy(userId, phone string) (bool, int) {
 		}
 		}
 	} else if qutil.IntAll((*user)["i_appid"]) == 2 {
 	} else if qutil.IntAll((*user)["i_appid"]) == 2 {
 		//查询是否绑定过微信号
 		//查询是否绑定过微信号
-		if MQFW.Count("user", map[string]interface{}{"i_appid": 2, "s_m_phone": phone}) > 0 {
-			return true, 2 //已经绑定过
-			//i_appid:2,i_type:{$ne:1},"$or":[{s_m_openid:{$exists:1}},{a_m_openid:{$exists:1}}]
-		} else if MQFW.Count("user", map[string]interface{}{
-			"i_appid": 2,
-			"s_phone": phone,
-			"i_type":  map[string]interface{}{"$ne": 1},
+		//if MQFW.Count("user", map[string]interface{}{"i_appid": 2, "s_m_phone": phone}) > 0 {
+		//	return true, 2 //已经绑定过
+		//	//i_appid:2,i_type:{$ne:1},"$or":[{s_m_openid:{$exists:1}},{a_m_openid:{$exists:1}}]
+		//} else if MQFW.Count("user", map[string]interface{}{
+		//	"i_appid": 2,
+		//	"s_phone": phone,
+		//	"i_type":  map[string]interface{}{"$ne": 1},
+		//	"$or": []map[string]interface{}{
+		//		map[string]interface{}{
+		//			"s_m_openid": map[string]interface{}{"$exists": 1},
+		//		},
+		//		map[string]interface{}{
+		//			"a_m_openid": map[string]interface{}{"$exists": 1},
+		//		},
+		//	},
+		//}) > 0 {
+		//	return true, 2 //被占用
+		//} else {
+		//	return false, 2
+		//}
+		if MQFW.Count("user", map[string]interface{}{"i_appid": 2,
 			"$or": []map[string]interface{}{
 			"$or": []map[string]interface{}{
 				map[string]interface{}{
 				map[string]interface{}{
-					"s_m_openid": map[string]interface{}{"$exists": 1},
+					"s_m_phone": phone,
 				},
 				},
 				map[string]interface{}{
 				map[string]interface{}{
-					"a_m_openid": map[string]interface{}{"$exists": 1},
+					"s_phone": phone,
 				},
 				},
 			},
 			},
 		}) > 0 {
 		}) > 0 {
-			return true, 2 //被占用
-		} else {
-			return false, 2
+			return true, 2
 		}
 		}
+		return false, 2
 	} else {
 	} else {
 		return true, -1
 		return true, -1
 	}
 	}