...
|
...
|
@@ -357,8 +357,6 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
imInfo *domain.ImInfo
|
|
|
loginSvr = domain_service.NewPgLoginService(transactionContext)
|
|
|
//isSenior bool
|
|
|
//isPartner bool
|
|
|
)
|
|
|
|
|
|
// 转换手机号码
|
...
|
...
|
@@ -391,29 +389,25 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
|
|
|
|
// loginSvr 初始化
|
|
|
_ = loginSvr.Init(request.Phone)
|
|
|
if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 {
|
|
|
err = protocol.NewErrWithMessage(10001)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 高管标志位初始化
|
|
|
_ = loginSvr.InitSenior(request.Phone)
|
|
|
//if len(loginSvr.IsSenior) == 0 {
|
|
|
// isSenior = false
|
|
|
//} else {
|
|
|
// isSenior = true
|
|
|
//}
|
|
|
|
|
|
// 合伙人标志位初始化
|
|
|
_ = loginSvr.InitPartner(request.Phone)
|
|
|
//if len(loginSvr.IsPartnerInfo) == 0 {
|
|
|
// isPartner = false
|
|
|
//} else {
|
|
|
// isPartner = true
|
|
|
//}
|
|
|
|
|
|
//fmt.Print(isPartner, "\n")
|
|
|
//fmt.Print(isSenior, "\n")
|
|
|
// 普通合伙人标志位
|
|
|
_ = loginSvr.InitNormal(request.Phone)
|
|
|
|
|
|
if len(loginSvr.Users) == 0 && len(loginSvr.PartnerInfo) == 0 && len(loginSvr.NormalPartnerInfo) == 0 {
|
|
|
err = protocol.NewErrWithMessage(10001)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if len(loginSvr.PartnerInfo) == 0 {
|
|
|
err = protocol.NewErrWithMessage(10008)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
switch request.GrantType {
|
|
|
case protocol.LoginByPassword:
|
...
|
...
|
@@ -480,39 +474,6 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
|
// 添加手机对应的凭证
|
|
|
userAuth.NewRedisUserCredential(request.Phone).AddAuth(rsp.Credentials)
|
|
|
|
|
|
// 判断是否高管
|
|
|
//if isSenior && isPartner { // 高管且合伙人
|
|
|
// v = map[string]interface{}{"center": rsp}
|
|
|
//} else if isSenior && !isPartner { // 高管非合伙人
|
|
|
// var companies []interface{}
|
|
|
// if len(rsp.Manager.(map[string]interface{})["companys"].([]protocol.CompanyBase)) > 0 {
|
|
|
// for _, company := range rsp.Manager.(map[string]interface{})["companys"].([]protocol.CompanyBase) {
|
|
|
// companies = append(companies, company)
|
|
|
// }
|
|
|
// } else {
|
|
|
// companies = []interface{}{}
|
|
|
// }
|
|
|
//
|
|
|
// rsp.Partner.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
// rsp.Manager.(map[string]interface{})["companys"] = companies
|
|
|
//
|
|
|
// v = map[string]interface{}{"center": rsp}
|
|
|
//} else { // 非高管合伙人
|
|
|
// var companies []interface{}
|
|
|
// if len(rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company)) > 0 {
|
|
|
// for _, company := range rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company) {
|
|
|
// companies = append(companies, company)
|
|
|
// }
|
|
|
// } else {
|
|
|
// companies = []interface{}{}
|
|
|
// }
|
|
|
//
|
|
|
// rsp.Partner.(map[string]interface{})["companys"] = companies
|
|
|
// rsp.Manager.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
//
|
|
|
// v = map[string]interface{}{"center": rsp}
|
|
|
//}
|
|
|
|
|
|
v = map[string]interface{}{"center": rsp}
|
|
|
|
|
|
err = transactionContext.CommitTransaction()
|
...
|
...
|
@@ -531,8 +492,6 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco |
|
|
transactionContext, _ = factory.CreateTransactionContext(nil)
|
|
|
loginSvr = domain_service.NewPgLoginService(transactionContext)
|
|
|
claim *utils.UserTokenClaims
|
|
|
//isSenior bool
|
|
|
//isPartner bool
|
|
|
)
|
|
|
rsp = &protocolx.CompanysResponse{}
|
|
|
if err = transactionContext.StartTransaction(); err != nil {
|
...
|
...
|
@@ -562,38 +521,13 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco |
|
|
|
|
|
// 高管标志位初始化
|
|
|
_ = loginSvr.InitSenior(claim.Phone)
|
|
|
//if len(loginSvr.IsSenior) == 0 {
|
|
|
// isSenior = false
|
|
|
//} else {
|
|
|
// isSenior = true
|
|
|
//}
|
|
|
|
|
|
// 合伙人标志位初始化
|
|
|
_ = loginSvr.InitPartner(claim.Phone)
|
|
|
//if len(loginSvr.IsPartnerInfo) == 0 {
|
|
|
// isPartner = false
|
|
|
//} else {
|
|
|
// isPartner = true
|
|
|
//}
|
|
|
|
|
|
rsp.Partner, _ = loginSvr.PartnerStaticInfo()
|
|
|
rsp.Manager, _ = loginSvr.ManagerStaticInfo()
|
|
|
|
|
|
//if !isSenior { // 非高管普通用户, 显示游客公司
|
|
|
// var companies []interface{}
|
|
|
// if len(rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company)) > 0 {
|
|
|
// for _, company := range rsp.Partner.(map[string]interface{})["companys"].([]*domain_service.Company) {
|
|
|
// companies = append(companies, company)
|
|
|
// }
|
|
|
// } else {
|
|
|
// companies = []interface{}{}
|
|
|
// }
|
|
|
// rsp.Partner.(map[string]interface{})["companys"] = companies
|
|
|
// rsp.Manager.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
//} else if isSenior && !isPartner { // 高管非合伙人,显示高管公司
|
|
|
// rsp.Partner.(map[string]interface{})["companys"] = []struct{}{}
|
|
|
//}
|
|
|
|
|
|
if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany {
|
|
|
err = protocol.NewErrWithMessage(4140, err) //账号禁用
|
|
|
return
|
...
|
...
|
|