|
@@ -52,6 +52,8 @@ func (systemSettingService *SystemSettingService) GetSystemSetting(getSystemSett |
|
@@ -52,6 +52,8 @@ func (systemSettingService *SystemSettingService) GetSystemSetting(getSystemSett |
52
|
}
|
52
|
}
|
53
|
defaultSet[0].CompanyId = getSystemSettingQuery.CompanyId
|
53
|
defaultSet[0].CompanyId = getSystemSettingQuery.CompanyId
|
54
|
systemSetting = defaultSet[0]
|
54
|
systemSetting = defaultSet[0]
|
|
|
55
|
+ } else {
|
|
|
56
|
+ systemSetting = *systemSettings[0]
|
55
|
}
|
57
|
}
|
56
|
if err := transactionContext.CommitTransaction(); err != nil {
|
58
|
if err := transactionContext.CommitTransaction(); err != nil {
|
57
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
59
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -147,21 +149,20 @@ func (systemSettingService *SystemSettingService) UpdateSystemSetting(updateSyst |
|
@@ -147,21 +149,20 @@ func (systemSettingService *SystemSettingService) UpdateSystemSetting(updateSyst |
147
|
//未找到历史数据,使用默认配置
|
149
|
//未找到历史数据,使用默认配置
|
148
|
defaultSet := new(domain.SystemSetting).GetDefaultSetting(updateSystemSettingCommand.SettingCode)
|
150
|
defaultSet := new(domain.SystemSetting).GetDefaultSetting(updateSystemSettingCommand.SettingCode)
|
149
|
if len(defaultSet) > 0 {
|
151
|
if len(defaultSet) > 0 {
|
150
|
- systemSetting = &defaultSet[0]
|
152
|
+ *systemSetting = defaultSet[0]
|
151
|
systemSetting.CompanyId = updateSystemSettingCommand.CompanyId
|
153
|
systemSetting.CompanyId = updateSystemSettingCommand.CompanyId
|
152
|
}
|
154
|
}
|
153
|
} else {
|
155
|
} else {
|
154
|
systemSetting = systemSettings[0]
|
156
|
systemSetting = systemSettings[0]
|
|
|
157
|
+ }
|
|
|
158
|
+ if systemSetting == nil {
|
|
|
159
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, "settingCode错误,settingCode="+updateSystemSettingCommand.SettingCode)
|
|
|
160
|
+ }
|
155
|
if err := systemSetting.Update(map[string]interface{}{
|
161
|
if err := systemSetting.Update(map[string]interface{}{
|
156
|
"value": updateSystemSettingCommand.Value,
|
162
|
"value": updateSystemSettingCommand.Value,
|
157
|
}); err != nil {
|
163
|
}); err != nil {
|
158
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
164
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
159
|
}
|
165
|
}
|
160
|
- }
|
|
|
161
|
- if systemSetting == nil {
|
|
|
162
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, "settingCode错误,settingCode="+updateSystemSettingCommand.SettingCode)
|
|
|
163
|
- }
|
|
|
164
|
-
|
|
|
165
|
if systemSetting, err := systemSettingRepository.Save(systemSetting); err != nil {
|
166
|
if systemSetting, err := systemSettingRepository.Save(systemSetting); err != nil {
|
166
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
167
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
167
|
} else {
|
168
|
} else {
|