作者 tangxuhui

更新结构

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