source.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package entity
  2. import (
  3. "context"
  4. powerCheck "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
  5. resource "bp.jydev.jianyu360.cn/BaseService/resourceCenter/rpc/pb"
  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. EntAccountId 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. AccountId: ui.AccountId,
  23. EntAccountId: ui.EntAccountId,
  24. EntId: ui.EntId,
  25. EntUserId: ui.EntUserId,
  26. Appid: ui.AppId,
  27. }
  28. powerList, err := ResourceLib.Haspowers(context.Background(), req)
  29. if err == nil && len(powerList.Powers) > 0 {
  30. return powerList.Powers
  31. }
  32. return []string{}
  33. }
  34. // GetUserPowers 获取用户权益信息
  35. func (ui *UserInfoRpc) GetUserPowers() *powerCheck.CheckResp {
  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. }