正在显示
137 个修改的文件
包含
377 行增加
和
920 行删除
1 | -package access | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/common" | 4 | "github.com/tiptok/gocomm/common" |
5 | "github.com/tiptok/gocomm/pkg/log" | 5 | "github.com/tiptok/gocomm/pkg/log" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/command" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/query" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
9 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/access" | ||
10 | ) | 11 | ) |
11 | 12 | ||
12 | type AccessService struct { | 13 | type AccessService struct { |
13 | } | 14 | } |
14 | 15 | ||
15 | -func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request *protocolx.CreateAccessRequest) (rsp interface{}, err error) { | 16 | +func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request *command.CreateAccessRequest) (rsp interface{}, err error) { |
16 | var ( | 17 | var ( |
17 | transactionContext, _ = factory.CreateTransactionContext(nil) | 18 | transactionContext, _ = factory.CreateTransactionContext(nil) |
18 | ) | 19 | ) |
19 | - rsp = &protocolx.CreateAccessResponse{} | 20 | + rsp = &command.CreateAccessResponse{} |
20 | if err = request.ValidateCommand(); err != nil { | 21 | if err = request.ValidateCommand(); err != nil { |
21 | err = protocol.NewCustomMessage(2, err.Error()) | 22 | err = protocol.NewCustomMessage(2, err.Error()) |
22 | } | 23 | } |
@@ -47,11 +48,11 @@ func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request * | @@ -47,11 +48,11 @@ func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request * | ||
47 | return | 48 | return |
48 | } | 49 | } |
49 | 50 | ||
50 | -func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request *protocolx.UpdateAccessRequest) (rsp interface{}, err error) { | 51 | +func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request *command.UpdateAccessRequest) (rsp interface{}, err error) { |
51 | var ( | 52 | var ( |
52 | transactionContext, _ = factory.CreateTransactionContext(nil) | 53 | transactionContext, _ = factory.CreateTransactionContext(nil) |
53 | ) | 54 | ) |
54 | - rsp = &protocolx.UpdateAccessResponse{} | 55 | + rsp = &command.UpdateAccessResponse{} |
55 | if err = request.ValidateCommand(); err != nil { | 56 | if err = request.ValidateCommand(); err != nil { |
56 | err = protocol.NewCustomMessage(2, err.Error()) | 57 | err = protocol.NewCustomMessage(2, err.Error()) |
57 | } | 58 | } |
@@ -78,11 +79,11 @@ func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request * | @@ -78,11 +79,11 @@ func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request * | ||
78 | return | 79 | return |
79 | } | 80 | } |
80 | 81 | ||
81 | -func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *protocolx.GetAccessRequest) (rsp interface{}, err error) { | 82 | +func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *query.GetAccessRequest) (rsp interface{}, err error) { |
82 | var ( | 83 | var ( |
83 | transactionContext, _ = factory.CreateTransactionContext(nil) | 84 | transactionContext, _ = factory.CreateTransactionContext(nil) |
84 | ) | 85 | ) |
85 | - rsp = &protocolx.GetAccessResponse{} | 86 | + rsp = &query.GetAccessResponse{} |
86 | if err = request.ValidateCommand(); err != nil { | 87 | if err = request.ValidateCommand(); err != nil { |
87 | err = protocol.NewCustomMessage(2, err.Error()) | 88 | err = protocol.NewCustomMessage(2, err.Error()) |
88 | } | 89 | } |
@@ -104,11 +105,11 @@ func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *pro | @@ -104,11 +105,11 @@ func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *pro | ||
104 | return | 105 | return |
105 | } | 106 | } |
106 | 107 | ||
107 | -func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request *protocolx.DeleteAccessRequest) (rsp interface{}, err error) { | 108 | +func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request *command.DeleteAccessRequest) (rsp interface{}, err error) { |
108 | var ( | 109 | var ( |
109 | transactionContext, _ = factory.CreateTransactionContext(nil) | 110 | transactionContext, _ = factory.CreateTransactionContext(nil) |
110 | ) | 111 | ) |
111 | - rsp = &protocolx.DeleteAccessResponse{} | 112 | + rsp = &command.DeleteAccessResponse{} |
112 | if err = request.ValidateCommand(); err != nil { | 113 | if err = request.ValidateCommand(); err != nil { |
113 | err = protocol.NewCustomMessage(2, err.Error()) | 114 | err = protocol.NewCustomMessage(2, err.Error()) |
114 | } | 115 | } |
@@ -133,11 +134,11 @@ func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request * | @@ -133,11 +134,11 @@ func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request * | ||
133 | return | 134 | return |
134 | } | 135 | } |
135 | 136 | ||
136 | -func (svr *AccessService) ListAccess(header *protocol.RequestHeader, request *protocolx.ListAccessRequest) (rsp interface{}, err error) { | 137 | +func (svr *AccessService) ListAccess(header *protocol.RequestHeader, request *query.ListAccessRequest) (rsp interface{}, err error) { |
137 | var ( | 138 | var ( |
138 | transactionContext, _ = factory.CreateTransactionContext(nil) | 139 | transactionContext, _ = factory.CreateTransactionContext(nil) |
139 | ) | 140 | ) |
140 | - rsp = &protocolx.ListAccessResponse{} | 141 | + rsp = &query.ListAccessResponse{} |
141 | if err = request.ValidateCommand(); err != nil { | 142 | if err = request.ValidateCommand(); err != nil { |
142 | err = protocol.NewCustomMessage(2, err.Error()) | 143 | err = protocol.NewCustomMessage(2, err.Error()) |
143 | } | 144 | } |
1 | -package auth | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
@@ -7,25 +7,26 @@ import ( | @@ -7,25 +7,26 @@ import ( | ||
7 | "github.com/tiptok/gocomm/common" | 7 | "github.com/tiptok/gocomm/common" |
8 | "github.com/tiptok/gocomm/pkg/cache" | 8 | "github.com/tiptok/gocomm/pkg/cache" |
9 | "github.com/tiptok/gocomm/pkg/log" | 9 | "github.com/tiptok/gocomm/pkg/log" |
10 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/command" | ||
11 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/query" | ||
10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/cachex" | 12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/cachex" |
11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 13 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 14 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
13 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" | 15 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" |
14 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 16 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
15 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 17 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
16 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/auth" | ||
17 | "time" | 18 | "time" |
18 | ) | 19 | ) |
19 | 20 | ||
20 | type AuthService struct { | 21 | type AuthService struct { |
21 | } | 22 | } |
22 | 23 | ||
23 | -func (svr *AuthService) Login(header *protocol.RequestHeader, request *protocolx.LoginRequest) (rsp *protocolx.LoginResponse, err error) { | 24 | +func (svr *AuthService) Login(header *protocol.RequestHeader, request *command.LoginRequest) (rsp *command.LoginResponse, err error) { |
24 | var ( | 25 | var ( |
25 | transactionContext, _ = factory.CreateTransactionContext(nil) | 26 | transactionContext, _ = factory.CreateTransactionContext(nil) |
26 | UserRepository, _ = factory.CreateUserRepository(transactionContext) | 27 | UserRepository, _ = factory.CreateUserRepository(transactionContext) |
27 | ) | 28 | ) |
28 | - rsp = &protocolx.LoginResponse{} | 29 | + rsp = &command.LoginResponse{} |
29 | if err = request.ValidateCommand(); err != nil { | 30 | if err = request.ValidateCommand(); err != nil { |
30 | err = protocol.NewCustomMessage(2, err.Error()) | 31 | err = protocol.NewCustomMessage(2, err.Error()) |
31 | } | 32 | } |
@@ -63,11 +64,11 @@ func (svr *AuthService) Login(header *protocol.RequestHeader, request *protocolx | @@ -63,11 +64,11 @@ func (svr *AuthService) Login(header *protocol.RequestHeader, request *protocolx | ||
63 | return | 64 | return |
64 | } | 65 | } |
65 | 66 | ||
66 | -func (svr *AuthService) Logout(header *protocol.RequestHeader, request *protocolx.LogoutRequest) (rsp *protocolx.LogoutResponse, err error) { | 67 | +func (svr *AuthService) Logout(header *protocol.RequestHeader, request *command.LogoutRequest) (rsp *command.LogoutResponse, err error) { |
67 | var ( | 68 | var ( |
68 | transactionContext, _ = factory.CreateTransactionContext(nil) | 69 | transactionContext, _ = factory.CreateTransactionContext(nil) |
69 | ) | 70 | ) |
70 | - rsp = &protocolx.LogoutResponse{} | 71 | + rsp = &command.LogoutResponse{} |
71 | if err = request.ValidateCommand(); err != nil { | 72 | if err = request.ValidateCommand(); err != nil { |
72 | err = protocol.NewCustomMessage(2, err.Error()) | 73 | err = protocol.NewCustomMessage(2, err.Error()) |
73 | } | 74 | } |
@@ -83,12 +84,12 @@ func (svr *AuthService) Logout(header *protocol.RequestHeader, request *protocol | @@ -83,12 +84,12 @@ func (svr *AuthService) Logout(header *protocol.RequestHeader, request *protocol | ||
83 | return | 84 | return |
84 | } | 85 | } |
85 | 86 | ||
86 | -func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *protocolx.RefreshRequest) (rsp interface{}, err error) { | 87 | +func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *command.RefreshRequest) (rsp interface{}, err error) { |
87 | var ( | 88 | var ( |
88 | //transactionContext, _ = factory.CreateTransactionContext(nil) | 89 | //transactionContext, _ = factory.CreateTransactionContext(nil) |
89 | ) | 90 | ) |
90 | //transactionContext.SetTransactionClose() | 91 | //transactionContext.SetTransactionClose() |
91 | - rsp = &protocolx.RefreshResponse{} | 92 | + rsp = &command.RefreshResponse{} |
92 | if err = request.ValidateCommand(); err != nil { | 93 | if err = request.ValidateCommand(); err != nil { |
93 | err = protocol.NewCustomMessage(2, err.Error()) | 94 | err = protocol.NewCustomMessage(2, err.Error()) |
94 | return | 95 | return |
@@ -108,13 +109,13 @@ func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *protoco | @@ -108,13 +109,13 @@ func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *protoco | ||
108 | return | 109 | return |
109 | } | 110 | } |
110 | log.Debug(claim.Username, claim.Password, time.Unix(claim.ExpiresAt, 0)) | 111 | log.Debug(claim.Username, claim.Password, time.Unix(claim.ExpiresAt, 0)) |
111 | - rsp, err = svr.Login(header, &protocolx.LoginRequest{UserName: (claim.AddData["Phone"]).(string), Password: claim.Password}) | 112 | + rsp, err = svr.Login(header, &command.LoginRequest{UserName: (claim.AddData["Phone"]).(string), Password: claim.Password}) |
112 | 113 | ||
113 | //err = transactionContext.CommitTransaction() | 114 | //err = transactionContext.CommitTransaction() |
114 | return | 115 | return |
115 | } | 116 | } |
116 | 117 | ||
117 | -func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protocolx.ProfileRequest) (rsp interface{}, err error) { | 118 | +func (svr *AuthService) Profile(header *protocol.RequestHeader, request *command.ProfileRequest) (rsp interface{}, err error) { |
118 | var ( | 119 | var ( |
119 | transactionContext, _ = factory.CreateTransactionContext(nil) | 120 | transactionContext, _ = factory.CreateTransactionContext(nil) |
120 | UserRepository, _ = factory.CreateUserRepository(transactionContext) | 121 | UserRepository, _ = factory.CreateUserRepository(transactionContext) |
@@ -122,7 +123,7 @@ func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protoco | @@ -122,7 +123,7 @@ func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protoco | ||
122 | RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext) | 123 | RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext) |
123 | AccessRepository, _ = factory.CreateAccessRepository(transactionContext) | 124 | AccessRepository, _ = factory.CreateAccessRepository(transactionContext) |
124 | ) | 125 | ) |
125 | - rsp = &protocolx.ProfileResponse{} | 126 | + rsp = &command.ProfileResponse{} |
126 | if err = request.ValidateCommand(); err != nil { | 127 | if err = request.ValidateCommand(); err != nil { |
127 | err = protocol.NewCustomMessage(2, err.Error()) | 128 | err = protocol.NewCustomMessage(2, err.Error()) |
128 | return | 129 | return |
@@ -167,11 +168,11 @@ func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protoco | @@ -167,11 +168,11 @@ func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protoco | ||
167 | return | 168 | return |
168 | } | 169 | } |
169 | 170 | ||
170 | -func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *protocolx.CaptchaInitRequest) (rsp interface{}, err error) { | 171 | +func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *query.CaptchaInitRequest) (rsp interface{}, err error) { |
171 | var ( | 172 | var ( |
172 | transactionContext, _ = factory.CreateTransactionContext(nil) | 173 | transactionContext, _ = factory.CreateTransactionContext(nil) |
173 | ) | 174 | ) |
174 | - rsp = &protocolx.CaptchaInitResponse{} | 175 | + rsp = &query.CaptchaInitResponse{} |
175 | if err = request.ValidateCommand(); err != nil { | 176 | if err = request.ValidateCommand(); err != nil { |
176 | err = protocol.NewCustomMessage(2, err.Error()) | 177 | err = protocol.NewCustomMessage(2, err.Error()) |
177 | return | 178 | return |
@@ -203,12 +204,12 @@ func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *pro | @@ -203,12 +204,12 @@ func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *pro | ||
203 | return | 204 | return |
204 | } | 205 | } |
205 | 206 | ||
206 | -func (svr *AuthService) ChangePassword(header *protocol.RequestHeader, request *protocolx.ChangePasswordRequest) (rsp *protocolx.ChangePasswordResponse, err error) { | 207 | +func (svr *AuthService) ChangePassword(header *protocol.RequestHeader, request *command.ChangePasswordRequest) (rsp *command.ChangePasswordResponse, err error) { |
207 | var ( | 208 | var ( |
208 | transactionContext, _ = factory.CreateTransactionContext(nil) | 209 | transactionContext, _ = factory.CreateTransactionContext(nil) |
209 | UserRepository, _ = factory.CreateUserRepository(transactionContext) | 210 | UserRepository, _ = factory.CreateUserRepository(transactionContext) |
210 | ) | 211 | ) |
211 | - rsp = &protocolx.ChangePasswordResponse{} | 212 | + rsp = &command.ChangePasswordResponse{} |
212 | if err = request.ValidateCommand(); err != nil { | 213 | if err = request.ValidateCommand(); err != nil { |
213 | err = protocol.NewCustomMessage(2, err.Error()) | 214 | err = protocol.NewCustomMessage(2, err.Error()) |
214 | } | 215 | } |
1 | -package client_version | 1 | +package query |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
@@ -9,11 +9,13 @@ type ListClientVersionRequest struct { | @@ -9,11 +9,13 @@ type ListClientVersionRequest struct { | ||
9 | Offset int `json:"offset"` | 9 | Offset int `json:"offset"` |
10 | Limit int `json:"limit"` | 10 | Limit int `json:"limit"` |
11 | SearchByText string `json:"projectName,omitempty"` //按名称搜索 | 11 | SearchByText string `json:"projectName,omitempty"` //按名称搜索 |
12 | + SortByCreateTime string `json:"sortByCreateTime` | ||
12 | } | 13 | } |
13 | 14 | ||
14 | func (ListClientVersionRequest *ListClientVersionRequest) ValidateCommand() error { | 15 | func (ListClientVersionRequest *ListClientVersionRequest) ValidateCommand() error { |
15 | valid := validation.Validation{} | 16 | valid := validation.Validation{} |
16 | b, err := valid.Valid(ListClientVersionRequest) | 17 | b, err := valid.Valid(ListClientVersionRequest) |
18 | + ListClientVersionRequest.SortByCreateTime = "desc" | ||
17 | if err != nil { | 19 | if err != nil { |
18 | return err | 20 | return err |
19 | } | 21 | } |
1 | -package client_version | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/common" | 4 | "github.com/tiptok/gocomm/common" |
5 | "github.com/tiptok/gocomm/pkg/log" | 5 | "github.com/tiptok/gocomm/pkg/log" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/command" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/query" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
10 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/client_version" | ||
11 | "time" | 12 | "time" |
12 | ) | 13 | ) |
13 | 14 | ||
14 | type ClientVersionService struct { | 15 | type ClientVersionService struct { |
15 | } | 16 | } |
16 | 17 | ||
17 | -func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHeader, request *protocolx.CreateClientVersionRequest) (rsp interface{}, err error) { | 18 | +func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHeader, request *command.CreateClientVersionRequest) (rsp interface{}, err error) { |
18 | var ( | 19 | var ( |
19 | transactionContext, _ = factory.CreateTransactionContext(nil) | 20 | transactionContext, _ = factory.CreateTransactionContext(nil) |
20 | ) | 21 | ) |
21 | - rsp = &protocolx.CreateClientVersionResponse{} | 22 | + rsp = &command.CreateClientVersionResponse{} |
22 | if err = request.ValidateCommand(); err != nil { | 23 | if err = request.ValidateCommand(); err != nil { |
23 | err = protocol.NewCustomMessage(2, err.Error()) | 24 | err = protocol.NewCustomMessage(2, err.Error()) |
24 | return | 25 | return |
@@ -50,11 +51,11 @@ func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHea | @@ -50,11 +51,11 @@ func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHea | ||
50 | return | 51 | return |
51 | } | 52 | } |
52 | 53 | ||
53 | -func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHeader, request *protocolx.UpdateClientVersionRequest) (rsp interface{}, err error) { | 54 | +func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHeader, request *command.UpdateClientVersionRequest) (rsp interface{}, err error) { |
54 | var ( | 55 | var ( |
55 | transactionContext, _ = factory.CreateTransactionContext(nil) | 56 | transactionContext, _ = factory.CreateTransactionContext(nil) |
56 | ) | 57 | ) |
57 | - rsp = &protocolx.UpdateClientVersionResponse{} | 58 | + rsp = &command.UpdateClientVersionResponse{} |
58 | if err = request.ValidateCommand(); err != nil { | 59 | if err = request.ValidateCommand(); err != nil { |
59 | err = protocol.NewCustomMessage(2, err.Error()) | 60 | err = protocol.NewCustomMessage(2, err.Error()) |
60 | return | 61 | return |
@@ -82,11 +83,11 @@ func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHea | @@ -82,11 +83,11 @@ func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHea | ||
82 | return | 83 | return |
83 | } | 84 | } |
84 | 85 | ||
85 | -func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader, request *protocolx.GetClientVersionRequest) (rsp interface{}, err error) { | 86 | +func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader, request *query.GetClientVersionRequest) (rsp interface{}, err error) { |
86 | var ( | 87 | var ( |
87 | transactionContext, _ = factory.CreateTransactionContext(nil) | 88 | transactionContext, _ = factory.CreateTransactionContext(nil) |
88 | ) | 89 | ) |
89 | - rsp = &protocolx.GetClientVersionResponse{} | 90 | + rsp = &query.GetClientVersionResponse{} |
90 | if err = request.ValidateCommand(); err != nil { | 91 | if err = request.ValidateCommand(); err != nil { |
91 | err = protocol.NewCustomMessage(2, err.Error()) | 92 | err = protocol.NewCustomMessage(2, err.Error()) |
92 | return | 93 | return |
@@ -109,11 +110,11 @@ func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader | @@ -109,11 +110,11 @@ func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader | ||
109 | return | 110 | return |
110 | } | 111 | } |
111 | 112 | ||
112 | -func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHeader, request *protocolx.DeleteClientVersionRequest) (rsp interface{}, err error) { | 113 | +func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHeader, request *command.DeleteClientVersionRequest) (rsp interface{}, err error) { |
113 | var ( | 114 | var ( |
114 | transactionContext, _ = factory.CreateTransactionContext(nil) | 115 | transactionContext, _ = factory.CreateTransactionContext(nil) |
115 | ) | 116 | ) |
116 | - rsp = &protocolx.DeleteClientVersionResponse{} | 117 | + rsp = &command.DeleteClientVersionResponse{} |
117 | if err = request.ValidateCommand(); err != nil { | 118 | if err = request.ValidateCommand(); err != nil { |
118 | err = protocol.NewCustomMessage(2, err.Error()) | 119 | err = protocol.NewCustomMessage(2, err.Error()) |
119 | return | 120 | return |
@@ -139,11 +140,11 @@ func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHea | @@ -139,11 +140,11 @@ func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHea | ||
139 | return | 140 | return |
140 | } | 141 | } |
141 | 142 | ||
142 | -func (svr *ClientVersionService) ListClientVersion(header *protocol.RequestHeader, request *protocolx.ListClientVersionRequest) (rsp interface{}, err error) { | 143 | +func (svr *ClientVersionService) ListClientVersion(header *protocol.RequestHeader, request *query.ListClientVersionRequest) (rsp interface{}, err error) { |
143 | var ( | 144 | var ( |
144 | transactionContext, _ = factory.CreateTransactionContext(nil) | 145 | transactionContext, _ = factory.CreateTransactionContext(nil) |
145 | ) | 146 | ) |
146 | - rsp = &protocolx.ListClientVersionResponse{} | 147 | + rsp = &query.ListClientVersionResponse{} |
147 | if err = request.ValidateCommand(); err != nil { | 148 | if err = request.ValidateCommand(); err != nil { |
148 | err = protocol.NewCustomMessage(2, err.Error()) | 149 | err = protocol.NewCustomMessage(2, err.Error()) |
149 | return | 150 | return |
pkg/application/menu/menu.go
已删除
100644 → 0
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "github.com/tiptok/gocomm/common" | ||
5 | - "github.com/tiptok/gocomm/pkg/log" | ||
6 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | ||
7 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | ||
8 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | ||
9 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/menu" | ||
10 | - "time" | ||
11 | -) | ||
12 | - | ||
13 | -type MenuService struct { | ||
14 | -} | ||
15 | - | ||
16 | -func (svr *MenuService) CreateMenu(header *protocol.RequestHeader, request *protocolx.CreateMenuRequest) (rsp interface{}, err error) { | ||
17 | - var ( | ||
18 | - transactionContext, _ = factory.CreateTransactionContext(nil) | ||
19 | - ) | ||
20 | - rsp = &protocolx.CreateMenuResponse{} | ||
21 | - if err = request.ValidateCommand(); err != nil { | ||
22 | - err = protocol.NewCustomMessage(2, err.Error()) | ||
23 | - } | ||
24 | - if err = transactionContext.StartTransaction(); err != nil { | ||
25 | - log.Error(err) | ||
26 | - return nil, err | ||
27 | - } | ||
28 | - defer func() { | ||
29 | - transactionContext.RollbackTransaction() | ||
30 | - }() | ||
31 | - newMenu := &domain.Menu{ | ||
32 | - MenuName: request.MenuName, | ||
33 | - MenuCode: request.MenuCode, | ||
34 | - Icon: request.Icon, | ||
35 | - Sort: request.Sort, | ||
36 | - Hidden: request.Hidden, | ||
37 | - CreatedTime: time.Now(), | ||
38 | - UpdateTime: time.Now(), | ||
39 | - } | ||
40 | - | ||
41 | - var MenuRepository, _ = factory.CreateMenuRepository(transactionContext) | ||
42 | - if m, err := MenuRepository.Save(newMenu); err != nil { | ||
43 | - return nil, err | ||
44 | - } else { | ||
45 | - rsp = m | ||
46 | - } | ||
47 | - err = transactionContext.CommitTransaction() | ||
48 | - return | ||
49 | -} | ||
50 | - | ||
51 | -func (svr *MenuService) UpdateMenu(header *protocol.RequestHeader, request *protocolx.UpdateMenuRequest) (rsp interface{}, err error) { | ||
52 | - var ( | ||
53 | - transactionContext, _ = factory.CreateTransactionContext(nil) | ||
54 | - ) | ||
55 | - rsp = &protocolx.UpdateMenuResponse{} | ||
56 | - if err = request.ValidateCommand(); err != nil { | ||
57 | - err = protocol.NewCustomMessage(2, err.Error()) | ||
58 | - } | ||
59 | - if err = transactionContext.StartTransaction(); err != nil { | ||
60 | - log.Error(err) | ||
61 | - return nil, err | ||
62 | - } | ||
63 | - defer func() { | ||
64 | - transactionContext.RollbackTransaction() | ||
65 | - }() | ||
66 | - | ||
67 | - var MenuRepository, _ = factory.CreateMenuRepository(transactionContext) | ||
68 | - var menu *domain.Menu | ||
69 | - if menu, err = MenuRepository.FindOne(common.ObjectToMap(request)); err != nil { | ||
70 | - return | ||
71 | - } | ||
72 | - if err = menu.Update(common.ObjectToMap(request)); err != nil { | ||
73 | - return | ||
74 | - } | ||
75 | - if menu, err = MenuRepository.Save(menu); err != nil { | ||
76 | - return | ||
77 | - } | ||
78 | - err = transactionContext.CommitTransaction() | ||
79 | - return | ||
80 | -} | ||
81 | - | ||
82 | -func (svr *MenuService) GetMenu(header *protocol.RequestHeader, request *protocolx.GetMenuRequest) (rsp interface{}, err error) { | ||
83 | - var ( | ||
84 | - transactionContext, _ = factory.CreateTransactionContext(nil) | ||
85 | - ) | ||
86 | - rsp = &protocolx.GetMenuResponse{} | ||
87 | - if err = request.ValidateCommand(); err != nil { | ||
88 | - err = protocol.NewCustomMessage(2, err.Error()) | ||
89 | - } | ||
90 | - if err = transactionContext.StartTransaction(); err != nil { | ||
91 | - log.Error(err) | ||
92 | - return nil, err | ||
93 | - } | ||
94 | - defer func() { | ||
95 | - transactionContext.RollbackTransaction() | ||
96 | - }() | ||
97 | - | ||
98 | - var MenuRepository, _ = factory.CreateMenuRepository(transactionContext) | ||
99 | - var menu *domain.Menu | ||
100 | - if menu, err = MenuRepository.FindOne(common.ObjectToMap(request)); err != nil { | ||
101 | - return | ||
102 | - } | ||
103 | - rsp = menu | ||
104 | - err = transactionContext.CommitTransaction() | ||
105 | - return | ||
106 | -} | ||
107 | - | ||
108 | -func (svr *MenuService) DeleteMenu(header *protocol.RequestHeader, request *protocolx.DeleteMenuRequest) (rsp interface{}, err error) { | ||
109 | - var ( | ||
110 | - transactionContext, _ = factory.CreateTransactionContext(nil) | ||
111 | - ) | ||
112 | - rsp = &protocolx.DeleteMenuResponse{} | ||
113 | - if err = request.ValidateCommand(); err != nil { | ||
114 | - err = protocol.NewCustomMessage(2, err.Error()) | ||
115 | - } | ||
116 | - if err = transactionContext.StartTransaction(); err != nil { | ||
117 | - log.Error(err) | ||
118 | - return nil, err | ||
119 | - } | ||
120 | - defer func() { | ||
121 | - transactionContext.RollbackTransaction() | ||
122 | - }() | ||
123 | - | ||
124 | - var MenuRepository, _ = factory.CreateMenuRepository(transactionContext) | ||
125 | - var menu *domain.Menu | ||
126 | - if menu, err = MenuRepository.FindOne(common.ObjectToMap(request)); err != nil { | ||
127 | - return | ||
128 | - } | ||
129 | - if menu, err = MenuRepository.Remove(menu); err != nil { | ||
130 | - return | ||
131 | - } | ||
132 | - rsp = menu | ||
133 | - err = transactionContext.CommitTransaction() | ||
134 | - return | ||
135 | -} | ||
136 | - | ||
137 | -func (svr *MenuService) ListMenu(header *protocol.RequestHeader, request *protocolx.ListMenuRequest) (rsp interface{}, err error) { | ||
138 | - var ( | ||
139 | - transactionContext, _ = factory.CreateTransactionContext(nil) | ||
140 | - ) | ||
141 | - rsp = &protocolx.ListMenuResponse{} | ||
142 | - if err = request.ValidateCommand(); err != nil { | ||
143 | - err = protocol.NewCustomMessage(2, err.Error()) | ||
144 | - } | ||
145 | - if err = transactionContext.StartTransaction(); err != nil { | ||
146 | - log.Error(err) | ||
147 | - return nil, err | ||
148 | - } | ||
149 | - defer func() { | ||
150 | - transactionContext.RollbackTransaction() | ||
151 | - }() | ||
152 | - | ||
153 | - var MenuRepository, _ = factory.CreateMenuRepository(transactionContext) | ||
154 | - var menu []*domain.Menu | ||
155 | - var total int64 | ||
156 | - if total, menu, err = MenuRepository.Find(common.ObjectToMap(request)); err != nil { | ||
157 | - return | ||
158 | - } | ||
159 | - rsp = map[string]interface{}{ | ||
160 | - "total": total, | ||
161 | - "list": menu, | ||
162 | - } | ||
163 | - err = transactionContext.CommitTransaction() | ||
164 | - return | ||
165 | -} | ||
166 | - | ||
167 | -func NewMenuService(options map[string]interface{}) *MenuService { | ||
168 | - svr := &MenuService{} | ||
169 | - return svr | ||
170 | -} |
1 | -package operator_log | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/common" | 4 | "github.com/tiptok/gocomm/common" |
5 | "github.com/tiptok/gocomm/pkg/log" | 5 | "github.com/tiptok/gocomm/pkg/log" |
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/command" | ||
8 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/query" | ||
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
10 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/operator_log" | ||
11 | ) | 12 | ) |
12 | 13 | ||
13 | type OperatorLogService struct { | 14 | type OperatorLogService struct { |
14 | } | 15 | } |
15 | 16 | ||
16 | -func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader, request *protocolx.CreateOperatorLogRequest) (rsp interface{}, err error) { | 17 | +func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader, request *command.CreateOperatorLogRequest) (rsp interface{}, err error) { |
17 | var ( | 18 | var ( |
18 | transactionContext, _ = factory.CreateTransactionContext(nil) | 19 | transactionContext, _ = factory.CreateTransactionContext(nil) |
19 | ) | 20 | ) |
20 | - rsp = &protocolx.CreateOperatorLogResponse{} | 21 | + rsp = &command.CreateOperatorLogResponse{} |
21 | if err = request.ValidateCommand(); err != nil { | 22 | if err = request.ValidateCommand(); err != nil { |
22 | err = protocol.NewCustomMessage(2, err.Error()) | 23 | err = protocol.NewCustomMessage(2, err.Error()) |
23 | return | 24 | return |
@@ -45,11 +46,11 @@ func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader, | @@ -45,11 +46,11 @@ func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader, | ||
45 | return | 46 | return |
46 | } | 47 | } |
47 | 48 | ||
48 | -func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader, request *protocolx.UpdateOperatorLogRequest) (rsp interface{}, err error) { | 49 | +func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader, request *command.UpdateOperatorLogRequest) (rsp interface{}, err error) { |
49 | var ( | 50 | var ( |
50 | transactionContext, _ = factory.CreateTransactionContext(nil) | 51 | transactionContext, _ = factory.CreateTransactionContext(nil) |
51 | ) | 52 | ) |
52 | - rsp = &protocolx.UpdateOperatorLogResponse{} | 53 | + rsp = &command.UpdateOperatorLogResponse{} |
53 | if err = request.ValidateCommand(); err != nil { | 54 | if err = request.ValidateCommand(); err != nil { |
54 | err = protocol.NewCustomMessage(2, err.Error()) | 55 | err = protocol.NewCustomMessage(2, err.Error()) |
55 | return | 56 | return |
@@ -77,11 +78,11 @@ func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader, | @@ -77,11 +78,11 @@ func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader, | ||
77 | return | 78 | return |
78 | } | 79 | } |
79 | 80 | ||
80 | -func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, request *protocolx.GetOperatorLogRequest) (rsp interface{}, err error) { | 81 | +func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, request *query.GetOperatorLogRequest) (rsp interface{}, err error) { |
81 | var ( | 82 | var ( |
82 | transactionContext, _ = factory.CreateTransactionContext(nil) | 83 | transactionContext, _ = factory.CreateTransactionContext(nil) |
83 | ) | 84 | ) |
84 | - rsp = &protocolx.GetOperatorLogResponse{} | 85 | + rsp = &query.GetOperatorLogResponse{} |
85 | if err = request.ValidateCommand(); err != nil { | 86 | if err = request.ValidateCommand(); err != nil { |
86 | err = protocol.NewCustomMessage(2, err.Error()) | 87 | err = protocol.NewCustomMessage(2, err.Error()) |
87 | return | 88 | return |
@@ -104,11 +105,11 @@ func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, re | @@ -104,11 +105,11 @@ func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, re | ||
104 | return | 105 | return |
105 | } | 106 | } |
106 | 107 | ||
107 | -func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader, request *protocolx.DeleteOperatorLogRequest) (rsp interface{}, err error) { | 108 | +func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader, request *command.DeleteOperatorLogRequest) (rsp interface{}, err error) { |
108 | var ( | 109 | var ( |
109 | transactionContext, _ = factory.CreateTransactionContext(nil) | 110 | transactionContext, _ = factory.CreateTransactionContext(nil) |
110 | ) | 111 | ) |
111 | - rsp = &protocolx.DeleteOperatorLogResponse{} | 112 | + rsp = &command.DeleteOperatorLogResponse{} |
112 | if err = request.ValidateCommand(); err != nil { | 113 | if err = request.ValidateCommand(); err != nil { |
113 | err = protocol.NewCustomMessage(2, err.Error()) | 114 | err = protocol.NewCustomMessage(2, err.Error()) |
114 | return | 115 | return |
@@ -134,11 +135,11 @@ func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader, | @@ -134,11 +135,11 @@ func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader, | ||
134 | return | 135 | return |
135 | } | 136 | } |
136 | 137 | ||
137 | -func (svr *OperatorLogService) ListOperatorLog(header *protocol.RequestHeader, request *protocolx.ListOperatorLogRequest) (rsp interface{}, err error) { | 138 | +func (svr *OperatorLogService) ListOperatorLog(header *protocol.RequestHeader, request *query.ListOperatorLogRequest) (rsp interface{}, err error) { |
138 | var ( | 139 | var ( |
139 | transactionContext, _ = factory.CreateTransactionContext(nil) | 140 | transactionContext, _ = factory.CreateTransactionContext(nil) |
140 | ) | 141 | ) |
141 | - rsp = &protocolx.ListOperatorLogResponse{} | 142 | + rsp = &query.ListOperatorLogResponse{} |
142 | if err = request.ValidateCommand(); err != nil { | 143 | if err = request.ValidateCommand(); err != nil { |
143 | err = protocol.NewCustomMessage(2, err.Error()) | 144 | err = protocol.NewCustomMessage(2, err.Error()) |
144 | return | 145 | return |
1 | -package project_module | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/common" | 4 | "github.com/tiptok/gocomm/common" |
5 | "github.com/tiptok/gocomm/pkg/log" | 5 | "github.com/tiptok/gocomm/pkg/log" |
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/command" | ||
8 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/query" | ||
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
10 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module" | ||
11 | "time" | 12 | "time" |
12 | ) | 13 | ) |
13 | 14 | ||
14 | type ProjectModuleService struct { | 15 | type ProjectModuleService struct { |
15 | } | 16 | } |
16 | 17 | ||
17 | -func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHeader, request *protocolx.CreateProjectModuleRequest) (rsp interface{}, err error) { | 18 | +func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHeader, request *command.CreateProjectModuleRequest) (rsp interface{}, err error) { |
18 | var ( | 19 | var ( |
19 | transactionContext, _ = factory.CreateTransactionContext(nil) | 20 | transactionContext, _ = factory.CreateTransactionContext(nil) |
20 | ProjectModuleVersionRepository, _ = factory.CreateProjectModuleVersionRepository(transactionContext) | 21 | ProjectModuleVersionRepository, _ = factory.CreateProjectModuleVersionRepository(transactionContext) |
21 | ) | 22 | ) |
22 | - rsp = &protocolx.CreateProjectModuleResponse{} | 23 | + rsp = &command.CreateProjectModuleResponse{} |
23 | if err = request.ValidateCommand(); err != nil { | 24 | if err = request.ValidateCommand(); err != nil { |
24 | err = protocol.NewCustomMessage(2, err.Error()) | 25 | err = protocol.NewCustomMessage(2, err.Error()) |
25 | return | 26 | return |
@@ -65,11 +66,11 @@ func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHea | @@ -65,11 +66,11 @@ func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHea | ||
65 | return | 66 | return |
66 | } | 67 | } |
67 | 68 | ||
68 | -func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHeader, request *protocolx.UpdateProjectModuleRequest) (rsp interface{}, err error) { | 69 | +func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHeader, request *command.UpdateProjectModuleRequest) (rsp interface{}, err error) { |
69 | var ( | 70 | var ( |
70 | transactionContext, _ = factory.CreateTransactionContext(nil) | 71 | transactionContext, _ = factory.CreateTransactionContext(nil) |
71 | ) | 72 | ) |
72 | - rsp = &protocolx.UpdateProjectModuleResponse{} | 73 | + rsp = &command.UpdateProjectModuleResponse{} |
73 | if err = request.ValidateCommand(); err != nil { | 74 | if err = request.ValidateCommand(); err != nil { |
74 | err = protocol.NewCustomMessage(2, err.Error()) | 75 | err = protocol.NewCustomMessage(2, err.Error()) |
75 | } | 76 | } |
@@ -103,11 +104,11 @@ func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHea | @@ -103,11 +104,11 @@ func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHea | ||
103 | return | 104 | return |
104 | } | 105 | } |
105 | 106 | ||
106 | -func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader, request *protocolx.GetProjectModuleRequest) (rsp interface{}, err error) { | 107 | +func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader, request *query.GetProjectModuleRequest) (rsp interface{}, err error) { |
107 | var ( | 108 | var ( |
108 | transactionContext, _ = factory.CreateTransactionContext(nil) | 109 | transactionContext, _ = factory.CreateTransactionContext(nil) |
109 | ) | 110 | ) |
110 | - rsp = &protocolx.GetProjectModuleResponse{} | 111 | + rsp = &query.GetProjectModuleResponse{} |
111 | if err = request.ValidateCommand(); err != nil { | 112 | if err = request.ValidateCommand(); err != nil { |
112 | err = protocol.NewCustomMessage(2, err.Error()) | 113 | err = protocol.NewCustomMessage(2, err.Error()) |
113 | return | 114 | return |
@@ -131,11 +132,11 @@ func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader | @@ -131,11 +132,11 @@ func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader | ||
131 | return | 132 | return |
132 | } | 133 | } |
133 | 134 | ||
134 | -func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHeader, request *protocolx.DeleteProjectModuleRequest) (rsp interface{}, err error) { | 135 | +func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHeader, request *command.DeleteProjectModuleRequest) (rsp interface{}, err error) { |
135 | var ( | 136 | var ( |
136 | transactionContext, _ = factory.CreateTransactionContext(nil) | 137 | transactionContext, _ = factory.CreateTransactionContext(nil) |
137 | ) | 138 | ) |
138 | - rsp = &protocolx.DeleteProjectModuleResponse{} | 139 | + rsp = &command.DeleteProjectModuleResponse{} |
139 | if err = request.ValidateCommand(); err != nil { | 140 | if err = request.ValidateCommand(); err != nil { |
140 | err = protocol.NewCustomMessage(2, err.Error()) | 141 | err = protocol.NewCustomMessage(2, err.Error()) |
141 | return | 142 | return |
@@ -164,7 +165,7 @@ func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHea | @@ -164,7 +165,7 @@ func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHea | ||
164 | return | 165 | return |
165 | } | 166 | } |
166 | 167 | ||
167 | -func (svr *ProjectModuleService) ListProjectModule(header *protocol.RequestHeader, request *protocolx.ListProjectModuleRequest) (rsp interface{}, err error) { | 168 | +func (svr *ProjectModuleService) ListProjectModule(header *protocol.RequestHeader, request *query.ListProjectModuleRequest) (rsp interface{}, err error) { |
168 | var ( | 169 | var ( |
169 | transactionContext, _ = factory.CreateTransactionContext(nil) | 170 | transactionContext, _ = factory.CreateTransactionContext(nil) |
170 | ) | 171 | ) |
1 | -package project_module_files | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "bytes" | 4 | "bytes" |
@@ -6,11 +6,12 @@ import ( | @@ -6,11 +6,12 @@ import ( | ||
6 | "github.com/tiptok/gocomm/common" | 6 | "github.com/tiptok/gocomm/common" |
7 | "github.com/tiptok/gocomm/pkg/log" | 7 | "github.com/tiptok/gocomm/pkg/log" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
9 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/command" | ||
10 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/query" | ||
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" | 12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" |
11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 13 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 14 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
13 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_files" | ||
14 | "path/filepath" | 15 | "path/filepath" |
15 | "strconv" | 16 | "strconv" |
16 | "strings" | 17 | "strings" |
@@ -20,12 +21,12 @@ import ( | @@ -20,12 +21,12 @@ import ( | ||
20 | type ProjectModuleFilesService struct { | 21 | type ProjectModuleFilesService struct { |
21 | } | 22 | } |
22 | 23 | ||
23 | -func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.CreateProjectModuleFilesRequest) (rsp interface{}, err error) { | 24 | +func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol.RequestHeader, request *command.CreateProjectModuleFilesRequest) (rsp interface{}, err error) { |
24 | var ( | 25 | var ( |
25 | transactionContext, _ = factory.CreateTransactionContext(nil) | 26 | transactionContext, _ = factory.CreateTransactionContext(nil) |
26 | ProjectModuleVersion, _ = factory.CreateProjectModuleVersionRepository(transactionContext) | 27 | ProjectModuleVersion, _ = factory.CreateProjectModuleVersionRepository(transactionContext) |
27 | ) | 28 | ) |
28 | - rsp = &protocolx.CreateProjectModuleFilesResponse{} | 29 | + rsp = &command.CreateProjectModuleFilesResponse{} |
29 | if err = request.ValidateCommand(); err != nil { | 30 | if err = request.ValidateCommand(); err != nil { |
30 | err = protocol.NewCustomMessage(2, err.Error()) | 31 | err = protocol.NewCustomMessage(2, err.Error()) |
31 | } | 32 | } |
@@ -63,12 +64,12 @@ func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol. | @@ -63,12 +64,12 @@ func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol. | ||
63 | return | 64 | return |
64 | } | 65 | } |
65 | 66 | ||
66 | -func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.UpdateProjectModuleFilesRequest) (rsp interface{}, err error) { | 67 | +func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol.RequestHeader, request *command.UpdateProjectModuleFilesRequest) (rsp interface{}, err error) { |
67 | var ( | 68 | var ( |
68 | transactionContext, _ = factory.CreateTransactionContext(nil) | 69 | transactionContext, _ = factory.CreateTransactionContext(nil) |
69 | ProjectModuleFilesDao, _ = dao.NewProjectModuleFilesDao(transactionContext) | 70 | ProjectModuleFilesDao, _ = dao.NewProjectModuleFilesDao(transactionContext) |
70 | ) | 71 | ) |
71 | - rsp = &protocolx.UpdateProjectModuleFilesResponse{} | 72 | + rsp = &command.UpdateProjectModuleFilesResponse{} |
72 | if err = request.ValidateCommand(); err != nil { | 73 | if err = request.ValidateCommand(); err != nil { |
73 | err = protocol.NewCustomMessage(2, err.Error()) | 74 | err = protocol.NewCustomMessage(2, err.Error()) |
74 | return | 75 | return |
@@ -134,11 +135,11 @@ func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol. | @@ -134,11 +135,11 @@ func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol. | ||
134 | return | 135 | return |
135 | } | 136 | } |
136 | 137 | ||
137 | -func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.GetProjectModuleFilesRequest) (rsp interface{}, err error) { | 138 | +func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.RequestHeader, request *query.GetProjectModuleFilesRequest) (rsp interface{}, err error) { |
138 | var ( | 139 | var ( |
139 | transactionContext, _ = factory.CreateTransactionContext(nil) | 140 | transactionContext, _ = factory.CreateTransactionContext(nil) |
140 | ) | 141 | ) |
141 | - rsp = &protocolx.GetProjectModuleFilesResponse{} | 142 | + rsp = &query.GetProjectModuleFilesResponse{} |
142 | if err = request.ValidateCommand(); err != nil { | 143 | if err = request.ValidateCommand(); err != nil { |
143 | err = protocol.NewCustomMessage(2, err.Error()) | 144 | err = protocol.NewCustomMessage(2, err.Error()) |
144 | } | 145 | } |
@@ -160,11 +161,11 @@ func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.Req | @@ -160,11 +161,11 @@ func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.Req | ||
160 | return | 161 | return |
161 | } | 162 | } |
162 | 163 | ||
163 | -func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.DeleteProjectModuleFilesRequest) (rsp interface{}, err error) { | 164 | +func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol.RequestHeader, request *command.DeleteProjectModuleFilesRequest) (rsp interface{}, err error) { |
164 | var ( | 165 | var ( |
165 | transactionContext, _ = factory.CreateTransactionContext(nil) | 166 | transactionContext, _ = factory.CreateTransactionContext(nil) |
166 | ) | 167 | ) |
167 | - rsp = &protocolx.DeleteProjectModuleFilesResponse{} | 168 | + rsp = &command.DeleteProjectModuleFilesResponse{} |
168 | if err = request.ValidateCommand(); err != nil { | 169 | if err = request.ValidateCommand(); err != nil { |
169 | err = protocol.NewCustomMessage(2, err.Error()) | 170 | err = protocol.NewCustomMessage(2, err.Error()) |
170 | } | 171 | } |
@@ -196,11 +197,11 @@ func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol. | @@ -196,11 +197,11 @@ func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol. | ||
196 | return | 197 | return |
197 | } | 198 | } |
198 | 199 | ||
199 | -func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.ListProjectModuleFilesRequest) (rsp interface{}, err error) { | 200 | +func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.RequestHeader, request *query.ListProjectModuleFilesRequest) (rsp interface{}, err error) { |
200 | var ( | 201 | var ( |
201 | transactionContext, _ = factory.CreateTransactionContext(nil) | 202 | transactionContext, _ = factory.CreateTransactionContext(nil) |
202 | ) | 203 | ) |
203 | - rsp = &protocolx.ListProjectModuleFilesResponse{} | 204 | + rsp = &query.ListProjectModuleFilesResponse{} |
204 | if err = request.ValidateCommand(); err != nil { | 205 | if err = request.ValidateCommand(); err != nil { |
205 | err = protocol.NewCustomMessage(2, err.Error()) | 206 | err = protocol.NewCustomMessage(2, err.Error()) |
206 | return | 207 | return |
@@ -252,12 +253,12 @@ func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.Re | @@ -252,12 +253,12 @@ func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.Re | ||
252 | return | 253 | return |
253 | } | 254 | } |
254 | 255 | ||
255 | -func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, request *protocolx.ImportRequest) (rsp *protocolx.ImportResponse, err error) { | 256 | +func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, request *command.ImportRequest) (rsp *command.ImportResponse, err error) { |
256 | var ( | 257 | var ( |
257 | transactionContext, _ = factory.CreateTransactionContext(nil) | 258 | transactionContext, _ = factory.CreateTransactionContext(nil) |
258 | ProjectModuleVersion, _ = factory.CreateProjectModuleVersionRepository(transactionContext) | 259 | ProjectModuleVersion, _ = factory.CreateProjectModuleVersionRepository(transactionContext) |
259 | ) | 260 | ) |
260 | - rsp = &protocolx.ImportResponse{} | 261 | + rsp = &command.ImportResponse{} |
261 | if err = request.ValidateCommand(); err != nil { | 262 | if err = request.ValidateCommand(); err != nil { |
262 | err = protocol.NewCustomMessage(2, err.Error()) | 263 | err = protocol.NewCustomMessage(2, err.Error()) |
263 | return | 264 | return |
@@ -325,11 +326,11 @@ func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, req | @@ -325,11 +326,11 @@ func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, req | ||
325 | 326 | ||
326 | // ReviseTag | 327 | // ReviseTag |
327 | // 修订标签 | 328 | // 修订标签 |
328 | -func (svr *ProjectModuleFilesService) ReviseTag(header *protocol.RequestHeader, request *protocolx.ReviseTagRequest) (rsp interface{}, err error) { | 329 | +func (svr *ProjectModuleFilesService) ReviseTag(header *protocol.RequestHeader, request *command.ReviseTagRequest) (rsp interface{}, err error) { |
329 | var ( | 330 | var ( |
330 | transactionContext, _ = factory.CreateTransactionContext(nil) | 331 | transactionContext, _ = factory.CreateTransactionContext(nil) |
331 | ) | 332 | ) |
332 | - rsp = &protocolx.ReviseTagResponse{} | 333 | + rsp = &command.ReviseTagResponse{} |
333 | if err = request.ValidateCommand(); err != nil { | 334 | if err = request.ValidateCommand(); err != nil { |
334 | err = protocol.NewCustomMessage(2, err.Error()) | 335 | err = protocol.NewCustomMessage(2, err.Error()) |
335 | return | 336 | return |
@@ -427,11 +428,11 @@ func (svr *ProjectModuleFilesService) mkdirF(fileDir string, mid, vid, pid int64 | @@ -427,11 +428,11 @@ func (svr *ProjectModuleFilesService) mkdirF(fileDir string, mid, vid, pid int64 | ||
427 | 428 | ||
428 | func (svr *ProjectModuleFilesService) traverseModuleFiles(files []*domain.ProjectModuleFiles) interface{} { | 429 | func (svr *ProjectModuleFilesService) traverseModuleFiles(files []*domain.ProjectModuleFiles) interface{} { |
429 | 430 | ||
430 | - retSlice := make([]*protocolx.ModuleFiles, 0) | 431 | + retSlice := make([]*query.ModuleFiles, 0) |
431 | 432 | ||
432 | for i := range files { | 433 | for i := range files { |
433 | if files[i].ParentId == 0 { | 434 | if files[i].ParentId == 0 { |
434 | - retSlice = append(retSlice, &protocolx.ModuleFiles{ModuleFile: protocolx.NewModuleFile(files[i]), List: make([]*protocolx.ModuleFiles, 0)}) | 435 | + retSlice = append(retSlice, &query.ModuleFiles{ModuleFile: query.NewModuleFile(files[i]), List: make([]*query.ModuleFiles, 0)}) |
435 | continue | 436 | continue |
436 | } | 437 | } |
437 | traverse(retSlice, files[i]) | 438 | traverse(retSlice, files[i]) |
@@ -439,17 +440,17 @@ func (svr *ProjectModuleFilesService) traverseModuleFiles(files []*domain.Projec | @@ -439,17 +440,17 @@ func (svr *ProjectModuleFilesService) traverseModuleFiles(files []*domain.Projec | ||
439 | return retSlice | 440 | return retSlice |
440 | } | 441 | } |
441 | 442 | ||
442 | -func traverse(list []*protocolx.ModuleFiles, file *domain.ProjectModuleFiles) { | 443 | +func traverse(list []*query.ModuleFiles, file *domain.ProjectModuleFiles) { |
443 | for i := range list { | 444 | for i := range list { |
444 | if list[i].Id == file.ParentId { | 445 | if list[i].Id == file.ParentId { |
445 | - list[i].List = append(list[i].List, &protocolx.ModuleFiles{ModuleFile: protocolx.NewModuleFile(file), List: make([]*protocolx.ModuleFiles, 0)}) | 446 | + list[i].List = append(list[i].List, &query.ModuleFiles{ModuleFile: query.NewModuleFile(file), List: make([]*query.ModuleFiles, 0)}) |
446 | return | 447 | return |
447 | } | 448 | } |
448 | traverse(list[i].List, file) | 449 | traverse(list[i].List, file) |
449 | } | 450 | } |
450 | return | 451 | return |
451 | } | 452 | } |
452 | -func changeLog(request *protocolx.UpdateProjectModuleFilesRequest, old *domain.ProjectModuleFiles) string { | 453 | +func changeLog(request *command.UpdateProjectModuleFilesRequest, old *domain.ProjectModuleFiles) string { |
453 | buf := bytes.NewBuffer(nil) | 454 | buf := bytes.NewBuffer(nil) |
454 | if len(request.FileName) > 0 && request.FileName != old.FileName { | 455 | if len(request.FileName) > 0 && request.FileName != old.FileName { |
455 | buf.WriteString("【文件名】修改为:" + request.FileName + "\n") | 456 | buf.WriteString("【文件名】修改为:" + request.FileName + "\n") |
1 | -package project_module_version | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | "github.com/tiptok/gocomm/common" | 5 | "github.com/tiptok/gocomm/common" |
6 | "github.com/tiptok/gocomm/pkg/log" | 6 | "github.com/tiptok/gocomm/pkg/log" |
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
8 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/command" | ||
9 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/query" | ||
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" | 11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" |
10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 13 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
12 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_version" | ||
13 | "strings" | 14 | "strings" |
14 | "time" | 15 | "time" |
15 | ) | 16 | ) |
@@ -17,11 +18,11 @@ import ( | @@ -17,11 +18,11 @@ import ( | ||
17 | type ProjectModuleVersionService struct { | 18 | type ProjectModuleVersionService struct { |
18 | } | 19 | } |
19 | 20 | ||
20 | -func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.CreateProjectModuleVersionRequest) (rsp interface{}, err error) { | 21 | +func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *protocol.RequestHeader, request *command.CreateProjectModuleVersionRequest) (rsp interface{}, err error) { |
21 | var ( | 22 | var ( |
22 | transactionContext, _ = factory.CreateTransactionContext(nil) | 23 | transactionContext, _ = factory.CreateTransactionContext(nil) |
23 | ) | 24 | ) |
24 | - rsp = &protocolx.CreateProjectModuleVersionResponse{} | 25 | + rsp = &command.CreateProjectModuleVersionResponse{} |
25 | if err = request.ValidateCommand(); err != nil { | 26 | if err = request.ValidateCommand(); err != nil { |
26 | err = protocol.NewCustomMessage(2, err.Error()) | 27 | err = protocol.NewCustomMessage(2, err.Error()) |
27 | return | 28 | return |
@@ -72,11 +73,11 @@ func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *proto | @@ -72,11 +73,11 @@ func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *proto | ||
72 | return | 73 | return |
73 | } | 74 | } |
74 | 75 | ||
75 | -func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.UpdateProjectModuleVersionRequest) (rsp interface{}, err error) { | 76 | +func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *protocol.RequestHeader, request *command.UpdateProjectModuleVersionRequest) (rsp interface{}, err error) { |
76 | var ( | 77 | var ( |
77 | transactionContext, _ = factory.CreateTransactionContext(nil) | 78 | transactionContext, _ = factory.CreateTransactionContext(nil) |
78 | ) | 79 | ) |
79 | - rsp = &protocolx.UpdateProjectModuleVersionResponse{} | 80 | + rsp = &command.UpdateProjectModuleVersionResponse{} |
80 | if err = request.ValidateCommand(); err != nil { | 81 | if err = request.ValidateCommand(); err != nil { |
81 | err = protocol.NewCustomMessage(2, err.Error()) | 82 | err = protocol.NewCustomMessage(2, err.Error()) |
82 | return | 83 | return |
@@ -112,11 +113,11 @@ func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *proto | @@ -112,11 +113,11 @@ func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *proto | ||
112 | return | 113 | return |
113 | } | 114 | } |
114 | 115 | ||
115 | -func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.GetProjectModuleVersionRequest) (rsp interface{}, err error) { | 116 | +func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol.RequestHeader, request *query.GetProjectModuleVersionRequest) (rsp interface{}, err error) { |
116 | var ( | 117 | var ( |
117 | transactionContext, _ = factory.CreateTransactionContext(nil) | 118 | transactionContext, _ = factory.CreateTransactionContext(nil) |
118 | ) | 119 | ) |
119 | - rsp = &protocolx.GetProjectModuleVersionResponse{} | 120 | + rsp = &query.GetProjectModuleVersionResponse{} |
120 | if err = request.ValidateCommand(); err != nil { | 121 | if err = request.ValidateCommand(); err != nil { |
121 | err = protocol.NewCustomMessage(2, err.Error()) | 122 | err = protocol.NewCustomMessage(2, err.Error()) |
122 | return | 123 | return |
@@ -140,11 +141,11 @@ func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol | @@ -140,11 +141,11 @@ func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol | ||
140 | return | 141 | return |
141 | } | 142 | } |
142 | 143 | ||
143 | -func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.DeleteProjectModuleVersionRequest) (rsp interface{}, err error) { | 144 | +func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *protocol.RequestHeader, request *command.DeleteProjectModuleVersionRequest) (rsp interface{}, err error) { |
144 | var ( | 145 | var ( |
145 | transactionContext, _ = factory.CreateTransactionContext(nil) | 146 | transactionContext, _ = factory.CreateTransactionContext(nil) |
146 | ) | 147 | ) |
147 | - rsp = &protocolx.DeleteProjectModuleVersionResponse{} | 148 | + rsp = &command.DeleteProjectModuleVersionResponse{} |
148 | if err = request.ValidateCommand(); err != nil { | 149 | if err = request.ValidateCommand(); err != nil { |
149 | err = protocol.NewCustomMessage(2, err.Error()) | 150 | err = protocol.NewCustomMessage(2, err.Error()) |
150 | } | 151 | } |
@@ -175,11 +176,11 @@ func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *proto | @@ -175,11 +176,11 @@ func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *proto | ||
175 | return | 176 | return |
176 | } | 177 | } |
177 | 178 | ||
178 | -func (svr *ProjectModuleVersionService) ListProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.ListProjectModuleVersionRequest) (rsp interface{}, err error) { | 179 | +func (svr *ProjectModuleVersionService) ListProjectModuleVersion(header *protocol.RequestHeader, request *query.ListProjectModuleVersionRequest) (rsp interface{}, err error) { |
179 | var ( | 180 | var ( |
180 | transactionContext, _ = factory.CreateTransactionContext(nil) | 181 | transactionContext, _ = factory.CreateTransactionContext(nil) |
181 | ) | 182 | ) |
182 | - rsp = &protocolx.ListProjectModuleVersionResponse{} | 183 | + rsp = &query.ListProjectModuleVersionResponse{} |
183 | if err = request.ValidateCommand(); err != nil { | 184 | if err = request.ValidateCommand(); err != nil { |
184 | err = protocol.NewCustomMessage(2, err.Error()) | 185 | err = protocol.NewCustomMessage(2, err.Error()) |
185 | } | 186 | } |
1 | -package rbac | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 5 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/command" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/query" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
9 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/rbac" | ||
10 | ) | 11 | ) |
11 | 12 | ||
12 | type RbacService struct { | 13 | type RbacService struct { |
13 | } | 14 | } |
14 | 15 | ||
15 | -func (svr *RbacService) Access(header *protocol.RequestHeader, request *protocolx.AccessRequest) (rsp interface{}, err error) { | 16 | +func (svr *RbacService) Access(header *protocol.RequestHeader, request *query.AccessRequest) (rsp interface{}, err error) { |
16 | var ( | 17 | var ( |
17 | transactionContext, _ = factory.CreateTransactionContext(nil) | 18 | transactionContext, _ = factory.CreateTransactionContext(nil) |
18 | ) | 19 | ) |
19 | - rsp = &protocolx.AccessResponse{} | 20 | + rsp = &query.AccessResponse{} |
20 | if err = request.ValidateCommand(); err != nil { | 21 | if err = request.ValidateCommand(); err != nil { |
21 | err = protocol.NewCustomMessage(2, err.Error()) | 22 | err = protocol.NewCustomMessage(2, err.Error()) |
22 | return | 23 | return |
@@ -53,14 +54,14 @@ func (svr *RbacService) Access(header *protocol.RequestHeader, request *protocol | @@ -53,14 +54,14 @@ func (svr *RbacService) Access(header *protocol.RequestHeader, request *protocol | ||
53 | return | 54 | return |
54 | } | 55 | } |
55 | 56 | ||
56 | -func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *protocolx.RoleAccessRequest) (rsp interface{}, err error) { | 57 | +func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *query.RoleAccessRequest) (rsp interface{}, err error) { |
57 | var ( | 58 | var ( |
58 | transactionContext, _ = factory.CreateTransactionContext(nil) | 59 | transactionContext, _ = factory.CreateTransactionContext(nil) |
59 | RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext) | 60 | RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext) |
60 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) | 61 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) |
61 | role *domain.Role | 62 | role *domain.Role |
62 | ) | 63 | ) |
63 | - rsp = &protocolx.RoleAccessResponse{} | 64 | + rsp = &query.RoleAccessResponse{} |
64 | if err = request.ValidateCommand(); err != nil { | 65 | if err = request.ValidateCommand(); err != nil { |
65 | err = protocol.NewCustomMessage(2, err.Error()) | 66 | err = protocol.NewCustomMessage(2, err.Error()) |
66 | return | 67 | return |
@@ -89,14 +90,14 @@ func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *prot | @@ -89,14 +90,14 @@ func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *prot | ||
89 | return | 90 | return |
90 | } | 91 | } |
91 | 92 | ||
92 | -func (svr *RbacService) SetRoleAccess(header *protocol.RequestHeader, request *protocolx.SetRoleAccessRequest) (rsp *protocolx.SetRoleAccessResponse, err error) { | 93 | +func (svr *RbacService) SetRoleAccess(header *protocol.RequestHeader, request *command.SetRoleAccessRequest) (rsp *command.SetRoleAccessResponse, err error) { |
93 | var ( | 94 | var ( |
94 | transactionContext, _ = factory.CreateTransactionContext(nil) | 95 | transactionContext, _ = factory.CreateTransactionContext(nil) |
95 | AccessRepository, _ = factory.CreateAccessRepository(transactionContext) | 96 | AccessRepository, _ = factory.CreateAccessRepository(transactionContext) |
96 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) | 97 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) |
97 | RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext) | 98 | RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext) |
98 | ) | 99 | ) |
99 | - rsp = &protocolx.SetRoleAccessResponse{} | 100 | + rsp = &command.SetRoleAccessResponse{} |
100 | if err = request.ValidateCommand(); err != nil { | 101 | if err = request.ValidateCommand(); err != nil { |
101 | err = protocol.NewCustomMessage(2, err.Error()) | 102 | err = protocol.NewCustomMessage(2, err.Error()) |
102 | } | 103 | } |
1 | -package role | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/common" | 4 | "github.com/tiptok/gocomm/common" |
5 | "github.com/tiptok/gocomm/pkg/log" | 5 | "github.com/tiptok/gocomm/pkg/log" |
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/command" | ||
8 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/query" | ||
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
10 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/role" | ||
11 | "time" | 12 | "time" |
12 | ) | 13 | ) |
13 | 14 | ||
14 | type RoleService struct { | 15 | type RoleService struct { |
15 | } | 16 | } |
16 | 17 | ||
17 | -func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *protocolx.CreateRoleRequest) (rsp interface{}, err error) { | 18 | +func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *command.CreateRoleRequest) (rsp interface{}, err error) { |
18 | var ( | 19 | var ( |
19 | transactionContext, _ = factory.CreateTransactionContext(nil) | 20 | transactionContext, _ = factory.CreateTransactionContext(nil) |
20 | ) | 21 | ) |
21 | - rsp = &protocolx.CreateRoleResponse{} | 22 | + rsp = &command.CreateRoleResponse{} |
22 | if err = request.ValidateCommand(); err != nil { | 23 | if err = request.ValidateCommand(); err != nil { |
23 | err = protocol.NewCustomMessage(2, err.Error()) | 24 | err = protocol.NewCustomMessage(2, err.Error()) |
24 | } | 25 | } |
@@ -52,11 +53,11 @@ func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *prot | @@ -52,11 +53,11 @@ func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *prot | ||
52 | return | 53 | return |
53 | } | 54 | } |
54 | 55 | ||
55 | -func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *protocolx.UpdateRoleRequest) (rsp interface{}, err error) { | 56 | +func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *command.UpdateRoleRequest) (rsp interface{}, err error) { |
56 | var ( | 57 | var ( |
57 | transactionContext, _ = factory.CreateTransactionContext(nil) | 58 | transactionContext, _ = factory.CreateTransactionContext(nil) |
58 | ) | 59 | ) |
59 | - rsp = &protocolx.UpdateRoleResponse{} | 60 | + rsp = &command.UpdateRoleResponse{} |
60 | if err = request.ValidateCommand(); err != nil { | 61 | if err = request.ValidateCommand(); err != nil { |
61 | err = protocol.NewCustomMessage(2, err.Error()) | 62 | err = protocol.NewCustomMessage(2, err.Error()) |
62 | return | 63 | return |
@@ -94,12 +95,12 @@ func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *prot | @@ -94,12 +95,12 @@ func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *prot | ||
94 | return | 95 | return |
95 | } | 96 | } |
96 | 97 | ||
97 | -func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *protocolx.GetRoleRequest) (rsp interface{}, err error) { | 98 | +func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *query.GetRoleRequest) (rsp interface{}, err error) { |
98 | var ( | 99 | var ( |
99 | transactionContext, _ = factory.CreateTransactionContext(nil) | 100 | transactionContext, _ = factory.CreateTransactionContext(nil) |
100 | ) | 101 | ) |
101 | transactionContext.SetTransactionClose() | 102 | transactionContext.SetTransactionClose() |
102 | - rsp = &protocolx.GetRoleResponse{} | 103 | + rsp = &query.GetRoleResponse{} |
103 | if err = request.ValidateCommand(); err != nil { | 104 | if err = request.ValidateCommand(); err != nil { |
104 | err = protocol.NewCustomMessage(2, err.Error()) | 105 | err = protocol.NewCustomMessage(2, err.Error()) |
105 | return | 106 | return |
@@ -122,11 +123,11 @@ func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *protoco | @@ -122,11 +123,11 @@ func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *protoco | ||
122 | return | 123 | return |
123 | } | 124 | } |
124 | 125 | ||
125 | -func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *protocolx.DeleteRoleRequest) (rsp interface{}, err error) { | 126 | +func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *command.DeleteRoleRequest) (rsp interface{}, err error) { |
126 | var ( | 127 | var ( |
127 | transactionContext, _ = factory.CreateTransactionContext(nil) | 128 | transactionContext, _ = factory.CreateTransactionContext(nil) |
128 | ) | 129 | ) |
129 | - rsp = &protocolx.DeleteRoleResponse{} | 130 | + rsp = &command.DeleteRoleResponse{} |
130 | if err = request.ValidateCommand(); err != nil { | 131 | if err = request.ValidateCommand(); err != nil { |
131 | err = protocol.NewCustomMessage(2, err.Error()) | 132 | err = protocol.NewCustomMessage(2, err.Error()) |
132 | return | 133 | return |
@@ -156,11 +157,11 @@ func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *prot | @@ -156,11 +157,11 @@ func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *prot | ||
156 | return | 157 | return |
157 | } | 158 | } |
158 | 159 | ||
159 | -func (svr *RoleService) ListRole(header *protocol.RequestHeader, request *protocolx.ListRoleRequest) (rsp interface{}, err error) { | 160 | +func (svr *RoleService) ListRole(header *protocol.RequestHeader, request *query.ListRoleRequest) (rsp interface{}, err error) { |
160 | var ( | 161 | var ( |
161 | transactionContext, _ = factory.CreateTransactionContext(nil) | 162 | transactionContext, _ = factory.CreateTransactionContext(nil) |
162 | ) | 163 | ) |
163 | - rsp = &protocolx.ListRoleResponse{} | 164 | + rsp = &query.ListRoleResponse{} |
164 | if err = request.ValidateCommand(); err != nil { | 165 | if err = request.ValidateCommand(); err != nil { |
165 | err = protocol.NewCustomMessage(2, err.Error()) | 166 | err = protocol.NewCustomMessage(2, err.Error()) |
166 | } | 167 | } |
1 | -package user | 1 | +package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "crypto/sha1" | 4 | "crypto/sha1" |
@@ -7,10 +7,11 @@ import ( | @@ -7,10 +7,11 @@ import ( | ||
7 | "github.com/tiptok/gocomm/common" | 7 | "github.com/tiptok/gocomm/common" |
8 | "github.com/tiptok/gocomm/pkg/log" | 8 | "github.com/tiptok/gocomm/pkg/log" |
9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory" |
10 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/command" | ||
11 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/query" | ||
10 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" | 12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain" |
11 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 13 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
12 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 14 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
13 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/user" | ||
14 | "strings" | 15 | "strings" |
15 | "time" | 16 | "time" |
16 | ) | 17 | ) |
@@ -18,11 +19,11 @@ import ( | @@ -18,11 +19,11 @@ import ( | ||
18 | type UserService struct { | 19 | type UserService struct { |
19 | } | 20 | } |
20 | 21 | ||
21 | -func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *protocolx.CreateUserRequest) (rsp interface{}, err error) { | 22 | +func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *command.CreateUserRequest) (rsp interface{}, err error) { |
22 | var ( | 23 | var ( |
23 | transactionContext, _ = factory.CreateTransactionContext(nil) | 24 | transactionContext, _ = factory.CreateTransactionContext(nil) |
24 | ) | 25 | ) |
25 | - rsp = &protocolx.CreateUserResponse{} | 26 | + rsp = &command.CreateUserResponse{} |
26 | if err = request.ValidateCommand(); err != nil { | 27 | if err = request.ValidateCommand(); err != nil { |
27 | err = application.ThrowError(application.ARG_ERROR, err.Error()) | 28 | err = application.ThrowError(application.ARG_ERROR, err.Error()) |
28 | return | 29 | return |
@@ -52,7 +53,7 @@ func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *prot | @@ -52,7 +53,7 @@ func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *prot | ||
52 | } | 53 | } |
53 | } | 54 | } |
54 | if len(newUser.Passwd) == 0 { | 55 | if len(newUser.Passwd) == 0 { |
55 | - newUser.Passwd = fmt.Sprintf("%x", sha1.Sum([]byte("123456"))) | 56 | + newUser.Passwd = fmt.Sprintf("%x", sha1.Sum([]byte("mmm123456"))) |
56 | } | 57 | } |
57 | if m, e := UserRepository.Save(newUser); e != nil { | 58 | if m, e := UserRepository.Save(newUser); e != nil { |
58 | err = application.ThrowError(application.INTERNAL_SERVER_ERROR, e.Error()) | 59 | err = application.ThrowError(application.INTERNAL_SERVER_ERROR, e.Error()) |
@@ -67,11 +68,11 @@ func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *prot | @@ -67,11 +68,11 @@ func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *prot | ||
67 | return | 68 | return |
68 | } | 69 | } |
69 | 70 | ||
70 | -func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *protocolx.UpdateUserRequest) (rsp interface{}, err error) { | 71 | +func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *command.UpdateUserRequest) (rsp interface{}, err error) { |
71 | var ( | 72 | var ( |
72 | transactionContext, _ = factory.CreateTransactionContext(nil) | 73 | transactionContext, _ = factory.CreateTransactionContext(nil) |
73 | ) | 74 | ) |
74 | - rsp = &protocolx.UpdateUserResponse{} | 75 | + rsp = &command.UpdateUserResponse{} |
75 | if err = request.ValidateCommand(); err != nil { | 76 | if err = request.ValidateCommand(); err != nil { |
76 | err = application.ThrowError(application.ARG_ERROR, err.Error()) | 77 | err = application.ThrowError(application.ARG_ERROR, err.Error()) |
77 | return | 78 | return |
@@ -112,12 +113,12 @@ func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *prot | @@ -112,12 +113,12 @@ func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *prot | ||
112 | return | 113 | return |
113 | } | 114 | } |
114 | 115 | ||
115 | -func (svr *UserService) GetUser(header *protocol.RequestHeader, request *protocolx.GetUserRequest) (rsp interface{}, err error) { | 116 | +func (svr *UserService) GetUser(header *protocol.RequestHeader, request *query.GetUserRequest) (rsp interface{}, err error) { |
116 | var ( | 117 | var ( |
117 | transactionContext, _ = factory.CreateTransactionContext(nil) | 118 | transactionContext, _ = factory.CreateTransactionContext(nil) |
118 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) | 119 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) |
119 | ) | 120 | ) |
120 | - rsp = &protocolx.GetUserResponse{} | 121 | + rsp = &query.GetUserResponse{} |
121 | if err = request.ValidateCommand(); err != nil { | 122 | if err = request.ValidateCommand(); err != nil { |
122 | err = application.ThrowError(application.ARG_ERROR, err.Error()) | 123 | err = application.ThrowError(application.ARG_ERROR, err.Error()) |
123 | return | 124 | return |
@@ -152,11 +153,11 @@ func (svr *UserService) GetUser(header *protocol.RequestHeader, request *protoco | @@ -152,11 +153,11 @@ func (svr *UserService) GetUser(header *protocol.RequestHeader, request *protoco | ||
152 | return | 153 | return |
153 | } | 154 | } |
154 | 155 | ||
155 | -func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *protocolx.DeleteUserRequest) (rsp interface{}, err error) { | 156 | +func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *command.DeleteUserRequest) (rsp interface{}, err error) { |
156 | var ( | 157 | var ( |
157 | transactionContext, _ = factory.CreateTransactionContext(nil) | 158 | transactionContext, _ = factory.CreateTransactionContext(nil) |
158 | ) | 159 | ) |
159 | - rsp = &protocolx.DeleteUserResponse{} | 160 | + rsp = &command.DeleteUserResponse{} |
160 | if err = request.ValidateCommand(); err != nil { | 161 | if err = request.ValidateCommand(); err != nil { |
161 | err = application.ThrowError(application.ARG_ERROR, err.Error()) | 162 | err = application.ThrowError(application.ARG_ERROR, err.Error()) |
162 | return | 163 | return |
@@ -187,12 +188,12 @@ func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *prot | @@ -187,12 +188,12 @@ func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *prot | ||
187 | return | 188 | return |
188 | } | 189 | } |
189 | 190 | ||
190 | -func (svr *UserService) ListUser(header *protocol.RequestHeader, request *protocolx.ListUserRequest) (rsp interface{}, err error) { | 191 | +func (svr *UserService) ListUser(header *protocol.RequestHeader, request *query.ListUserRequest) (rsp interface{}, err error) { |
191 | var ( | 192 | var ( |
192 | transactionContext, _ = factory.CreateTransactionContext(nil) | 193 | transactionContext, _ = factory.CreateTransactionContext(nil) |
193 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) | 194 | RoleRepository, _ = factory.CreateRoleRepository(transactionContext) |
194 | ) | 195 | ) |
195 | - rsp = &protocolx.ListUserResponse{} | 196 | + rsp = &query.ListUserResponse{} |
196 | if err = request.ValidateCommand(); err != nil { | 197 | if err = request.ValidateCommand(); err != nil { |
197 | err = application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 198 | err = application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
198 | return | 199 | return |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/access" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type AccessController struct { | 11 | type AccessController struct { |
@@ -16,8 +17,8 @@ type AccessController struct { | @@ -16,8 +17,8 @@ type AccessController struct { | ||
16 | func (this *AccessController) CreateAccess() { | 17 | func (this *AccessController) CreateAccess() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = access.NewAccessService(nil) | ||
20 | - request *protocolx.CreateAccessRequest | 20 | + svr = service.NewAccessService(nil) |
21 | + request *command.CreateAccessRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | this.Resp(msg) | 24 | this.Resp(msg) |
@@ -39,8 +40,8 @@ func (this *AccessController) CreateAccess() { | @@ -39,8 +40,8 @@ func (this *AccessController) CreateAccess() { | ||
39 | func (this *AccessController) UpdateAccess() { | 40 | func (this *AccessController) UpdateAccess() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = access.NewAccessService(nil) | ||
43 | - request *protocolx.UpdateAccessRequest | 43 | + svr = service.NewAccessService(nil) |
44 | + request *command.UpdateAccessRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | this.Resp(msg) | 47 | this.Resp(msg) |
@@ -62,8 +63,8 @@ func (this *AccessController) UpdateAccess() { | @@ -62,8 +63,8 @@ func (this *AccessController) UpdateAccess() { | ||
62 | func (this *AccessController) GetAccess() { | 63 | func (this *AccessController) GetAccess() { |
63 | var ( | 64 | var ( |
64 | msg *protocol.ResponseMessage | 65 | msg *protocol.ResponseMessage |
65 | - svr = access.NewAccessService(nil) | ||
66 | - request *protocolx.GetAccessRequest | 66 | + svr = service.NewAccessService(nil) |
67 | + request *query.GetAccessRequest | ||
67 | ) | 68 | ) |
68 | defer func() { | 69 | defer func() { |
69 | this.Resp(msg) | 70 | this.Resp(msg) |
@@ -85,8 +86,8 @@ func (this *AccessController) GetAccess() { | @@ -85,8 +86,8 @@ func (this *AccessController) GetAccess() { | ||
85 | func (this *AccessController) DeleteAccess() { | 86 | func (this *AccessController) DeleteAccess() { |
86 | var ( | 87 | var ( |
87 | msg *protocol.ResponseMessage | 88 | msg *protocol.ResponseMessage |
88 | - svr = access.NewAccessService(nil) | ||
89 | - request *protocolx.DeleteAccessRequest | 89 | + svr = service.NewAccessService(nil) |
90 | + request *command.DeleteAccessRequest | ||
90 | ) | 91 | ) |
91 | defer func() { | 92 | defer func() { |
92 | this.Resp(msg) | 93 | this.Resp(msg) |
@@ -108,8 +109,8 @@ func (this *AccessController) DeleteAccess() { | @@ -108,8 +109,8 @@ func (this *AccessController) DeleteAccess() { | ||
108 | func (this *AccessController) ListAccess() { | 109 | func (this *AccessController) ListAccess() { |
109 | var ( | 110 | var ( |
110 | msg *protocol.ResponseMessage | 111 | msg *protocol.ResponseMessage |
111 | - svr = access.NewAccessService(nil) | ||
112 | - request *protocolx.ListAccessRequest | 112 | + svr = service.NewAccessService(nil) |
113 | + request *query.ListAccessRequest | ||
113 | ) | 114 | ) |
114 | defer func() { | 115 | defer func() { |
115 | this.Resp(msg) | 116 | this.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/auth" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type AuthController struct { | 11 | type AuthController struct { |
@@ -16,8 +17,8 @@ type AuthController struct { | @@ -16,8 +17,8 @@ type AuthController struct { | ||
16 | func (controller *AuthController) Login() { | 17 | func (controller *AuthController) Login() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = auth.NewAuthService(nil) | ||
20 | - request *protocolx.LoginRequest | 20 | + svr = service.NewAuthService(nil) |
21 | + request *command.LoginRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | controller.Resp(msg) | 24 | controller.Resp(msg) |
@@ -39,8 +40,8 @@ func (controller *AuthController) Login() { | @@ -39,8 +40,8 @@ func (controller *AuthController) Login() { | ||
39 | func (controller *AuthController) Logout() { | 40 | func (controller *AuthController) Logout() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = auth.NewAuthService(nil) | ||
43 | - request *protocolx.LogoutRequest | 43 | + svr = service.NewAuthService(nil) |
44 | + request *command.LogoutRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | controller.Resp(msg) | 47 | controller.Resp(msg) |
@@ -62,8 +63,8 @@ func (controller *AuthController) Logout() { | @@ -62,8 +63,8 @@ func (controller *AuthController) Logout() { | ||
62 | func (controller *AuthController) Refresh() { | 63 | func (controller *AuthController) Refresh() { |
63 | var ( | 64 | var ( |
64 | msg *protocol.ResponseMessage | 65 | msg *protocol.ResponseMessage |
65 | - svr = auth.NewAuthService(nil) | ||
66 | - request = &protocolx.RefreshRequest{} | 66 | + svr = service.NewAuthService(nil) |
67 | + request = &command.RefreshRequest{} | ||
67 | ) | 68 | ) |
68 | defer func() { | 69 | defer func() { |
69 | controller.Resp(msg) | 70 | controller.Resp(msg) |
@@ -87,8 +88,8 @@ func (controller *AuthController) Refresh() { | @@ -87,8 +88,8 @@ func (controller *AuthController) Refresh() { | ||
87 | func (controller *AuthController) Profile() { | 88 | func (controller *AuthController) Profile() { |
88 | var ( | 89 | var ( |
89 | msg *protocol.ResponseMessage | 90 | msg *protocol.ResponseMessage |
90 | - svr = auth.NewAuthService(nil) | ||
91 | - request = &protocolx.ProfileRequest{} | 91 | + svr = service.NewAuthService(nil) |
92 | + request = &command.ProfileRequest{} | ||
92 | ) | 93 | ) |
93 | defer func() { | 94 | defer func() { |
94 | controller.Resp(msg) | 95 | controller.Resp(msg) |
@@ -107,8 +108,8 @@ func (controller *AuthController) Profile() { | @@ -107,8 +108,8 @@ func (controller *AuthController) Profile() { | ||
107 | func (controller *AuthController) CaptchaInit() { | 108 | func (controller *AuthController) CaptchaInit() { |
108 | var ( | 109 | var ( |
109 | msg *protocol.ResponseMessage | 110 | msg *protocol.ResponseMessage |
110 | - svr = auth.NewAuthService(nil) | ||
111 | - request = &protocolx.CaptchaInitRequest{} | 111 | + svr = service.NewAuthService(nil) |
112 | + request = &query.CaptchaInitRequest{} | ||
112 | ) | 113 | ) |
113 | defer func() { | 114 | defer func() { |
114 | controller.Resp(msg) | 115 | controller.Resp(msg) |
@@ -127,8 +128,8 @@ func (controller *AuthController) CaptchaInit() { | @@ -127,8 +128,8 @@ func (controller *AuthController) CaptchaInit() { | ||
127 | func (controller *AuthController) ChangePassword() { | 128 | func (controller *AuthController) ChangePassword() { |
128 | var ( | 129 | var ( |
129 | msg *protocol.ResponseMessage | 130 | msg *protocol.ResponseMessage |
130 | - svr = auth.NewAuthService(nil) | ||
131 | - request *protocolx.ChangePasswordRequest | 131 | + svr = service.NewAuthService(nil) |
132 | + request *command.ChangePasswordRequest | ||
132 | ) | 133 | ) |
133 | defer func() { | 134 | defer func() { |
134 | controller.Resp(msg) | 135 | controller.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/client_version" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/client_version" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type ClientVersionController struct { | 11 | type ClientVersionController struct { |
@@ -16,8 +17,8 @@ type ClientVersionController struct { | @@ -16,8 +17,8 @@ type ClientVersionController struct { | ||
16 | func (controller *ClientVersionController) CreateClientVersion() { | 17 | func (controller *ClientVersionController) CreateClientVersion() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = client_version.NewClientVersionService(nil) | ||
20 | - request *protocolx.CreateClientVersionRequest | 20 | + svr = service.NewClientVersionService(nil) |
21 | + request *command.CreateClientVersionRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | controller.Resp(msg) | 24 | controller.Resp(msg) |
@@ -39,8 +40,8 @@ func (controller *ClientVersionController) CreateClientVersion() { | @@ -39,8 +40,8 @@ func (controller *ClientVersionController) CreateClientVersion() { | ||
39 | func (controller *ClientVersionController) UpdateClientVersion() { | 40 | func (controller *ClientVersionController) UpdateClientVersion() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = client_version.NewClientVersionService(nil) | ||
43 | - request = &protocolx.UpdateClientVersionRequest{} | 43 | + svr = service.NewClientVersionService(nil) |
44 | + request = &command.UpdateClientVersionRequest{} | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | controller.Resp(msg) | 47 | controller.Resp(msg) |
@@ -63,8 +64,8 @@ func (controller *ClientVersionController) UpdateClientVersion() { | @@ -63,8 +64,8 @@ func (controller *ClientVersionController) UpdateClientVersion() { | ||
63 | func (controller *ClientVersionController) GetClientVersion() { | 64 | func (controller *ClientVersionController) GetClientVersion() { |
64 | var ( | 65 | var ( |
65 | msg *protocol.ResponseMessage | 66 | msg *protocol.ResponseMessage |
66 | - svr = client_version.NewClientVersionService(nil) | ||
67 | - request = &protocolx.GetClientVersionRequest{} | 67 | + svr = service.NewClientVersionService(nil) |
68 | + request = &query.GetClientVersionRequest{} | ||
68 | ) | 69 | ) |
69 | defer func() { | 70 | defer func() { |
70 | controller.Resp(msg) | 71 | controller.Resp(msg) |
@@ -83,8 +84,8 @@ func (controller *ClientVersionController) GetClientVersion() { | @@ -83,8 +84,8 @@ func (controller *ClientVersionController) GetClientVersion() { | ||
83 | func (controller *ClientVersionController) DeleteClientVersion() { | 84 | func (controller *ClientVersionController) DeleteClientVersion() { |
84 | var ( | 85 | var ( |
85 | msg *protocol.ResponseMessage | 86 | msg *protocol.ResponseMessage |
86 | - svr = client_version.NewClientVersionService(nil) | ||
87 | - request = &protocolx.DeleteClientVersionRequest{} | 87 | + svr = service.NewClientVersionService(nil) |
88 | + request = &command.DeleteClientVersionRequest{} | ||
88 | ) | 89 | ) |
89 | defer func() { | 90 | defer func() { |
90 | controller.Resp(msg) | 91 | controller.Resp(msg) |
@@ -103,8 +104,8 @@ func (controller *ClientVersionController) DeleteClientVersion() { | @@ -103,8 +104,8 @@ func (controller *ClientVersionController) DeleteClientVersion() { | ||
103 | func (controller *ClientVersionController) ListClientVersion() { | 104 | func (controller *ClientVersionController) ListClientVersion() { |
104 | var ( | 105 | var ( |
105 | msg *protocol.ResponseMessage | 106 | msg *protocol.ResponseMessage |
106 | - svr = client_version.NewClientVersionService(nil) | ||
107 | - request = &protocolx.ListClientVersionRequest{} | 107 | + svr = service.NewClientVersionService(nil) |
108 | + request = &query.ListClientVersionRequest{} | ||
108 | ) | 109 | ) |
109 | defer func() { | 110 | defer func() { |
110 | controller.Resp(msg) | 111 | controller.Resp(msg) |
pkg/port/beego/controllers/menu.go
已删除
100644 → 0
1 | -package controllers | ||
2 | - | ||
3 | -import ( | ||
4 | - "github.com/tiptok/gocomm/pkg/log" | ||
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/menu" | ||
6 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | ||
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/menu" | ||
8 | -) | ||
9 | - | ||
10 | -type MenuController struct { | ||
11 | - BaseController | ||
12 | -} | ||
13 | - | ||
14 | -// CreateMenu | ||
15 | -// CreateMenu execute command create Menu | ||
16 | -func (this *MenuController) CreateMenu() { | ||
17 | - var ( | ||
18 | - msg *protocol.ResponseMessage | ||
19 | - svr = menu.NewMenuService(nil) | ||
20 | - request *protocolx.CreateMenuRequest | ||
21 | - ) | ||
22 | - defer func() { | ||
23 | - this.Resp(msg) | ||
24 | - }() | ||
25 | - if err := this.JsonUnmarshal(&request); err != nil { | ||
26 | - msg = protocol.NewResponseMessage(2, "") | ||
27 | - return | ||
28 | - } | ||
29 | - header := this.GetRequestHeader(this.Ctx) | ||
30 | - data, err := svr.CreateMenu(header, request) | ||
31 | - if err != nil { | ||
32 | - log.Error(err) | ||
33 | - } | ||
34 | - msg = protocol.NewResponseMessageData(data, err) | ||
35 | -} | ||
36 | - | ||
37 | -// UpdateMenu | ||
38 | -// UpdateMenu execute command update Menu | ||
39 | -func (this *MenuController) UpdateMenu() { | ||
40 | - var ( | ||
41 | - msg *protocol.ResponseMessage | ||
42 | - svr = menu.NewMenuService(nil) | ||
43 | - request *protocolx.UpdateMenuRequest | ||
44 | - ) | ||
45 | - defer func() { | ||
46 | - this.Resp(msg) | ||
47 | - }() | ||
48 | - if err := this.JsonUnmarshal(&request); err != nil { | ||
49 | - msg = protocol.NewResponseMessage(2, "") | ||
50 | - return | ||
51 | - } | ||
52 | - header := this.GetRequestHeader(this.Ctx) | ||
53 | - data, err := svr.UpdateMenu(header, request) | ||
54 | - if err != nil { | ||
55 | - log.Error(err) | ||
56 | - } | ||
57 | - msg = protocol.NewResponseMessageData(data, err) | ||
58 | -} | ||
59 | - | ||
60 | -// GetMenu | ||
61 | -// GetMenu execute query get Menu | ||
62 | -func (this *MenuController) GetMenu() { | ||
63 | - var ( | ||
64 | - msg *protocol.ResponseMessage | ||
65 | - svr = menu.NewMenuService(nil) | ||
66 | - request *protocolx.GetMenuRequest | ||
67 | - ) | ||
68 | - defer func() { | ||
69 | - this.Resp(msg) | ||
70 | - }() | ||
71 | - if err := this.JsonUnmarshal(&request); err != nil { | ||
72 | - msg = protocol.NewResponseMessage(2, "") | ||
73 | - return | ||
74 | - } | ||
75 | - header := this.GetRequestHeader(this.Ctx) | ||
76 | - data, err := svr.GetMenu(header, request) | ||
77 | - if err != nil { | ||
78 | - log.Error(err) | ||
79 | - } | ||
80 | - msg = protocol.NewResponseMessageData(data, err) | ||
81 | -} | ||
82 | - | ||
83 | -// DeleteMenu | ||
84 | -// DeleteMenu execute command delete Menu | ||
85 | -func (this *MenuController) DeleteMenu() { | ||
86 | - var ( | ||
87 | - msg *protocol.ResponseMessage | ||
88 | - svr = menu.NewMenuService(nil) | ||
89 | - request *protocolx.DeleteMenuRequest | ||
90 | - ) | ||
91 | - defer func() { | ||
92 | - this.Resp(msg) | ||
93 | - }() | ||
94 | - if err := this.JsonUnmarshal(&request); err != nil { | ||
95 | - msg = protocol.NewResponseMessage(2, "") | ||
96 | - return | ||
97 | - } | ||
98 | - header := this.GetRequestHeader(this.Ctx) | ||
99 | - data, err := svr.DeleteMenu(header, request) | ||
100 | - if err != nil { | ||
101 | - log.Error(err) | ||
102 | - } | ||
103 | - msg = protocol.NewResponseMessageData(data, err) | ||
104 | -} | ||
105 | - | ||
106 | -// ListMenu | ||
107 | -// ListMenu execute query list Menu | ||
108 | -func (this *MenuController) ListMenu() { | ||
109 | - var ( | ||
110 | - msg *protocol.ResponseMessage | ||
111 | - svr = menu.NewMenuService(nil) | ||
112 | - request *protocolx.ListMenuRequest | ||
113 | - ) | ||
114 | - defer func() { | ||
115 | - this.Resp(msg) | ||
116 | - }() | ||
117 | - if err := this.JsonUnmarshal(&request); err != nil { | ||
118 | - msg = protocol.NewResponseMessage(2, "") | ||
119 | - return | ||
120 | - } | ||
121 | - header := this.GetRequestHeader(this.Ctx) | ||
122 | - data, err := svr.ListMenu(header, request) | ||
123 | - if err != nil { | ||
124 | - log.Error(err) | ||
125 | - } | ||
126 | - msg = protocol.NewResponseMessageData(data, err) | ||
127 | -} |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operator_log" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/operator_log" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type OperatorLogController struct { | 11 | type OperatorLogController struct { |
@@ -16,8 +17,8 @@ type OperatorLogController struct { | @@ -16,8 +17,8 @@ type OperatorLogController struct { | ||
16 | func (controller *OperatorLogController) CreateOperatorLog() { | 17 | func (controller *OperatorLogController) CreateOperatorLog() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = operator_log.NewOperatorLogService(nil) | ||
20 | - request *protocolx.CreateOperatorLogRequest | 20 | + svr = service.NewOperatorLogService(nil) |
21 | + request *command.CreateOperatorLogRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | controller.Resp(msg) | 24 | controller.Resp(msg) |
@@ -39,8 +40,8 @@ func (controller *OperatorLogController) CreateOperatorLog() { | @@ -39,8 +40,8 @@ func (controller *OperatorLogController) CreateOperatorLog() { | ||
39 | func (controller *OperatorLogController) UpdateOperatorLog() { | 40 | func (controller *OperatorLogController) UpdateOperatorLog() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = operator_log.NewOperatorLogService(nil) | ||
43 | - request *protocolx.UpdateOperatorLogRequest | 43 | + svr = service.NewOperatorLogService(nil) |
44 | + request *command.UpdateOperatorLogRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | controller.Resp(msg) | 47 | controller.Resp(msg) |
@@ -62,8 +63,8 @@ func (controller *OperatorLogController) UpdateOperatorLog() { | @@ -62,8 +63,8 @@ func (controller *OperatorLogController) UpdateOperatorLog() { | ||
62 | func (controller *OperatorLogController) GetOperatorLog() { | 63 | func (controller *OperatorLogController) GetOperatorLog() { |
63 | var ( | 64 | var ( |
64 | msg *protocol.ResponseMessage | 65 | msg *protocol.ResponseMessage |
65 | - svr = operator_log.NewOperatorLogService(nil) | ||
66 | - request *protocolx.GetOperatorLogRequest | 66 | + svr = service.NewOperatorLogService(nil) |
67 | + request *query.GetOperatorLogRequest | ||
67 | ) | 68 | ) |
68 | defer func() { | 69 | defer func() { |
69 | controller.Resp(msg) | 70 | controller.Resp(msg) |
@@ -85,8 +86,8 @@ func (controller *OperatorLogController) GetOperatorLog() { | @@ -85,8 +86,8 @@ func (controller *OperatorLogController) GetOperatorLog() { | ||
85 | func (controller *OperatorLogController) DeleteOperatorLog() { | 86 | func (controller *OperatorLogController) DeleteOperatorLog() { |
86 | var ( | 87 | var ( |
87 | msg *protocol.ResponseMessage | 88 | msg *protocol.ResponseMessage |
88 | - svr = operator_log.NewOperatorLogService(nil) | ||
89 | - request *protocolx.DeleteOperatorLogRequest | 89 | + svr = service.NewOperatorLogService(nil) |
90 | + request *command.DeleteOperatorLogRequest | ||
90 | ) | 91 | ) |
91 | defer func() { | 92 | defer func() { |
92 | controller.Resp(msg) | 93 | controller.Resp(msg) |
@@ -108,8 +109,8 @@ func (controller *OperatorLogController) DeleteOperatorLog() { | @@ -108,8 +109,8 @@ func (controller *OperatorLogController) DeleteOperatorLog() { | ||
108 | func (controller *OperatorLogController) ListOperatorLog() { | 109 | func (controller *OperatorLogController) ListOperatorLog() { |
109 | var ( | 110 | var ( |
110 | msg *protocol.ResponseMessage | 111 | msg *protocol.ResponseMessage |
111 | - svr = operator_log.NewOperatorLogService(nil) | ||
112 | - request = &protocolx.ListOperatorLogRequest{} | 112 | + svr = service.NewOperatorLogService(nil) |
113 | + request = &query.ListOperatorLogRequest{} | ||
113 | ) | 114 | ) |
114 | defer func() { | 115 | defer func() { |
115 | controller.Resp(msg) | 116 | controller.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type ProjectModuleController struct { | 11 | type ProjectModuleController struct { |
@@ -16,8 +17,8 @@ type ProjectModuleController struct { | @@ -16,8 +17,8 @@ type ProjectModuleController struct { | ||
16 | func (controller *ProjectModuleController) CreateProjectModule() { | 17 | func (controller *ProjectModuleController) CreateProjectModule() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = project_module.NewProjectModuleService(nil) | ||
20 | - request *protocolx.CreateProjectModuleRequest | 20 | + svr = service.NewProjectModuleService(nil) |
21 | + request *command.CreateProjectModuleRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | controller.Resp(msg) | 24 | controller.Resp(msg) |
@@ -39,8 +40,8 @@ func (controller *ProjectModuleController) CreateProjectModule() { | @@ -39,8 +40,8 @@ func (controller *ProjectModuleController) CreateProjectModule() { | ||
39 | func (controller *ProjectModuleController) UpdateProjectModule() { | 40 | func (controller *ProjectModuleController) UpdateProjectModule() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = project_module.NewProjectModuleService(nil) | ||
43 | - request *protocolx.UpdateProjectModuleRequest | 43 | + svr = service.NewProjectModuleService(nil) |
44 | + request *command.UpdateProjectModuleRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | controller.Resp(msg) | 47 | controller.Resp(msg) |
@@ -63,8 +64,8 @@ func (controller *ProjectModuleController) UpdateProjectModule() { | @@ -63,8 +64,8 @@ func (controller *ProjectModuleController) UpdateProjectModule() { | ||
63 | func (controller *ProjectModuleController) GetProjectModule() { | 64 | func (controller *ProjectModuleController) GetProjectModule() { |
64 | var ( | 65 | var ( |
65 | msg *protocol.ResponseMessage | 66 | msg *protocol.ResponseMessage |
66 | - svr = project_module.NewProjectModuleService(nil) | ||
67 | - request = &protocolx.GetProjectModuleRequest{} | 67 | + svr = service.NewProjectModuleService(nil) |
68 | + request = &query.GetProjectModuleRequest{} | ||
68 | ) | 69 | ) |
69 | defer func() { | 70 | defer func() { |
70 | controller.Resp(msg) | 71 | controller.Resp(msg) |
@@ -83,8 +84,8 @@ func (controller *ProjectModuleController) GetProjectModule() { | @@ -83,8 +84,8 @@ func (controller *ProjectModuleController) GetProjectModule() { | ||
83 | func (controller *ProjectModuleController) DeleteProjectModule() { | 84 | func (controller *ProjectModuleController) DeleteProjectModule() { |
84 | var ( | 85 | var ( |
85 | msg *protocol.ResponseMessage | 86 | msg *protocol.ResponseMessage |
86 | - svr = project_module.NewProjectModuleService(nil) | ||
87 | - request = &protocolx.DeleteProjectModuleRequest{} | 87 | + svr = service.NewProjectModuleService(nil) |
88 | + request = &command.DeleteProjectModuleRequest{} | ||
88 | ) | 89 | ) |
89 | defer func() { | 90 | defer func() { |
90 | controller.Resp(msg) | 91 | controller.Resp(msg) |
@@ -103,8 +104,8 @@ func (controller *ProjectModuleController) DeleteProjectModule() { | @@ -103,8 +104,8 @@ func (controller *ProjectModuleController) DeleteProjectModule() { | ||
103 | func (controller *ProjectModuleController) ListProjectModule() { | 104 | func (controller *ProjectModuleController) ListProjectModule() { |
104 | var ( | 105 | var ( |
105 | msg *protocol.ResponseMessage | 106 | msg *protocol.ResponseMessage |
106 | - svr = project_module.NewProjectModuleService(nil) | ||
107 | - request = &protocolx.ListProjectModuleRequest{} | 107 | + svr = service.NewProjectModuleService(nil) |
108 | + request = &query.ListProjectModuleRequest{} | ||
108 | ) | 109 | ) |
109 | defer func() { | 110 | defer func() { |
110 | controller.Resp(msg) | 111 | controller.Resp(msg) |
@@ -2,10 +2,11 @@ package controllers | @@ -2,10 +2,11 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module_files" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils" |
7 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 9 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
8 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_files" | ||
9 | ) | 10 | ) |
10 | 11 | ||
11 | type ProjectModuleFilesController struct { | 12 | type ProjectModuleFilesController struct { |
@@ -17,8 +18,8 @@ type ProjectModuleFilesController struct { | @@ -17,8 +18,8 @@ type ProjectModuleFilesController struct { | ||
17 | func (controller *ProjectModuleFilesController) CreateProjectModuleFiles() { | 18 | func (controller *ProjectModuleFilesController) CreateProjectModuleFiles() { |
18 | var ( | 19 | var ( |
19 | msg *protocol.ResponseMessage | 20 | msg *protocol.ResponseMessage |
20 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
21 | - request *protocolx.CreateProjectModuleFilesRequest | 21 | + svr = service.NewProjectModuleFilesService(nil) |
22 | + request *command.CreateProjectModuleFilesRequest | ||
22 | ) | 23 | ) |
23 | defer func() { | 24 | defer func() { |
24 | controller.Resp(msg) | 25 | controller.Resp(msg) |
@@ -40,8 +41,8 @@ func (controller *ProjectModuleFilesController) CreateProjectModuleFiles() { | @@ -40,8 +41,8 @@ func (controller *ProjectModuleFilesController) CreateProjectModuleFiles() { | ||
40 | func (controller *ProjectModuleFilesController) UpdateProjectModuleFiles() { | 41 | func (controller *ProjectModuleFilesController) UpdateProjectModuleFiles() { |
41 | var ( | 42 | var ( |
42 | msg *protocol.ResponseMessage | 43 | msg *protocol.ResponseMessage |
43 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
44 | - request *protocolx.UpdateProjectModuleFilesRequest | 44 | + svr = service.NewProjectModuleFilesService(nil) |
45 | + request *command.UpdateProjectModuleFilesRequest | ||
45 | ) | 46 | ) |
46 | defer func() { | 47 | defer func() { |
47 | controller.Resp(msg) | 48 | controller.Resp(msg) |
@@ -64,8 +65,8 @@ func (controller *ProjectModuleFilesController) UpdateProjectModuleFiles() { | @@ -64,8 +65,8 @@ func (controller *ProjectModuleFilesController) UpdateProjectModuleFiles() { | ||
64 | func (controller *ProjectModuleFilesController) GetProjectModuleFiles() { | 65 | func (controller *ProjectModuleFilesController) GetProjectModuleFiles() { |
65 | var ( | 66 | var ( |
66 | msg *protocol.ResponseMessage | 67 | msg *protocol.ResponseMessage |
67 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
68 | - request = &protocolx.GetProjectModuleFilesRequest{} | 68 | + svr = service.NewProjectModuleFilesService(nil) |
69 | + request = &query.GetProjectModuleFilesRequest{} | ||
69 | ) | 70 | ) |
70 | defer func() { | 71 | defer func() { |
71 | controller.Resp(msg) | 72 | controller.Resp(msg) |
@@ -84,8 +85,8 @@ func (controller *ProjectModuleFilesController) GetProjectModuleFiles() { | @@ -84,8 +85,8 @@ func (controller *ProjectModuleFilesController) GetProjectModuleFiles() { | ||
84 | func (controller *ProjectModuleFilesController) DeleteProjectModuleFiles() { | 85 | func (controller *ProjectModuleFilesController) DeleteProjectModuleFiles() { |
85 | var ( | 86 | var ( |
86 | msg *protocol.ResponseMessage | 87 | msg *protocol.ResponseMessage |
87 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
88 | - request = &protocolx.DeleteProjectModuleFilesRequest{} | 88 | + svr = service.NewProjectModuleFilesService(nil) |
89 | + request = &command.DeleteProjectModuleFilesRequest{} | ||
89 | ) | 90 | ) |
90 | defer func() { | 91 | defer func() { |
91 | controller.Resp(msg) | 92 | controller.Resp(msg) |
@@ -104,8 +105,8 @@ func (controller *ProjectModuleFilesController) DeleteProjectModuleFiles() { | @@ -104,8 +105,8 @@ func (controller *ProjectModuleFilesController) DeleteProjectModuleFiles() { | ||
104 | func (controller *ProjectModuleFilesController) ListProjectModuleFiles() { | 105 | func (controller *ProjectModuleFilesController) ListProjectModuleFiles() { |
105 | var ( | 106 | var ( |
106 | msg *protocol.ResponseMessage | 107 | msg *protocol.ResponseMessage |
107 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
108 | - request = &protocolx.ListProjectModuleFilesRequest{} | 108 | + svr = service.NewProjectModuleFilesService(nil) |
109 | + request = &query.ListProjectModuleFilesRequest{} | ||
109 | ) | 110 | ) |
110 | defer func() { | 111 | defer func() { |
111 | controller.Resp(msg) | 112 | controller.Resp(msg) |
@@ -130,8 +131,8 @@ func (controller *ProjectModuleFilesController) ListProjectModuleFiles() { | @@ -130,8 +131,8 @@ func (controller *ProjectModuleFilesController) ListProjectModuleFiles() { | ||
130 | func (controller *ProjectModuleFilesController) Import() { | 131 | func (controller *ProjectModuleFilesController) Import() { |
131 | var ( | 132 | var ( |
132 | msg *protocol.ResponseMessage | 133 | msg *protocol.ResponseMessage |
133 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
134 | - request = &protocolx.ImportRequest{} | 134 | + svr = service.NewProjectModuleFilesService(nil) |
135 | + request = &command.ImportRequest{} | ||
135 | ) | 136 | ) |
136 | defer func() { | 137 | defer func() { |
137 | controller.Resp(msg) | 138 | controller.Resp(msg) |
@@ -141,7 +142,7 @@ func (controller *ProjectModuleFilesController) Import() { | @@ -141,7 +142,7 @@ func (controller *ProjectModuleFilesController) Import() { | ||
141 | request.ProjectModuleVersionId, _ = controller.GetInt64("projectModuleVersionId") | 142 | request.ProjectModuleVersionId, _ = controller.GetInt64("projectModuleVersionId") |
142 | request.ParentId, _ = controller.GetInt64("parentId") | 143 | request.ParentId, _ = controller.GetInt64("parentId") |
143 | for _, v := range utils.ReadMultipartFormFile(controller.Ctx.Request.MultipartForm.File, 5*1024) { | 144 | for _, v := range utils.ReadMultipartFormFile(controller.Ctx.Request.MultipartForm.File, 5*1024) { |
144 | - request.ImportFiles = append(request.ImportFiles, protocolx.ImportFile{ | 145 | + request.ImportFiles = append(request.ImportFiles, command.ImportFile{ |
145 | FileName: v.FileName, | 146 | FileName: v.FileName, |
146 | FileContent: v.FileContent, | 147 | FileContent: v.FileContent, |
147 | }) | 148 | }) |
@@ -158,8 +159,8 @@ func (controller *ProjectModuleFilesController) Import() { | @@ -158,8 +159,8 @@ func (controller *ProjectModuleFilesController) Import() { | ||
158 | func (controller *ProjectModuleFilesController) ReviseTag() { | 159 | func (controller *ProjectModuleFilesController) ReviseTag() { |
159 | var ( | 160 | var ( |
160 | msg *protocol.ResponseMessage | 161 | msg *protocol.ResponseMessage |
161 | - svr = project_module_files.NewProjectModuleFilesService(nil) | ||
162 | - request = &protocolx.ReviseTagRequest{} | 162 | + svr = service.NewProjectModuleFilesService(nil) |
163 | + request = &command.ReviseTagRequest{} | ||
163 | ) | 164 | ) |
164 | defer func() { | 165 | defer func() { |
165 | controller.Resp(msg) | 166 | controller.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module_version" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_version" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type ProjectModuleVersionController struct { | 11 | type ProjectModuleVersionController struct { |
@@ -16,8 +17,8 @@ type ProjectModuleVersionController struct { | @@ -16,8 +17,8 @@ type ProjectModuleVersionController struct { | ||
16 | func (this *ProjectModuleVersionController) CreateProjectModuleVersion() { | 17 | func (this *ProjectModuleVersionController) CreateProjectModuleVersion() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = project_module_version.NewProjectModuleVersionService(nil) | ||
20 | - request *protocolx.CreateProjectModuleVersionRequest | 20 | + svr = service.NewProjectModuleVersionService(nil) |
21 | + request *command.CreateProjectModuleVersionRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | this.Resp(msg) | 24 | this.Resp(msg) |
@@ -39,8 +40,8 @@ func (this *ProjectModuleVersionController) CreateProjectModuleVersion() { | @@ -39,8 +40,8 @@ func (this *ProjectModuleVersionController) CreateProjectModuleVersion() { | ||
39 | func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() { | 40 | func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = project_module_version.NewProjectModuleVersionService(nil) | ||
43 | - request *protocolx.UpdateProjectModuleVersionRequest | 43 | + svr = service.NewProjectModuleVersionService(nil) |
44 | + request *command.UpdateProjectModuleVersionRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | this.Resp(msg) | 47 | this.Resp(msg) |
@@ -63,8 +64,8 @@ func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() { | @@ -63,8 +64,8 @@ func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() { | ||
63 | func (this *ProjectModuleVersionController) GetProjectModuleVersion() { | 64 | func (this *ProjectModuleVersionController) GetProjectModuleVersion() { |
64 | var ( | 65 | var ( |
65 | msg *protocol.ResponseMessage | 66 | msg *protocol.ResponseMessage |
66 | - svr = project_module_version.NewProjectModuleVersionService(nil) | ||
67 | - request = &protocolx.GetProjectModuleVersionRequest{} | 67 | + svr = service.NewProjectModuleVersionService(nil) |
68 | + request = &query.GetProjectModuleVersionRequest{} | ||
68 | ) | 69 | ) |
69 | defer func() { | 70 | defer func() { |
70 | this.Resp(msg) | 71 | this.Resp(msg) |
@@ -83,8 +84,8 @@ func (this *ProjectModuleVersionController) GetProjectModuleVersion() { | @@ -83,8 +84,8 @@ func (this *ProjectModuleVersionController) GetProjectModuleVersion() { | ||
83 | func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() { | 84 | func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() { |
84 | var ( | 85 | var ( |
85 | msg *protocol.ResponseMessage | 86 | msg *protocol.ResponseMessage |
86 | - svr = project_module_version.NewProjectModuleVersionService(nil) | ||
87 | - request = &protocolx.DeleteProjectModuleVersionRequest{} | 87 | + svr = service.NewProjectModuleVersionService(nil) |
88 | + request = &command.DeleteProjectModuleVersionRequest{} | ||
88 | ) | 89 | ) |
89 | defer func() { | 90 | defer func() { |
90 | this.Resp(msg) | 91 | this.Resp(msg) |
@@ -103,8 +104,8 @@ func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() { | @@ -103,8 +104,8 @@ func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() { | ||
103 | func (this *ProjectModuleVersionController) ListProjectModuleVersion() { | 104 | func (this *ProjectModuleVersionController) ListProjectModuleVersion() { |
104 | var ( | 105 | var ( |
105 | msg *protocol.ResponseMessage | 106 | msg *protocol.ResponseMessage |
106 | - svr = project_module_version.NewProjectModuleVersionService(nil) | ||
107 | - request = &protocolx.ListProjectModuleVersionRequest{} | 107 | + svr = service.NewProjectModuleVersionService(nil) |
108 | + request = &query.ListProjectModuleVersionRequest{} | ||
108 | ) | 109 | ) |
109 | defer func() { | 110 | defer func() { |
110 | this.Resp(msg) | 111 | this.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/rbac" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type RbacController struct { | 11 | type RbacController struct { |
@@ -16,8 +17,8 @@ type RbacController struct { | @@ -16,8 +17,8 @@ type RbacController struct { | ||
16 | func (this *RbacController) Access() { | 17 | func (this *RbacController) Access() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = rbac.NewRbacService(nil) | ||
20 | - request *protocolx.AccessRequest | 20 | + svr = service.NewRbacService(nil) |
21 | + request *query.AccessRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | this.Resp(msg) | 24 | this.Resp(msg) |
@@ -35,8 +36,8 @@ func (this *RbacController) Access() { | @@ -35,8 +36,8 @@ func (this *RbacController) Access() { | ||
35 | func (this *RbacController) RoleAccess() { | 36 | func (this *RbacController) RoleAccess() { |
36 | var ( | 37 | var ( |
37 | msg *protocol.ResponseMessage | 38 | msg *protocol.ResponseMessage |
38 | - svr = rbac.NewRbacService(nil) | ||
39 | - request = &protocolx.RoleAccessRequest{} | 39 | + svr = service.NewRbacService(nil) |
40 | + request = &query.RoleAccessRequest{} | ||
40 | ) | 41 | ) |
41 | defer func() { | 42 | defer func() { |
42 | this.Resp(msg) | 43 | this.Resp(msg) |
@@ -55,8 +56,8 @@ func (this *RbacController) RoleAccess() { | @@ -55,8 +56,8 @@ func (this *RbacController) RoleAccess() { | ||
55 | func (this *RbacController) SetRoleAccess() { | 56 | func (this *RbacController) SetRoleAccess() { |
56 | var ( | 57 | var ( |
57 | msg *protocol.ResponseMessage | 58 | msg *protocol.ResponseMessage |
58 | - svr = rbac.NewRbacService(nil) | ||
59 | - request *protocolx.SetRoleAccessRequest | 59 | + svr = service.NewRbacService(nil) |
60 | + request *command.SetRoleAccessRequest | ||
60 | ) | 61 | ) |
61 | defer func() { | 62 | defer func() { |
62 | this.Resp(msg) | 63 | this.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/role" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type RoleController struct { | 11 | type RoleController struct { |
@@ -16,8 +17,8 @@ type RoleController struct { | @@ -16,8 +17,8 @@ type RoleController struct { | ||
16 | func (this *RoleController) CreateRole() { | 17 | func (this *RoleController) CreateRole() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = role.NewRoleService(nil) | ||
20 | - request *protocolx.CreateRoleRequest | 20 | + svr = service.NewRoleService(nil) |
21 | + request *command.CreateRoleRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | this.Resp(msg) | 24 | this.Resp(msg) |
@@ -39,8 +40,8 @@ func (this *RoleController) CreateRole() { | @@ -39,8 +40,8 @@ func (this *RoleController) CreateRole() { | ||
39 | func (this *RoleController) UpdateRole() { | 40 | func (this *RoleController) UpdateRole() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = role.NewRoleService(nil) | ||
43 | - request *protocolx.UpdateRoleRequest | 43 | + svr = service.NewRoleService(nil) |
44 | + request *command.UpdateRoleRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | this.Resp(msg) | 47 | this.Resp(msg) |
@@ -63,8 +64,8 @@ func (this *RoleController) UpdateRole() { | @@ -63,8 +64,8 @@ func (this *RoleController) UpdateRole() { | ||
63 | func (this *RoleController) GetRole() { | 64 | func (this *RoleController) GetRole() { |
64 | var ( | 65 | var ( |
65 | msg *protocol.ResponseMessage | 66 | msg *protocol.ResponseMessage |
66 | - svr = role.NewRoleService(nil) | ||
67 | - request = &protocolx.GetRoleRequest{} | 67 | + svr = service.NewRoleService(nil) |
68 | + request = &query.GetRoleRequest{} | ||
68 | ) | 69 | ) |
69 | defer func() { | 70 | defer func() { |
70 | this.Resp(msg) | 71 | this.Resp(msg) |
@@ -87,8 +88,8 @@ func (this *RoleController) GetRole() { | @@ -87,8 +88,8 @@ func (this *RoleController) GetRole() { | ||
87 | func (this *RoleController) DeleteRole() { | 88 | func (this *RoleController) DeleteRole() { |
88 | var ( | 89 | var ( |
89 | msg *protocol.ResponseMessage | 90 | msg *protocol.ResponseMessage |
90 | - svr = role.NewRoleService(nil) | ||
91 | - request = &protocolx.DeleteRoleRequest{} | 91 | + svr = service.NewRoleService(nil) |
92 | + request = &command.DeleteRoleRequest{} | ||
92 | ) | 93 | ) |
93 | defer func() { | 94 | defer func() { |
94 | this.Resp(msg) | 95 | this.Resp(msg) |
@@ -107,8 +108,8 @@ func (this *RoleController) DeleteRole() { | @@ -107,8 +108,8 @@ func (this *RoleController) DeleteRole() { | ||
107 | func (this *RoleController) ListRole() { | 108 | func (this *RoleController) ListRole() { |
108 | var ( | 109 | var ( |
109 | msg *protocol.ResponseMessage | 110 | msg *protocol.ResponseMessage |
110 | - svr = role.NewRoleService(nil) | ||
111 | - request *protocolx.ListRoleRequest | 111 | + svr = service.NewRoleService(nil) |
112 | + request *query.ListRoleRequest | ||
112 | ) | 113 | ) |
113 | defer func() { | 114 | defer func() { |
114 | this.Resp(msg) | 115 | this.Resp(msg) |
@@ -2,9 +2,10 @@ package controllers | @@ -2,9 +2,10 @@ package controllers | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/pkg/log" | 4 | "github.com/tiptok/gocomm/pkg/log" |
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user" | 5 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/command" |
6 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/query" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/service" | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" | 8 | "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol" |
7 | - protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/user" | ||
8 | ) | 9 | ) |
9 | 10 | ||
10 | type UserController struct { | 11 | type UserController struct { |
@@ -16,8 +17,8 @@ type UserController struct { | @@ -16,8 +17,8 @@ type UserController struct { | ||
16 | func (controller *UserController) CreateUser() { | 17 | func (controller *UserController) CreateUser() { |
17 | var ( | 18 | var ( |
18 | msg *protocol.ResponseMessage | 19 | msg *protocol.ResponseMessage |
19 | - svr = user.NewUserService(nil) | ||
20 | - request *protocolx.CreateUserRequest | 20 | + svr = service.NewUserService(nil) |
21 | + request *command.CreateUserRequest | ||
21 | ) | 22 | ) |
22 | defer func() { | 23 | defer func() { |
23 | controller.Resp(msg) | 24 | controller.Resp(msg) |
@@ -39,8 +40,8 @@ func (controller *UserController) CreateUser() { | @@ -39,8 +40,8 @@ func (controller *UserController) CreateUser() { | ||
39 | func (controller *UserController) UpdateUser() { | 40 | func (controller *UserController) UpdateUser() { |
40 | var ( | 41 | var ( |
41 | msg *protocol.ResponseMessage | 42 | msg *protocol.ResponseMessage |
42 | - svr = user.NewUserService(nil) | ||
43 | - request *protocolx.UpdateUserRequest | 43 | + svr = service.NewUserService(nil) |
44 | + request *command.UpdateUserRequest | ||
44 | ) | 45 | ) |
45 | defer func() { | 46 | defer func() { |
46 | controller.Resp(msg) | 47 | controller.Resp(msg) |
@@ -63,8 +64,8 @@ func (controller *UserController) UpdateUser() { | @@ -63,8 +64,8 @@ func (controller *UserController) UpdateUser() { | ||
63 | func (controller *UserController) GetUser() { | 64 | func (controller *UserController) GetUser() { |
64 | var ( | 65 | var ( |
65 | msg *protocol.ResponseMessage | 66 | msg *protocol.ResponseMessage |
66 | - svr = user.NewUserService(nil) | ||
67 | - request = &protocolx.GetUserRequest{} | 67 | + svr = service.NewUserService(nil) |
68 | + request = &query.GetUserRequest{} | ||
68 | ) | 69 | ) |
69 | defer func() { | 70 | defer func() { |
70 | controller.Resp(msg) | 71 | controller.Resp(msg) |
@@ -83,8 +84,8 @@ func (controller *UserController) GetUser() { | @@ -83,8 +84,8 @@ func (controller *UserController) GetUser() { | ||
83 | func (controller *UserController) DeleteUser() { | 84 | func (controller *UserController) DeleteUser() { |
84 | var ( | 85 | var ( |
85 | msg *protocol.ResponseMessage | 86 | msg *protocol.ResponseMessage |
86 | - svr = user.NewUserService(nil) | ||
87 | - request = &protocolx.DeleteUserRequest{} | 87 | + svr = service.NewUserService(nil) |
88 | + request = &command.DeleteUserRequest{} | ||
88 | ) | 89 | ) |
89 | defer func() { | 90 | defer func() { |
90 | controller.Resp(msg) | 91 | controller.Resp(msg) |
@@ -103,8 +104,8 @@ func (controller *UserController) DeleteUser() { | @@ -103,8 +104,8 @@ func (controller *UserController) DeleteUser() { | ||
103 | func (controller *UserController) ListUser() { | 104 | func (controller *UserController) ListUser() { |
104 | var ( | 105 | var ( |
105 | msg *protocol.ResponseMessage | 106 | msg *protocol.ResponseMessage |
106 | - svr = user.NewUserService(nil) | ||
107 | - request = &protocolx.ListUserRequest{} | 107 | + svr = service.NewUserService(nil) |
108 | + request = &query.ListUserRequest{} | ||
108 | ) | 109 | ) |
109 | defer func() { | 110 | defer func() { |
110 | controller.Resp(msg) | 111 | controller.Resp(msg) |
pkg/port/beego/routers/menu_router.go
已删除
100644 → 0
1 | -package routers | ||
2 | - | ||
3 | -import ( | ||
4 | - "github.com/astaxie/beego" | ||
5 | - "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/port/beego/controllers" | ||
6 | -) | ||
7 | - | ||
8 | -func init() { | ||
9 | - beego.Router("/v1/menu/", &controllers.MenuController{}, "POST:CreateMenu") | ||
10 | - beego.Router("/v1/menu/:menuId", &controllers.MenuController{}, "PUT:UpdateMenu") | ||
11 | - beego.Router("/v1/menu/:menuId", &controllers.MenuController{}, "GET:GetMenu") | ||
12 | - beego.Router("/v1/menu/:menuId", &controllers.MenuController{}, "DELETE:DeleteMenu") | ||
13 | - beego.Router("/v1/menu/", &controllers.MenuController{}, "GET:ListMenu") | ||
14 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type CreateMenuRequest struct { | ||
9 | - // 菜单名称 | ||
10 | - MenuName string `json:"menuName,omitempty"` | ||
11 | - // 菜单编码 | ||
12 | - MenuCode string `json:"menuCode,omitempty"` | ||
13 | - // 图标 | ||
14 | - Icon string `json:"icon,omitempty"` | ||
15 | - // 排序 | ||
16 | - Sort int `json:"sort,omitempty"` | ||
17 | - // 是否隐藏: 1:隐藏 0:显示 | ||
18 | - Hidden bool `json:"hidden,omitempty"` | ||
19 | -} | ||
20 | - | ||
21 | -func (CreateMenuRequest *CreateMenuRequest) ValidateCommand() error { | ||
22 | - valid := validation.Validation{} | ||
23 | - b, err := valid.Valid(CreateMenuRequest) | ||
24 | - if err != nil { | ||
25 | - return err | ||
26 | - } | ||
27 | - if !b { | ||
28 | - for _, validErr := range valid.Errors { | ||
29 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
30 | - } | ||
31 | - } | ||
32 | - return nil | ||
33 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type CreateMenuResponse struct { | ||
9 | -} | ||
10 | - | ||
11 | -func (CreateMenuResponse *CreateMenuResponse) ValidateCommand() error { | ||
12 | - valid := validation.Validation{} | ||
13 | - b, err := valid.Valid(CreateMenuResponse) | ||
14 | - if err != nil { | ||
15 | - return err | ||
16 | - } | ||
17 | - if !b { | ||
18 | - for _, validErr := range valid.Errors { | ||
19 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
20 | - } | ||
21 | - } | ||
22 | - return nil | ||
23 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type DeleteMenuRequest struct { | ||
9 | - // 唯一标识 | ||
10 | - Id int64 `json:"id,omitempty"` | ||
11 | -} | ||
12 | - | ||
13 | -func (DeleteMenuRequest *DeleteMenuRequest) ValidateCommand() error { | ||
14 | - valid := validation.Validation{} | ||
15 | - b, err := valid.Valid(DeleteMenuRequest) | ||
16 | - if err != nil { | ||
17 | - return err | ||
18 | - } | ||
19 | - if !b { | ||
20 | - for _, validErr := range valid.Errors { | ||
21 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
22 | - } | ||
23 | - } | ||
24 | - return nil | ||
25 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type DeleteMenuResponse struct { | ||
9 | -} | ||
10 | - | ||
11 | -func (DeleteMenuResponse *DeleteMenuResponse) ValidateCommand() error { | ||
12 | - valid := validation.Validation{} | ||
13 | - b, err := valid.Valid(DeleteMenuResponse) | ||
14 | - if err != nil { | ||
15 | - return err | ||
16 | - } | ||
17 | - if !b { | ||
18 | - for _, validErr := range valid.Errors { | ||
19 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
20 | - } | ||
21 | - } | ||
22 | - return nil | ||
23 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type UpdateMenuRequest struct { | ||
9 | - // 菜单名称 | ||
10 | - MenuName string `json:"menuName,omitempty"` | ||
11 | - // 菜单编码 | ||
12 | - MenuCode string `json:"menuCode,omitempty"` | ||
13 | - // 图标 | ||
14 | - Icon string `json:"icon,omitempty"` | ||
15 | - // 排序 | ||
16 | - Sort int `json:"sort,omitempty"` | ||
17 | - // 是否隐藏: 1:隐藏 0:显示 | ||
18 | - Hidden bool `json:"hidden,omitempty"` | ||
19 | -} | ||
20 | - | ||
21 | -func (UpdateMenuRequest *UpdateMenuRequest) ValidateCommand() error { | ||
22 | - valid := validation.Validation{} | ||
23 | - b, err := valid.Valid(UpdateMenuRequest) | ||
24 | - if err != nil { | ||
25 | - return err | ||
26 | - } | ||
27 | - if !b { | ||
28 | - for _, validErr := range valid.Errors { | ||
29 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
30 | - } | ||
31 | - } | ||
32 | - return nil | ||
33 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type UpdateMenuResponse struct { | ||
9 | -} | ||
10 | - | ||
11 | -func (UpdateMenuResponse *UpdateMenuResponse) ValidateCommand() error { | ||
12 | - valid := validation.Validation{} | ||
13 | - b, err := valid.Valid(UpdateMenuResponse) | ||
14 | - if err != nil { | ||
15 | - return err | ||
16 | - } | ||
17 | - if !b { | ||
18 | - for _, validErr := range valid.Errors { | ||
19 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
20 | - } | ||
21 | - } | ||
22 | - return nil | ||
23 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type GetMenuRequest struct { | ||
9 | - // 唯一标识 | ||
10 | - Id int64 `json:"id,omitempty"` | ||
11 | -} | ||
12 | - | ||
13 | -func (GetMenuRequest *GetMenuRequest) ValidateCommand() error { | ||
14 | - valid := validation.Validation{} | ||
15 | - b, err := valid.Valid(GetMenuRequest) | ||
16 | - if err != nil { | ||
17 | - return err | ||
18 | - } | ||
19 | - if !b { | ||
20 | - for _, validErr := range valid.Errors { | ||
21 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
22 | - } | ||
23 | - } | ||
24 | - return nil | ||
25 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type GetMenuResponse struct { | ||
9 | -} | ||
10 | - | ||
11 | -func (GetMenuResponse *GetMenuResponse) ValidateCommand() error { | ||
12 | - valid := validation.Validation{} | ||
13 | - b, err := valid.Valid(GetMenuResponse) | ||
14 | - if err != nil { | ||
15 | - return err | ||
16 | - } | ||
17 | - if !b { | ||
18 | - for _, validErr := range valid.Errors { | ||
19 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
20 | - } | ||
21 | - } | ||
22 | - return nil | ||
23 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type ListMenuRequest struct { | ||
9 | -} | ||
10 | - | ||
11 | -func (ListMenuRequest *ListMenuRequest) ValidateCommand() error { | ||
12 | - valid := validation.Validation{} | ||
13 | - b, err := valid.Valid(ListMenuRequest) | ||
14 | - if err != nil { | ||
15 | - return err | ||
16 | - } | ||
17 | - if !b { | ||
18 | - for _, validErr := range valid.Errors { | ||
19 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
20 | - } | ||
21 | - } | ||
22 | - return nil | ||
23 | -} |
1 | -package menu | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - "github.com/astaxie/beego/validation" | ||
6 | -) | ||
7 | - | ||
8 | -type ListMenuResponse struct { | ||
9 | -} | ||
10 | - | ||
11 | -func (ListMenuResponse *ListMenuResponse) ValidateCommand() error { | ||
12 | - valid := validation.Validation{} | ||
13 | - b, err := valid.Valid(ListMenuResponse) | ||
14 | - if err != nil { | ||
15 | - return err | ||
16 | - } | ||
17 | - if !b { | ||
18 | - for _, validErr := range valid.Errors { | ||
19 | - return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
20 | - } | ||
21 | - } | ||
22 | - return nil | ||
23 | -} |
-
请 注册 或 登录 后发表评论