正在显示
100 个修改的文件
包含
204 行增加
和
364 行删除
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 | } |
-
请 注册 或 登录 后发表评论