|
@@ -134,6 +134,11 @@ func (u *User) Del(entId int, ids string) bool {
|
|
|
|
|
|
//新增员工
|
|
//新增员工
|
|
func (u *User) Add(tx *sql.Tx, entId int, user *User, paymentAddress, source, nsq, nsq_Topic string) (int64, bool) {
|
|
func (u *User) Add(tx *sql.Tx, entId int, user *User, paymentAddress, source, nsq, nsq_Topic string) (int64, bool) {
|
|
|
|
+ if user.User_name != "" && len(user.User_name) > 0 {
|
|
|
|
+ if !u.UserNameExist(user.User_name, user.Phone) {
|
|
|
|
+ return 0, false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
nowFormat := NowFormat(Date_Full_Layout)
|
|
nowFormat := NowFormat(Date_Full_Layout)
|
|
user_id := Mysql.InsertByTx(tx, Entniche_user, map[string]interface{}{
|
|
user_id := Mysql.InsertByTx(tx, Entniche_user, map[string]interface{}{
|
|
"name": user.Name,
|
|
"name": user.Name,
|
|
@@ -307,6 +312,29 @@ func (u *User) ResetPasswords(power_virtual_account int, virtual_account_rule, p
|
|
func (u *User) PhoneExist(phone string, entId int) *[]map[string]interface{} {
|
|
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)
|
|
return Mysql.SelectBySql("select id from entniche_user where phone=? and ent_id=?", phone, entId)
|
|
}
|
|
}
|
|
|
|
+func (u *User) UserNameExist(userName, phone string) bool {
|
|
|
|
+ user, ok := MQFW.FindOne("user", map[string]interface{}{
|
|
|
|
+ "i_appid": 2,
|
|
|
|
+ "user_name": userName,
|
|
|
|
+ })
|
|
|
|
+ if ok && user != nil && len(*user) > 0 {
|
|
|
|
+ s_phone := qutil.InterfaceToStr((*user)["s_phone"])
|
|
|
|
+ s_m_phone := qutil.InterfaceToStr((*user)["s_m_phone"])
|
|
|
|
+ if s_phone != "" {
|
|
|
|
+ if s_phone == phone {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if s_m_phone != "" {
|
|
|
|
+ if s_phone == phone {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true
|
|
|
|
+}
|
|
|
|
|
|
func (u *User) UpdateUserName(tx *sql.Tx, entId, userId int, user_name string) {
|
|
func (u *User) UpdateUserName(tx *sql.Tx, entId, userId int, user_name string) {
|
|
//entniche_user表,用户名字段 user_name
|
|
//entniche_user表,用户名字段 user_name
|