123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package entity
- import (
- "context"
- "github.com/zeromicro/go-zero/core/logx"
- powerCheck "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
- resource "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
- )
- type UserInfoRpc struct {
- AppId string //appId 剑鱼 10000
- UserId string //用户id
- BaseUserId int64 //用户基本id
- EntId int64 //企业id
- EntUserId int64 //企业用户id
- AccountId int64 //账户id
- EntAccountId int64 //企业账户id
- PositionType int64 //职位类型 @个人 1企业
- PositionId int64 //职位id
- MgoUserId string //原userId
- }
- // GetUserResources 获取用户资源信息
- func (ui *UserInfoRpc) GetUserResources() []string {
- req := &resource.HaspowersReq{
- AccountId: ui.AccountId,
- EntAccountId: ui.EntAccountId,
- EntId: ui.EntId,
- EntUserId: ui.EntUserId,
- Appid: ui.AppId,
- }
- powerList, err := ResourceLib.Haspowers(context.Background(), req)
- if err == nil && len(powerList.Powers) > 0 {
- return powerList.Powers
- }
- return []string{}
- }
- // GetUserPowers 获取用户权益信息
- func (ui *UserInfoRpc) GetUserPowers() *powerCheck.CheckResp {
- req := &powerCheck.CheckReq{
- Appid: ui.AppId,
- Userid: ui.MgoUserId,
- BaseUserId: ui.BaseUserId,
- AccountId: ui.AccountId,
- EntId: ui.EntId,
- PositionType: ui.PositionType,
- PositionId: ui.PositionId,
- }
- logx.Info("--------req:-------------------------:", req)
- checkResp, err := PowerCheck.Check(context.Background(), req)
- if err == nil {
- return checkResp
- }
- return nil
- }
|