作者 tangxuhui

更新结构

... ... @@ -2,6 +2,7 @@ package service
import (
"fmt"
"log"
"time"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -130,9 +131,11 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
"orgId": updateNoticeSettingCommand.OrgId,
"moduleAction": updateNoticeSettingCommand.ModuleAction,
})
log.Println("+++++======>", updateNoticeSettingCommand)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(noticeSettings) > 1 {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "配置信息重复")
}
... ... @@ -140,7 +143,7 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
//存在旧的数据
noticeSetting = noticeSettings[0]
if noticeSetting.NoticeSettingId != updateNoticeSettingCommand.NoticeSettingId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "配置信息已存在")
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "该环节配置已存在")
}
}
noticeSetting, err = noticeSettingRepository.FindOne(map[string]interface{}{
... ... @@ -150,11 +153,9 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = noticeSetting.Update(map[string]interface{}{
"content": updateNoticeSettingCommand.Content,
"isPush": updateNoticeSettingCommand.IsPush,
"module": updateNoticeSettingCommand.Module,
"moduleAction": updateNoticeSettingCommand.ModuleAction,
"updatedAt": time.Now(),
"content": updateNoticeSettingCommand.Content,
"isPush": updateNoticeSettingCommand.IsPush,
"updatedAt": time.Now(),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -144,6 +144,7 @@ func (systemSettingService *SystemSettingService) UpdateSystemSetting(updateSyst
}
var systemSetting *domain.SystemSetting
if len(systemSettings) == 0 {
//未找到历史数据,使用默认配置
defaultSet := new(domain.SystemSetting).GetDefaultSetting(updateSystemSettingCommand.SettingCode)
if len(defaultSet) > 0 {
systemSetting = &defaultSet[0]
... ...