source.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package entity
  2. import (
  3. "context"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. powerCheck "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
  6. resource "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  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. EntAccountId int64 //企业账户id
  16. PositionType int64 //职位类型 @个人 1企业
  17. PositionId int64 //职位id
  18. MgoUserId string //原userId
  19. }
  20. // GetUserResources 获取用户资源信息
  21. func (ui *UserInfoRpc) GetUserResources() []string {
  22. req := &resource.HaspowersReq{
  23. AccountId: ui.AccountId,
  24. EntAccountId: ui.EntAccountId,
  25. EntId: ui.EntId,
  26. EntUserId: ui.EntUserId,
  27. Appid: ui.AppId,
  28. }
  29. powerList, err := ResourceLib.Haspowers(context.Background(), req)
  30. if err == nil && len(powerList.Powers) > 0 {
  31. return powerList.Powers
  32. }
  33. return []string{}
  34. }
  35. // GetUserPowers 获取用户权益信息
  36. func (ui *UserInfoRpc) GetUserPowers() *powerCheck.CheckResp {
  37. req := &powerCheck.CheckReq{
  38. Appid: ui.AppId,
  39. Userid: ui.MgoUserId,
  40. BaseUserId: ui.BaseUserId,
  41. AccountId: ui.AccountId,
  42. EntId: ui.EntId,
  43. PositionType: ui.PositionType,
  44. PositionId: ui.PositionId,
  45. }
  46. logx.Info("--------req:-------------------------:", req)
  47. checkResp, err := PowerCheck.Check(context.Background(), req)
  48. if err == nil {
  49. return checkResp
  50. }
  51. return nil
  52. }