作者 yangfu
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -11,29 +8,11 @@ type NoticeSettingAddCommand struct { @@ -11,29 +8,11 @@ type NoticeSettingAddCommand struct {
11 //操作人 8 //操作人
12 Operator domain.Operator `json:"-"` 9 Operator domain.Operator `json:"-"`
13 // 消息对应的业务模块 10 // 消息对应的业务模块
14 - Module string `json:"module" valid:"Required"` 11 + Module string `json:"module"`
15 // 业务环节 12 // 业务环节
16 - ModuleAction string `json:"moduleAction" valid:"Required"` 13 + ModuleAction string `json:"moduleAction"`
17 // 是否推送 【是:1】【否:2】 14 // 是否推送 【是:1】【否:2】
18 - IsPush int `json:"isPush" valid:"Required"` 15 + IsPush int `json:"isPush" `
19 // 内容模板 16 // 内容模板
20 - Content string `json:"content" valid:"Required"`  
21 -}  
22 -  
23 -func (noticeSettingUpdateQuery *NoticeSettingAddCommand) Valid(validation *validation.Validation) {  
24 -  
25 -}  
26 -  
27 -func (noticeSettingUpdateQuery *NoticeSettingAddCommand) ValidateCommand() error {  
28 - valid := validation.Validation{}  
29 - b, err := valid.Valid(noticeSettingUpdateQuery)  
30 - if err != nil {  
31 - return err  
32 - }  
33 - if !b {  
34 - for _, validErr := range valid.Errors {  
35 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
36 - }  
37 - }  
38 - return nil 17 + Content string `json:"content"`
39 } 18 }
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -13,29 +10,11 @@ type NoticeSettingUpdateCommand struct { @@ -13,29 +10,11 @@ type NoticeSettingUpdateCommand struct {
13 // id 10 // id
14 NoticeSettingId string `json:"noticeSettingId"` 11 NoticeSettingId string `json:"noticeSettingId"`
15 // 消息对应的业务模块 12 // 消息对应的业务模块
16 - Module string `json:"module" valid:"Required"` 13 + Module string `json:"module"`
17 // 业务环节 14 // 业务环节
18 - ModuleAction string `json:"moduleAction" valid:"Required"` 15 + ModuleAction string `json:"moduleAction"`
19 // 是否推送 【是:1】【否:2】 16 // 是否推送 【是:1】【否:2】
20 - IsPush int `json:"isPush" valid:"Required"` 17 + IsPush int `json:"isPush"`
21 // 内容模板 18 // 内容模板
22 - Content string `json:"content" valid:"Required"`  
23 -}  
24 -  
25 -func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) Valid(validation *validation.Validation) {  
26 -  
27 -}  
28 -  
29 -func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) ValidateCommand() error {  
30 - valid := validation.Validation{}  
31 - b, err := valid.Valid(noticeSettingUpdateQuery)  
32 - if err != nil {  
33 - return err  
34 - }  
35 - if !b {  
36 - for _, validErr := range valid.Errors {  
37 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
38 - }  
39 - }  
40 - return nil 19 + Content string `json:"content"`
41 } 20 }
@@ -30,7 +30,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin @@ -30,7 +30,7 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettin
30 Offset: 1, 30 Offset: 1,
31 Limit: 20, 31 Limit: 20,
32 CompanyId: int(noticeSettingListQuery.Operator.CompanyId), 32 CompanyId: int(noticeSettingListQuery.Operator.CompanyId),
33 - IsOrg: 1, 33 + IsOrg: 0,
34 MatchOrgName: noticeSettingListQuery.OrgName, 34 MatchOrgName: noticeSettingListQuery.OrgName,
35 }) 35 })
36 if err != nil { 36 if err != nil {
@@ -94,9 +94,6 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSet @@ -94,9 +94,6 @@ func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSet
94 94
95 // NoticeSettingUpdate 更新配置 95 // NoticeSettingUpdate 更新配置
96 func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) { 96 func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) {
97 - if err := noticeSettingUpdateCommand.ValidateCommand(); err != nil {  
98 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
99 - }  
100 creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic( 97 creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
101 noticeSettingUpdateCommand.Operator, 98 noticeSettingUpdateCommand.Operator,
102 ) 99 )