|
@@ -196,25 +196,33 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
@@ -196,25 +196,33 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
196
|
UsersRepository, _ = factory.CreateUsersRepository(transactionContext)
|
196
|
UsersRepository, _ = factory.CreateUsersRepository(transactionContext)
|
197
|
company *domain.Company
|
197
|
company *domain.Company
|
198
|
user *domain.Users
|
198
|
user *domain.Users
|
|
|
199
|
+ loginSvr = domain_service.NewPgLoginService(transactionContext)
|
199
|
)
|
200
|
)
|
|
|
201
|
+
|
200
|
if err = transactionContext.StartTransaction(); err != nil {
|
202
|
if err = transactionContext.StartTransaction(); err != nil {
|
201
|
return nil, err
|
203
|
return nil, err
|
202
|
}
|
204
|
}
|
|
|
205
|
+
|
203
|
defer func() {
|
206
|
defer func() {
|
204
|
transactionContext.RollbackTransaction()
|
207
|
transactionContext.RollbackTransaction()
|
205
|
}()
|
208
|
}()
|
|
|
209
|
+
|
206
|
rsp = &protocol.UserInfoResponse{}
|
210
|
rsp = &protocol.UserInfoResponse{}
|
207
|
rspMap := make(map[string]interface{})
|
211
|
rspMap := make(map[string]interface{})
|
208
|
|
212
|
|
|
|
213
|
+ // 获取合伙人信息
|
209
|
funcPartnerInfo := func() {
|
214
|
funcPartnerInfo := func() {
|
210
|
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
215
|
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
211
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
216
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
212
|
return
|
217
|
return
|
213
|
}
|
218
|
}
|
|
|
219
|
+
|
214
|
if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
|
220
|
if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
|
215
|
return
|
221
|
return
|
216
|
}
|
222
|
}
|
|
|
223
|
+
|
217
|
var miniProgram map[string]interface{}
|
224
|
var miniProgram map[string]interface{}
|
|
|
225
|
+
|
218
|
if len(company.Applets) > 0 {
|
226
|
if len(company.Applets) > 0 {
|
219
|
if company.Applets[0].Valid() {
|
227
|
if company.Applets[0].Valid() {
|
220
|
miniProgram = make(map[string]interface{})
|
228
|
miniProgram = make(map[string]interface{})
|
|
@@ -228,6 +236,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
@@ -228,6 +236,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
228
|
miniProgram["title"] = company.Applets[0].Name
|
236
|
miniProgram["title"] = company.Applets[0].Name
|
229
|
}
|
237
|
}
|
230
|
}
|
238
|
}
|
|
|
239
|
+
|
231
|
u := userx.User{
|
240
|
u := userx.User{
|
232
|
Id: partnerInfo.Id,
|
241
|
Id: partnerInfo.Id,
|
233
|
PartnerName: partnerInfo.PartnerName,
|
242
|
PartnerName: partnerInfo.PartnerName,
|
|
@@ -265,18 +274,22 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
@@ -265,18 +274,22 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
265
|
} else {
|
274
|
} else {
|
266
|
u.CooperateCompany.Salesman = map[string]interface{}{}
|
275
|
u.CooperateCompany.Salesman = map[string]interface{}{}
|
267
|
}
|
276
|
}
|
|
|
277
|
+
|
268
|
rspMap["user"] = u
|
278
|
rspMap["user"] = u
|
269
|
rsp = rspMap
|
279
|
rsp = rspMap
|
270
|
}
|
280
|
}
|
271
|
|
281
|
|
|
|
282
|
+ // 获取管理员信息
|
272
|
funcManagerInfo := func() {
|
283
|
funcManagerInfo := func() {
|
273
|
if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
284
|
if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
274
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
285
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
275
|
return
|
286
|
return
|
276
|
}
|
287
|
}
|
|
|
288
|
+
|
277
|
if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
|
289
|
if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
|
278
|
return
|
290
|
return
|
279
|
}
|
291
|
}
|
|
|
292
|
+
|
280
|
rspMap["user"] = userx.User{
|
293
|
rspMap["user"] = userx.User{
|
281
|
Id: user.Id,
|
294
|
Id: user.Id,
|
282
|
PartnerName: user.Name,
|
295
|
PartnerName: user.Name,
|
|
@@ -288,12 +301,26 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
@@ -288,12 +301,26 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
288
|
MiniProgram: nil,
|
301
|
MiniProgram: nil,
|
289
|
},
|
302
|
},
|
290
|
}
|
303
|
}
|
|
|
304
|
+
|
291
|
rsp = rspMap
|
305
|
rsp = rspMap
|
292
|
}
|
306
|
}
|
293
|
|
307
|
|
|
|
308
|
+ phone := strconv.Itoa(header.SimNum)
|
|
|
309
|
+
|
|
|
310
|
+ // 判断是否高管
|
|
|
311
|
+ ok, loginErr := loginSvr.CheckIsSenior(phone, 0)
|
|
|
312
|
+ if loginErr != nil {
|
|
|
313
|
+ err = protocol.NewErrWithMessage(10001)
|
|
|
314
|
+ return
|
|
|
315
|
+ }
|
|
|
316
|
+
|
294
|
switch header.AdminType {
|
317
|
switch header.AdminType {
|
295
|
case int(protocolx.AdminTypePartner):
|
318
|
case int(protocolx.AdminTypePartner):
|
296
|
- funcPartnerInfo()
|
319
|
+ if ok { // 身份为高管,则默认登录合伙人
|
|
|
320
|
+ funcPartnerInfo()
|
|
|
321
|
+ } else { // 身份非高管
|
|
|
322
|
+ funcManagerInfo()
|
|
|
323
|
+ }
|
297
|
break
|
324
|
break
|
298
|
case int(protocolx.AdminTypeManager):
|
325
|
case int(protocolx.AdminTypeManager):
|
299
|
funcManagerInfo()
|
326
|
funcManagerInfo()
|
|
@@ -302,6 +329,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
@@ -302,6 +329,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
302
|
funcPartnerInfo()
|
329
|
funcPartnerInfo()
|
303
|
break
|
330
|
break
|
304
|
}
|
331
|
}
|
|
|
332
|
+
|
305
|
err = transactionContext.CommitTransaction()
|
333
|
err = transactionContext.CommitTransaction()
|
306
|
return
|
334
|
return
|
307
|
}
|
335
|
}
|