作者 tangxuhui

逻辑调整

... ... @@ -128,6 +128,7 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
} else {
noticeSettingRepository = value
}
var (
noticeSettings []*domain.NoticeSetting
noticeSetting *domain.NoticeSetting
... ... @@ -158,7 +159,19 @@ func (noticeSettingService *NoticeSettingService) UpdateNoticeSetting(updateNoti
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
moduleAction, err := domain.GetNoticeModuleAction(updateNoticeSettingCommand.Module, updateNoticeSettingCommand.ModuleAction)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
module, err := domain.GetNoticeModule(updateNoticeSettingCommand.Module)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = noticeSetting.Update(map[string]interface{}{
"module": module.ModuleCode,
"moduleName": module.ModuleName,
"moduleAction": moduleAction.ActionCode,
"moduleActionName": moduleAction.ActionName,
"content": updateNoticeSettingCommand.Content,
"isPush": updateNoticeSettingCommand.IsPush,
"updatedAt": time.Now(),
... ...
... ... @@ -63,9 +63,15 @@ func (noticeSetting *NoticeSetting) Update(data map[string]interface{}) error {
if module, ok := data["module"]; ok {
noticeSetting.Module = module.(string)
}
if moduleName, ok := data["moduleName"]; ok {
noticeSetting.ModuleName = moduleName.(string)
}
if moduleAction, ok := data["moduleAction"]; ok {
noticeSetting.ModuleAction = moduleAction.(string)
}
if moduleActionName, ok := data["moduleActionName"]; ok {
noticeSetting.ModuleActionName = moduleActionName.(string)
}
if noticeSettingId, ok := data["noticeSettingId"]; ok {
noticeSetting.NoticeSettingId = noticeSettingId.(int64)
}
... ...