作者 tangxvhui

微调

... ... @@ -101,8 +101,10 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi
}
permissionBases = append(permissionBases, p)
}
var accountChance bool
//账号是否有变更
var accountChange bool
if saveUserCmd.Id > 0 {
//更新数据
adminuser, err = adminuserRepository.FindOne(domain.AdminUserFindOneQuery{
AdminUserId: saveUserCmd.Id,
})
... ... @@ -110,7 +112,7 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi
return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
}
if adminuser.Account != saveUserCmd.Account {
accountChance = true
accountChange = true
}
adminuser.Account = saveUserCmd.Account
adminuser.AdminName = saveUserCmd.Name
... ... @@ -120,7 +122,8 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi
}
} else {
accountChance = true
//添加新数据
accountChange = true
defaultPwd := fmt.Sprintf("%x", sha1.Sum([]byte("123456")))
adminuser = &domain.AdminUser{
Id: saveUserCmd.Id,
... ... @@ -131,7 +134,7 @@ func (adminUserSrv AdminUserService) SaveAdminUser(saveUserCmd *command.SaveAdmi
Permission: permissionBases,
}
}
if accountChance {
if accountChange {
//检查账号是否已存在
var (
adminuserDao *dao.AdminUserDao
... ...