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