作者 Administrator

合并分支 'dev' 到 'master'

Dev



查看合并请求 !2
... ... @@ -188,7 +188,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if _, err := employeeRepository.Save(employee); err != nil {
return false, nil
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
}
... ... @@ -213,7 +213,7 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
case "edit":
employee, err := employeeRepository.FindOne(map[string]interface{}{"uid": uid})
if err != nil {
return false, nil
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if employee == nil {
return false, nil
... ... @@ -228,19 +228,19 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if _, err := employeeRepository.Save(employee); err != nil {
return false, nil
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
break
case "batchDelete":
err := employeeDao.BatchRemove(uids)
if err != nil {
return false, nil
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
break
case "batchForbid":
err := employeeDao.BatchSetStatus(uids, status)
if err != nil {
return false, nil
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
break
default:
... ... @@ -255,12 +255,15 @@ func (unifiedUserCenterService *UnifiedUserCenterService) SyncEmployeeCallback(s
case "changeAdmin":
err := employeeDao.ChangePrincipal(companyId, employeeAccount)
if err != nil {
return false, nil
return false, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
break
default:
return false, nil
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return true, nil
} else {
return false, nil
... ...
... ... @@ -32,7 +32,7 @@ func (dao *EmployeeDao) BatchSetStatus(uids []int64, status int) error {
func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string) error {
tx := dao.transactionContext.PgTx
if _, err := tx.QueryOne(
if _, err := tx.Query(
pg.Scan(),
"UPDATE employees SET is_principal=? WHERE company_id=?",
false, companyId); err != nil {
... ...