作者 陈志颖

合并分支 'dev' 到 'test'

fix:禁用用户权限修改



查看合并请求 !37
... ... @@ -357,8 +357,8 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom
transactionContext, _ = factory.CreateTransactionContext(nil)
imInfo *domain.ImInfo
loginSvr = domain_service.NewPgLoginService(transactionContext)
isSenior bool
isPartner bool
//isSenior bool
//isPartner bool
)
// 转换手机号码
... ... @@ -398,22 +398,22 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom
// 高管标志位初始化
_ = loginSvr.InitSenior(request.Phone)
if len(loginSvr.IsSenior) == 0 {
isSenior = false
} else {
isSenior = true
}
//if len(loginSvr.IsSenior) == 0 {
// isSenior = false
//} else {
// isSenior = true
//}
// 合伙人标志位初始化
_ = loginSvr.InitPartner(request.Phone)
if len(loginSvr.IsPartnerInfo) == 0 {
isPartner = false
} else {
isPartner = true
}
//if len(loginSvr.IsPartnerInfo) == 0 {
// isPartner = false
//} else {
// isPartner = true
//}
fmt.Print(isPartner, "\n")
fmt.Print(isSenior, "\n")
//fmt.Print(isPartner, "\n")
//fmt.Print(isSenior, "\n")
switch request.GrantType {
case protocol.LoginByPassword:
... ... @@ -481,39 +481,39 @@ 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 rsp.Manager.(map[string]interface{})["companys"] != nil {
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 rsp.Partner.(map[string]interface{})["companys"] != nil {
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{}{}
//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}
}
v = map[string]interface{}{"center": rsp}
err = transactionContext.CommitTransaction()
return
... ... @@ -531,8 +531,8 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco
transactionContext, _ = factory.CreateTransactionContext(nil)
loginSvr = domain_service.NewPgLoginService(transactionContext)
claim *utils.UserTokenClaims
isSenior bool
isPartner bool
//isSenior bool
//isPartner bool
)
rsp = &protocolx.CompanysResponse{}
if err = transactionContext.StartTransaction(); err != nil {
... ... @@ -562,38 +562,37 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco
// 高管标志位初始化
_ = loginSvr.InitSenior(claim.Phone)
if len(loginSvr.IsSenior) == 0 {
isSenior = false
} else {
isSenior = true
}
//if len(loginSvr.IsSenior) == 0 {
// isSenior = false
//} else {
// isSenior = true
//}
// 合伙人标志位初始化
_ = loginSvr.InitPartner(claim.Phone)
if len(loginSvr.IsPartnerInfo) == 0 {
isPartner = false
} else {
isPartner = true
}
//if len(loginSvr.IsPartnerInfo) == 0 {
// isPartner = false
//} else {
// isPartner = true
//}
rsp.Partner, _ = loginSvr.PartnerStaticInfo()
rsp.Manager, _ = loginSvr.ManagerStaticInfo()
if !isSenior { // 非高管普通用户, 显示游客公司
var companies []interface{}
if rsp.Partner.(map[string]interface{})["companys"] != nil {
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 !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) //账号禁用
... ...
... ... @@ -427,7 +427,8 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
// 合伙人存在、用户存在、是高管(高管合伙人)
// 合伙人不存在、用户存在、是高管(高管)|| partnerInfo == nil && user != nil && senior != nil
// 合伙人存在、用户存在、非高管(合伙人)
if partnerInfo != nil && user != nil && senior != nil || partnerInfo != nil && user != nil && senior == nil {
// 游客公司合伙人存在
if partnerInfo != nil && user != nil && senior != nil || partnerInfo != nil && user != nil && senior == nil || guestInfo != nil {
return nil
}
... ...