作者 陈志颖

fix:修改无效员工错误描述

... ... @@ -18,22 +18,26 @@ type OperationSuMoneyService struct {
func (service *OperationSuMoneyService) Operation(uid int64, operatorUid int64, suMoney float64, operationType int, recordDescription string) (*domain.SuMoneyTransactionRecord, error) {
var employeeRepository domain.EmployeeRepository
var suMoneyTransactionRecordRepository domain.SuMoneyTransactionRecordRepository
var employeeDao *dao.EmployeeDao
if repository, err := repository.NewEmployeeRepository(service.transactionContext); err != nil {
return nil, err
} else {
employeeRepository = repository
}
if repository, err := repository.NewSuMoneyTransactionRecordRepository(service.transactionContext); err != nil {
return nil, err
} else {
suMoneyTransactionRecordRepository = repository
}
if dao, err := dao.NewEmployeeDao(service.transactionContext); err != nil {
return nil, err
} else {
employeeDao = dao
}
employee, err := employeeRepository.FindOne(map[string]interface{}{
"uid": uid,
})
... ...
... ... @@ -74,7 +74,7 @@ func (repository *EmployeeRepository) FindOne(queryOptions map[string]interface{
}
if err := query.First(); err != nil {
if err.Error() == "pg: no rows in result set" {
return nil, fmt.Errorf("没有此员工")
return nil, fmt.Errorf("无效的员工")
} else {
return nil, err
}
... ...