source.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. "github.com/zeromicro/go-zero/core/logx"
  7. )
  8. type UserInfoRpc struct {
  9. AppId string //appId 剑鱼 10000
  10. UserId string //用户id
  11. BaseUserId int64 //用户基本id
  12. EntId int64 //企业id
  13. EntUserId int64 //企业用户id
  14. AccountId int64 //账户id
  15. PositionType int64 //职位类型 @个人 1企业
  16. PositionId int64 //职位id
  17. MgoUserId string //原userId
  18. }
  19. // GetUserResources 获取用户资源信息
  20. func (ui *UserInfoRpc) GetUserResources() []string {
  21. req := &resource.HaspowersReq{
  22. EntId: ui.EntId,
  23. UserId: ui.BaseUserId,
  24. EntUserId: ui.EntUserId,
  25. Appid: ui.AppId,
  26. }
  27. powerList, err := ResourceLib.Haspowers(context.Background(), req)
  28. if err == nil && len(powerList.Powers) > 0 {
  29. return powerList.Powers
  30. }
  31. return []string{}
  32. }
  33. // GetUserPowers 获取用户权益信息
  34. func (ui *UserInfoRpc) GetUserPowers() *powerCheck.CheckResp {
  35. logx.Info(" ------ ui.MgoUserId:", ui.MgoUserId)
  36. req := &powerCheck.CheckReq{
  37. Appid: ui.AppId,
  38. Userid: ui.MgoUserId,
  39. BaseUserId: ui.BaseUserId,
  40. AccountId: ui.AccountId,
  41. EntId: ui.EntId,
  42. PositionType: ui.PositionType,
  43. PositionId: ui.PositionId,
  44. }
  45. checkResp, err := PowerCheck.Check(context.Background(), req)
  46. if err == nil {
  47. return checkResp
  48. }
  49. return nil
  50. }