作者 tangxuhui

更新:删除用户逻辑修正

... ... @@ -136,13 +136,13 @@ func GetUserNameByIds(ids []int64) ([]User, error) {
func ExistUserByPhone(phone string) bool {
o := orm.NewOrm()
ok := o.QueryTable(&User{}).Filter("phone", phone).Exist()
ok := o.QueryTable(&User{}).Filter("phone", phone).Filter("delete_at", 0).Exist()
return ok
}
func GetUserByUCenter(ucenterId int64) (v *User, err error) {
v = &User{}
o := orm.NewOrm()
err = o.QueryTable(&User{}).Filter("user_center_id", ucenterId).One(v)
err = o.QueryTable(&User{}).Filter("user_center_id", ucenterId).Filter("delete_at", 0).One(v)
return
}
... ...
... ... @@ -616,6 +616,7 @@ func DeleteEmployeeData(data DeleteUserData) error {
Filter("id__in", deleteUserIds).
Update(orm.Params{
"delete_at": time.Now().Format("2006-01-02 15:04:05"),
"enable_status": models.USER_ENABLE_NO,
})
if err != nil {
o.Rollback()
... ...