|
@@ -357,8 +357,6 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
@@ -357,8 +357,6 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
357
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
357
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
358
|
imInfo *domain.ImInfo
|
358
|
imInfo *domain.ImInfo
|
359
|
loginSvr = domain_service.NewPgLoginService(transactionContext)
|
359
|
loginSvr = domain_service.NewPgLoginService(transactionContext)
|
360
|
- //isSenior bool
|
|
|
361
|
- //isPartner bool
|
|
|
362
|
)
|
360
|
)
|
363
|
|
361
|
|
364
|
// 转换手机号码
|
362
|
// 转换手机号码
|
|
@@ -391,29 +389,25 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
@@ -391,29 +389,25 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
391
|
|
389
|
|
392
|
// loginSvr 初始化
|
390
|
// loginSvr 初始化
|
393
|
_ = loginSvr.Init(request.Phone)
|
391
|
_ = loginSvr.Init(request.Phone)
|
394
|
- if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 {
|
|
|
395
|
- err = protocol.NewErrWithMessage(10001)
|
|
|
396
|
- return
|
|
|
397
|
- }
|
|
|
398
|
|
392
|
|
399
|
// 高管标志位初始化
|
393
|
// 高管标志位初始化
|
400
|
_ = loginSvr.InitSenior(request.Phone)
|
394
|
_ = loginSvr.InitSenior(request.Phone)
|
401
|
- //if len(loginSvr.IsSenior) == 0 {
|
|
|
402
|
- // isSenior = false
|
|
|
403
|
- //} else {
|
|
|
404
|
- // isSenior = true
|
|
|
405
|
- //}
|
|
|
406
|
|
395
|
|
407
|
// 合伙人标志位初始化
|
396
|
// 合伙人标志位初始化
|
408
|
_ = loginSvr.InitPartner(request.Phone)
|
397
|
_ = loginSvr.InitPartner(request.Phone)
|
409
|
- //if len(loginSvr.IsPartnerInfo) == 0 {
|
|
|
410
|
- // isPartner = false
|
|
|
411
|
- //} else {
|
|
|
412
|
- // isPartner = true
|
|
|
413
|
- //}
|
|
|
414
|
|
398
|
|
415
|
- //fmt.Print(isPartner, "\n")
|
|
|
416
|
- //fmt.Print(isSenior, "\n")
|
399
|
+ // 普通合伙人标志位
|
|
|
400
|
+ _ = loginSvr.InitNormal(request.Phone)
|
|
|
401
|
+
|
|
|
402
|
+ if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 && len(loginSvr.NormalPartnerInfo) == 0 {
|
|
|
403
|
+ err = protocol.NewErrWithMessage(10001)
|
|
|
404
|
+ return
|
|
|
405
|
+ }
|
|
|
406
|
+
|
|
|
407
|
+ if len(loginSvr.PartnerInfo) == 0 {
|
|
|
408
|
+ err = protocol.NewErrWithMessage(10008)
|
|
|
409
|
+ return
|
|
|
410
|
+ }
|
417
|
|
411
|
|
418
|
switch request.GrantType {
|
412
|
switch request.GrantType {
|
419
|
case protocol.LoginByPassword:
|
413
|
case protocol.LoginByPassword:
|
|
@@ -480,39 +474,6 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
@@ -480,39 +474,6 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
480
|
// 添加手机对应的凭证
|
474
|
// 添加手机对应的凭证
|
481
|
userAuth.NewRedisUserCredential(request.Phone).AddAuth(rsp.Credentials)
|
475
|
userAuth.NewRedisUserCredential(request.Phone).AddAuth(rsp.Credentials)
|
482
|
|
476
|
|
483
|
- // 判断是否高管
|
|
|
484
|
- //if isSenior && isPartner { // 高管且合伙人
|
|
|
485
|
- // v = map[string]interface{}{"center": rsp}
|
|
|
486
|
- //} else if isSenior && !isPartner { // 高管非合伙人
|
|
|
487
|
- // var companies []interface{}
|
|
|
488
|
- // if len(rsp.Manager.(map[string]interface{})["companys"].([]protocol.CompanyBase)) > 0 {
|
|
|
489
|
- // for _, company := range rsp.Manager.(map[string]interface{})["companys"].([]protocol.CompanyBase) {
|
|
|
490
|
- // companies = append(companies, company)
|
|
|
491
|
- // }
|
|
|
492
|
- // } else {
|
|
|
493
|
- // companies = []interface{}{}
|
|
|
494
|
- // }
|
|
|
495
|
- //
|
|
|
496
|
- // rsp.Partner.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
497
|
- // rsp.Manager.(map[string]interface{})["companys"] = companies
|
|
|
498
|
- //
|
|
|
499
|
- // v = map[string]interface{}{"center": rsp}
|
|
|
500
|
- //} else { // 非高管合伙人
|
|
|
501
|
- // var companies []interface{}
|
|
|
502
|
- // if len(rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company)) > 0 {
|
|
|
503
|
- // for _, company := range rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company) {
|
|
|
504
|
- // companies = append(companies, company)
|
|
|
505
|
- // }
|
|
|
506
|
- // } else {
|
|
|
507
|
- // companies = []interface{}{}
|
|
|
508
|
- // }
|
|
|
509
|
- //
|
|
|
510
|
- // rsp.Partner.(map[string]interface{})["companys"] = companies
|
|
|
511
|
- // rsp.Manager.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
512
|
- //
|
|
|
513
|
- // v = map[string]interface{}{"center": rsp}
|
|
|
514
|
- //}
|
|
|
515
|
-
|
|
|
516
|
v = map[string]interface{}{"center": rsp}
|
477
|
v = map[string]interface{}{"center": rsp}
|
517
|
|
478
|
|
518
|
err = transactionContext.CommitTransaction()
|
479
|
err = transactionContext.CommitTransaction()
|
|
@@ -531,8 +492,6 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco |
|
@@ -531,8 +492,6 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco |
531
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
492
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
532
|
loginSvr = domain_service.NewPgLoginService(transactionContext)
|
493
|
loginSvr = domain_service.NewPgLoginService(transactionContext)
|
533
|
claim *utils.UserTokenClaims
|
494
|
claim *utils.UserTokenClaims
|
534
|
- //isSenior bool
|
|
|
535
|
- //isPartner bool
|
|
|
536
|
)
|
495
|
)
|
537
|
rsp = &protocolx.CompanysResponse{}
|
496
|
rsp = &protocolx.CompanysResponse{}
|
538
|
if err = transactionContext.StartTransaction(); err != nil {
|
497
|
if err = transactionContext.StartTransaction(); err != nil {
|
|
@@ -562,38 +521,13 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco |
|
@@ -562,38 +521,13 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco |
562
|
|
521
|
|
563
|
// 高管标志位初始化
|
522
|
// 高管标志位初始化
|
564
|
_ = loginSvr.InitSenior(claim.Phone)
|
523
|
_ = loginSvr.InitSenior(claim.Phone)
|
565
|
- //if len(loginSvr.IsSenior) == 0 {
|
|
|
566
|
- // isSenior = false
|
|
|
567
|
- //} else {
|
|
|
568
|
- // isSenior = true
|
|
|
569
|
- //}
|
|
|
570
|
|
524
|
|
571
|
// 合伙人标志位初始化
|
525
|
// 合伙人标志位初始化
|
572
|
_ = loginSvr.InitPartner(claim.Phone)
|
526
|
_ = loginSvr.InitPartner(claim.Phone)
|
573
|
- //if len(loginSvr.IsPartnerInfo) == 0 {
|
|
|
574
|
- // isPartner = false
|
|
|
575
|
- //} else {
|
|
|
576
|
- // isPartner = true
|
|
|
577
|
- //}
|
|
|
578
|
|
527
|
|
579
|
rsp.Partner, _ = loginSvr.PartnerStaticInfo()
|
528
|
rsp.Partner, _ = loginSvr.PartnerStaticInfo()
|
580
|
rsp.Manager, _ = loginSvr.ManagerStaticInfo()
|
529
|
rsp.Manager, _ = loginSvr.ManagerStaticInfo()
|
581
|
|
530
|
|
582
|
- //if !isSenior { // 非高管普通用户, 显示游客公司
|
|
|
583
|
- // var companies []interface{}
|
|
|
584
|
- // if len(rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company)) > 0 {
|
|
|
585
|
- // for _, company := range rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company) {
|
|
|
586
|
- // companies = append(companies, company)
|
|
|
587
|
- // }
|
|
|
588
|
- // } else {
|
|
|
589
|
- // companies = []interface{}{}
|
|
|
590
|
- // }
|
|
|
591
|
- // rsp.Partner.(map[string]interface{})["companys"] = companies
|
|
|
592
|
- // rsp.Manager.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
593
|
- //} else if isSenior && !isPartner { // 高管非合伙人,显示高管公司
|
|
|
594
|
- // rsp.Partner.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
595
|
- //}
|
|
|
596
|
-
|
|
|
597
|
if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany {
|
531
|
if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany {
|
598
|
err = protocol.NewErrWithMessage(4140, err) //账号禁用
|
532
|
err = protocol.NewErrWithMessage(4140, err) //账号禁用
|
599
|
return
|
533
|
return
|