...
|
...
|
@@ -275,25 +275,23 @@ func SwitchCompany(header *protocol.RequestHeader, request *protocol.SwitchCompa |
|
|
//用户信息
|
|
|
func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
|
|
|
var (
|
|
|
companyId int64
|
|
|
userCompany *models.UserCompany
|
|
|
userAuth *models.UserAuth
|
|
|
userBaseAgg *protocol.UserBaseInfoAggregation
|
|
|
companys []*models.Company
|
|
|
companyId int64
|
|
|
userCompany *models.UserCompany
|
|
|
userAuth *models.UserAuth
|
|
|
userBaseAgg *protocol.UserBaseInfoAggregation
|
|
|
companys []*models.Company
|
|
|
userCompanys []*models.UserCompany
|
|
|
)
|
|
|
if companys, err = models.GetCompanyByPermission(header.Uid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//保证用户登录期间公司有权限
|
|
|
//if len(companys) == 0 {
|
|
|
// //无权限
|
|
|
// err = protocol.NewErrWithMessage(2002)
|
|
|
// return
|
|
|
//}
|
|
|
for i := range companys {
|
|
|
if companys[i].Id == header.CompanyId {
|
|
|
if userCompanys, err = models.GetUserAllCompany(header.Uid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
for i := range userCompanys {
|
|
|
if userCompanys[i].Id == header.UserId && userCompanys[i].CompanyId == header.CompanyId {
|
|
|
companyId = header.CompanyId
|
|
|
break
|
|
|
}
|
...
|
...
|
|