正在显示
6 个修改的文件
包含
44 行增加
和
8 行删除
@@ -253,7 +253,7 @@ func Revoke(header *protocol.RequestHeader, request *protocol.RevokeRequest) (rs | @@ -253,7 +253,7 @@ func Revoke(header *protocol.RequestHeader, request *protocol.RevokeRequest) (rs | ||
253 | return | 253 | return |
254 | } | 254 | } |
255 | 255 | ||
256 | -func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCompanysRequest) (rsp *protocolx.CenterCompanysResponse, err error) { | 256 | +func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCompanysRequest) (v interface{}, err error) { |
257 | var ( | 257 | var ( |
258 | transactionContext, _ = factory.CreateTransactionContext(nil) | 258 | transactionContext, _ = factory.CreateTransactionContext(nil) |
259 | imInfo *domain.ImInfo | 259 | imInfo *domain.ImInfo |
@@ -265,7 +265,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -265,7 +265,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
265 | e = protocol.NewErrWithMessage(2) | 265 | e = protocol.NewErrWithMessage(2) |
266 | return | 266 | return |
267 | } | 267 | } |
268 | - rsp = &protocolx.CenterCompanysResponse{} | 268 | + rsp := &protocolx.CenterCompanysResponse{} |
269 | if err = transactionContext.StartTransaction(); err != nil { | 269 | if err = transactionContext.StartTransaction(); err != nil { |
270 | log.Error(err) | 270 | log.Error(err) |
271 | return nil, err | 271 | return nil, err |
@@ -326,6 +326,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -326,6 +326,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
326 | rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second) | 326 | rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second) |
327 | 327 | ||
328 | err = transactionContext.CommitTransaction() | 328 | err = transactionContext.CommitTransaction() |
329 | + v = map[string]interface{}{"center": rsp} | ||
329 | return | 330 | return |
330 | } | 331 | } |
331 | 332 |
@@ -47,7 +47,10 @@ func Partners(header *protocol.RequestHeader, request *protocolx.PartnersRequest | @@ -47,7 +47,10 @@ func Partners(header *protocol.RequestHeader, request *protocolx.PartnersRequest | ||
47 | defer func() { | 47 | defer func() { |
48 | transactionContext.RollbackTransaction() | 48 | transactionContext.RollbackTransaction() |
49 | }() | 49 | }() |
50 | - | 50 | + if rsp.Partners, err = getPartners(header.UserId, request, transactionContext); err != nil { |
51 | + log.Error(err) | ||
52 | + return | ||
53 | + } | ||
51 | err = transactionContext.CommitTransaction() | 54 | err = transactionContext.CommitTransaction() |
52 | return | 55 | return |
53 | } | 56 | } |
@@ -175,3 +178,18 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont | @@ -175,3 +178,18 @@ func getStatistics(userId int64, transactionContext *transaction.TransactionCont | ||
175 | Statistics["appOrdersMoney"] = 0 | 178 | Statistics["appOrdersMoney"] = 0 |
176 | return Statistics, nil | 179 | return Statistics, nil |
177 | } | 180 | } |
181 | + | ||
182 | +func getPartners(userId int64, request *protocolx.PartnersRequest, transactionContext *transaction.TransactionContext) (interface{}, error) { | ||
183 | + var ( | ||
184 | + UsersRepository, _ = factory.CreateUsersRepository(transactionContext) | ||
185 | + user *domain.Users | ||
186 | + err error | ||
187 | + ) | ||
188 | + if user, err = UsersRepository.FindOne(map[string]interface{}{"id": userId}); err != nil { | ||
189 | + return nil, err | ||
190 | + } | ||
191 | + if len(user.AccessPartnerIds()) == 0 { | ||
192 | + return nil, nil | ||
193 | + } | ||
194 | + return nil, nil | ||
195 | +} |
@@ -128,7 +128,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -128,7 +128,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
128 | 128 | ||
129 | response := make(map[string]interface{}) | 129 | response := make(map[string]interface{}) |
130 | response["id"] = protocolx.AdminTypePartner | 130 | response["id"] = protocolx.AdminTypePartner |
131 | - response["name"] = svr.PartnerInfo[0].PartnerName | 131 | + response["name"] = protocolx.AdminTypePartnerName |
132 | response["companys"] = companys | 132 | response["companys"] = companys |
133 | return response, nil | 133 | return response, nil |
134 | } | 134 | } |
@@ -163,7 +163,7 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -163,7 +163,7 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
163 | 163 | ||
164 | response := make(map[string]interface{}) | 164 | response := make(map[string]interface{}) |
165 | response["id"] = protocolx.AdminTypeManager | 165 | response["id"] = protocolx.AdminTypeManager |
166 | - response["name"] = svr.PartnerInfo[0].PartnerName | 166 | + response["name"] = protocolx.AdminTypeManagerName |
167 | response["companys"] = companys | 167 | response["companys"] = companys |
168 | return response, nil | 168 | return response, nil |
169 | } | 169 | } |
1 | package company | 1 | package company |
2 | 2 | ||
3 | type PartnersRequest struct { | 3 | type PartnersRequest struct { |
4 | - // 唯一标识 | ||
5 | - Id int64 `json:"id"` | 4 | + // 页码索引(0开始) |
5 | + PageIndex int `json:"pageIndex"` | ||
6 | + // 每页数量 | ||
7 | + PageSize int `json:"pageSize" valid:"required"` | ||
8 | + // 起始时间戳 | ||
9 | + StartTime int64 `json:"startTime"` | ||
10 | + // 结束时间戳 | ||
11 | + EndTime int64 `json:"endTime"` | ||
12 | + // 区域(空或不传,即所有区域) | ||
13 | + Districts []Districts `json:"districts"` | ||
14 | + // 合作类型(空或不传,即所有类型) | ||
15 | + JoinWays []JoinWays `json:"joinWays"` | ||
16 | + // 分红排序(0.从多到少 1.从少到多) | ||
17 | + SortBy int `json:"sortBy"` | ||
6 | } | 18 | } |
-
请 注册 或 登录 后发表评论