source.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package entity
  2. import (
  3. powerCheck "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
  4. resource "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  5. "context"
  6. )
  7. type UserInfoRpc struct {
  8. AppId string //appId 剑鱼 10000
  9. UserId string //用户id
  10. BaseUserId int64 //用户基本id
  11. EntId int64 //企业id
  12. EntUserId int64 //企业用户id
  13. AccountId int64 //账户id
  14. PositionType int64 //职位类型 @个人 1企业
  15. PositionId int64 //职位id
  16. }
  17. // GetUserResources 获取用户资源信息
  18. func (ui *UserInfoRpc) GetUserResources() []string {
  19. req := &resource.HaspowersReq{
  20. EntId: ui.EntId,
  21. UserId: ui.BaseUserId,
  22. EntUserId: ui.EntUserId,
  23. Appid: ui.AppId,
  24. }
  25. powerList, err := ResourceLib.Haspowers(context.Background(), req)
  26. if err == nil && len(powerList.Powers) > 0 {
  27. return powerList.Powers
  28. }
  29. return []string{}
  30. }
  31. // GetUserPowers 获取用户权益信息
  32. func (ui *UserInfoRpc) GetUserPowers() *powerCheck.CheckResp {
  33. req := &powerCheck.CheckReq{
  34. Appid: ui.AppId,
  35. Userid: ui.UserId,
  36. BaseUserId: ui.BaseUserId,
  37. AccountId: ui.AccountId,
  38. EntId: ui.EntId,
  39. PositionType: ui.PositionType,
  40. PositionId: ui.PositionId,
  41. }
  42. checkResp, err := PowerCheck.Check(context.Background(), req)
  43. if err == nil {
  44. return checkResp
  45. }
  46. return nil
  47. }