作者 tangxuhui

逻辑调整

@@ -128,6 +128,7 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti @@ -128,6 +128,7 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
128 } else { 128 } else {
129 noticeSettingRepository = value 129 noticeSettingRepository = value
130 } 130 }
  131 +
131 var ( 132 var (
132 noticeSettings []*domain.NoticeSetting 133 noticeSettings []*domain.NoticeSetting
133 noticeSetting *domain.NoticeSetting 134 noticeSetting *domain.NoticeSetting
@@ -158,10 +159,22 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti @@ -158,10 +159,22 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
158 if err != nil { 159 if err != nil {
159 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 160 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
160 } 161 }
  162 + moduleAction, err := domain.GetNoticeModuleAction(updateNoticeSettingCommand.Module, updateNoticeSettingCommand.ModuleAction)
  163 + if err != nil {
  164 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  165 + }
  166 + module, err := domain.GetNoticeModule(updateNoticeSettingCommand.Module)
  167 + if err != nil {
  168 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  169 + }
161 err = noticeSetting.Update(map[string]interface{}{ 170 err = noticeSetting.Update(map[string]interface{}{
162 - "content": updateNoticeSettingCommand.Content,  
163 - "isPush": updateNoticeSettingCommand.IsPush,  
164 - "updatedAt": time.Now(), 171 + "module": module.ModuleCode,
  172 + "moduleName": module.ModuleName,
  173 + "moduleAction": moduleAction.ActionCode,
  174 + "moduleActionName": moduleAction.ActionName,
  175 + "content": updateNoticeSettingCommand.Content,
  176 + "isPush": updateNoticeSettingCommand.IsPush,
  177 + "updatedAt": time.Now(),
165 }) 178 })
166 if err != nil { 179 if err != nil {
167 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 180 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -63,9 +63,15 @@ func (noticeSetting *NoticeSetting) Update(data map[string]interface{}) error { @@ -63,9 +63,15 @@ func (noticeSetting *NoticeSetting) Update(data map[string]interface{}) error {
63 if module, ok := data["module"]; ok { 63 if module, ok := data["module"]; ok {
64 noticeSetting.Module = module.(string) 64 noticeSetting.Module = module.(string)
65 } 65 }
  66 + if moduleName, ok := data["moduleName"]; ok {
  67 + noticeSetting.ModuleName = moduleName.(string)
  68 + }
66 if moduleAction, ok := data["moduleAction"]; ok { 69 if moduleAction, ok := data["moduleAction"]; ok {
67 noticeSetting.ModuleAction = moduleAction.(string) 70 noticeSetting.ModuleAction = moduleAction.(string)
68 } 71 }
  72 + if moduleActionName, ok := data["moduleActionName"]; ok {
  73 + noticeSetting.ModuleActionName = moduleActionName.(string)
  74 + }
69 if noticeSettingId, ok := data["noticeSettingId"]; ok { 75 if noticeSettingId, ok := data["noticeSettingId"]; ok {
70 noticeSetting.NoticeSettingId = noticeSettingId.(int64) 76 noticeSetting.NoticeSettingId = noticeSettingId.(int64)
71 } 77 }