...
|
...
|
@@ -52,6 +52,8 @@ func (systemSettingService *SystemSettingService) GetSystemSetting(getSystemSett |
|
|
}
|
|
|
defaultSet[0].CompanyId = getSystemSettingQuery.CompanyId
|
|
|
systemSetting = defaultSet[0]
|
|
|
} else {
|
|
|
systemSetting = *systemSettings[0]
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -147,21 +149,20 @@ func (systemSettingService *SystemSettingService) UpdateSystemSetting(updateSyst |
|
|
//未找到历史数据,使用默认配置
|
|
|
defaultSet := new(domain.SystemSetting).GetDefaultSetting(updateSystemSettingCommand.SettingCode)
|
|
|
if len(defaultSet) > 0 {
|
|
|
systemSetting = &defaultSet[0]
|
|
|
*systemSetting = defaultSet[0]
|
|
|
systemSetting.CompanyId = updateSystemSettingCommand.CompanyId
|
|
|
}
|
|
|
} else {
|
|
|
systemSetting = systemSettings[0]
|
|
|
if err := systemSetting.Update(map[string]interface{}{
|
|
|
"value": updateSystemSettingCommand.Value,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
if systemSetting == nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "settingCode错误,settingCode="+updateSystemSettingCommand.SettingCode)
|
|
|
}
|
|
|
|
|
|
if err := systemSetting.Update(map[string]interface{}{
|
|
|
"value": updateSystemSettingCommand.Value,
|
|
|
}); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if systemSetting, err := systemSettingRepository.Save(systemSetting); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
} else {
|
...
|
...
|
|