Procházet zdrojové kódy

Merge branch 'dev_v1.0.3_wh' of moapp/jypkg into feature/v1.0.3

王浩 před 1 rokem
rodič
revize
55ef27cc37
1 změnil soubory, kde provedl 4 přidání a 6 odebrání
  1. 4 6
      ent/entity/user.go

+ 4 - 6
ent/entity/user.go

@@ -308,14 +308,13 @@ func (u *User) PhoneExist(phone string, entId int) *[]map[string]interface{} {
 	return Mysql.SelectBySql("select id from entniche_user where phone=? and ent_id=?", phone, entId)
 }
 
-func (u *User) UpdateUserName(entId, userId int, user_name string) {
+func (u *User) UpdateUserName(tx *sql.Tx, entId, userId int, user_name string) {
 	//entniche_user表,用户名字段 user_name
 	//base_user表,用户名字段 user_name
 	//mog库user表,用户名字段 user_name
 	if user_name != "" && len(user_name) > 0 {
 		user := u.GetById(entId, userId)
-		Mysql.UpdateOrDeleteBySql(`update entniche_user set user_name=? where phone=? and  ent_id!=?`, user.User_name, user.Phone, entId)
-
+		Mysql.UpdateOrDeleteBySqlByTx(tx, `update entniche_user set user_name=? where phone=? and  ent_id!=?`, user.User_name, user.Phone, entId)
 		data, _ := MQFW.Find("user", map[string]interface{}{
 			"i_appid": 2,
 			"$or": []map[string]interface{}{
@@ -354,7 +353,7 @@ func (u *User) UpdateInfo(mail string, phone string, name string, userId, deptId
 			}, true, false)
 			ok_2 := Mysql.UpdateOrDeleteBySqlByTx(tx, "update entniche_info set admin=?,phone=? where id=?", name, phone, entId)
 			ok_3 := VarUser.Move(tx, entId, deptId, fmt.Sprint(userId))
-			u.UpdateUserName(entId, userId, user_name)
+			u.UpdateUserName(tx, entId, userId, user_name)
 			return ok_1 != -1 && ok_3 && ok_2 != -1
 		})
 		if ok {
@@ -363,7 +362,6 @@ func (u *User) UpdateInfo(mail string, phone string, name string, userId, deptId
 					"phone": phone,
 				},
 			}, false, false)
-			u.UpdateUserName(entId, userId, user_name)
 			return f
 		} else {
 			return false
@@ -377,7 +375,7 @@ func (u *User) UpdateInfo(mail string, phone string, name string, userId, deptId
 				},
 			}, true, false)
 			ok_2 := VarUser.Move(tx, entId, deptId, fmt.Sprint(userId))
-			u.UpdateUserName(entId, userId, user_name)
+			u.UpdateUserName(tx, entId, userId, user_name)
 			return ok_1 == 1 && ok_2
 		})
 	}