12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package entity
- import (
- "context"
- 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,
- }
- checkResp, err := PowerCheck.Check(context.Background(), req)
- if err == nil {
- return checkResp
- }
- return nil
- }
|