source.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. MgoUserId string //原userId
  17. }
  18. // GetUserResources 获取用户资源信息
  19. func (ui *UserInfoRpc) GetUserResources() []string {
  20. req := &resource.HaspowersReq{
  21. EntId: ui.EntId,
  22. UserId: ui.BaseUserId,
  23. EntUserId: ui.EntUserId,
  24. Appid: ui.AppId,
  25. }
  26. powerList, err := ResourceLib.Haspowers(context.Background(), req)
  27. if err == nil && len(powerList.Powers) > 0 {
  28. return powerList.Powers
  29. }
  30. return []string{}
  31. }
  32. // GetUserPowers 获取用户权益信息
  33. func (ui *UserInfoRpc) GetUserPowers() *powerCheck.CheckResp {
  34. req := &powerCheck.CheckReq{
  35. Appid: ui.AppId,
  36. Userid: ui.MgoUserId,
  37. BaseUserId: ui.BaseUserId,
  38. AccountId: ui.AccountId,
  39. EntId: ui.EntId,
  40. PositionType: ui.PositionType,
  41. PositionId: ui.PositionId,
  42. }
  43. checkResp, err := PowerCheck.Check(context.Background(), req)
  44. if err == nil {
  45. return checkResp
  46. }
  47. return nil
  48. }