作者 tangxuhui

清理代码

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
@@ -61,21 +58,3 @@ type CreateCooperationContractCommand struct { @@ -61,21 +58,3 @@ type CreateCooperationContractCommand struct {
61 //关联业务员 58 //关联业务员
62 RelationUser []string `json:"relationUser"` 59 RelationUser []string `json:"relationUser"`
63 } 60 }
64 -  
65 -func (createCooperationContractCommand *CreateCooperationContractCommand) Valid(validation *validation.Validation) {  
66 -  
67 -}  
68 -  
69 -func (createCooperationContractCommand *CreateCooperationContractCommand) ValidateCommand() error {  
70 - valid := validation.Validation{}  
71 - b, err := valid.Valid(createCooperationContractCommand)  
72 - if err != nil {  
73 - return err  
74 - }  
75 - if !b {  
76 - for _, validErr := range valid.Errors {  
77 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
78 - }  
79 - }  
80 - return nil  
81 -}  
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
@@ -77,21 +74,3 @@ type UpdateCooperationContractCommand struct { @@ -77,21 +74,3 @@ type UpdateCooperationContractCommand struct {
77 //关联业务员 74 //关联业务员
78 RelationUser []string `json:"relationUser"` 75 RelationUser []string `json:"relationUser"`
79 } 76 }
80 -  
81 -func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) {  
82 -  
83 -}  
84 -  
85 -func (updateCooperationContractCommand *UpdateCooperationContractCommand) ValidateCommand() error {  
86 - valid := validation.Validation{}  
87 - b, err := valid.Valid(updateCooperationContractCommand)  
88 - if err != nil {  
89 - return err  
90 - }  
91 - if !b {  
92 - for _, validErr := range valid.Errors {  
93 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
94 - }  
95 - }  
96 - return nil  
97 -}