rpc.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package entity
  2. import (
  3. "bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/powercheck"
  4. "context"
  5. "strings"
  6. )
  7. var (
  8. PowerCheck powercheck.PowerCheck
  9. )
  10. type UserInfoRpc struct {
  11. AppId string //appId 剑鱼 10000
  12. UserId string //用户id
  13. BaseUserId int64 //用户基本id
  14. EntId int64 //企业id
  15. EntUserId int64 //企业用户id
  16. AccountId int64 //账户id
  17. PositionType int64 //职位类型 @个人 1企业
  18. PositionId int64 //职位id
  19. MgoUserId string //原userId
  20. }
  21. // GetUserPowers 获取用户权益信息
  22. func (ui *UserInfoRpc) GetUserPowers() *powercheck.CheckResp {
  23. req := &powercheck.CheckReq{
  24. Appid: ui.AppId,
  25. Userid: ui.MgoUserId,
  26. BaseUserId: ui.BaseUserId,
  27. AccountId: ui.AccountId,
  28. EntId: ui.EntId,
  29. PositionType: ui.PositionType,
  30. PositionId: ui.PositionId,
  31. }
  32. checkResp, err := PowerCheck.Check(context.Background(), req)
  33. if err == nil {
  34. return checkResp
  35. }
  36. return nil
  37. }
  38. // GetQueryItems 免费 标题(title) 正文(content) 老用户【中标企业(winner)】
  39. // 付费用户 全部(all)、标题(title) 正文(content) 会员: 采购单位(buyer) 中标企业(winner) 招标代理机构(agency) 附件(file)
  40. // 项目名称projectname和标的物purchasing(ppa)
  41. func (ui *UserInfoRpc) GetQueryItems(selectType string, limitOldTime, registerData int64, isPay bool) (items []string) {
  42. if isPay {
  43. for _, t := range strings.Split(selectType, ",") {
  44. if t == "content" {
  45. items = append(items, "detail")
  46. } else if t == "buyer" {
  47. items = append(items, "mbuyer")
  48. } else if t == "winner" {
  49. items = append(items, "mwinner")
  50. } else if t == "agency" {
  51. items = append(items, "magency")
  52. } else if t == "title" {
  53. items = append(items, "title")
  54. } else if t == "ppa" {
  55. items = append(items, []string{"purchasing", "projectname.pname"}...)
  56. } else if t == "file" { //dev4.7.8 标讯优化:搜索范围附件-》全部用户可用
  57. items = append(items, "filetext")
  58. }
  59. }
  60. return
  61. }
  62. //老用户 使用付费功能
  63. isOldUser := registerData != 0 && registerData < limitOldTime
  64. for _, t := range strings.Split(selectType, ",") {
  65. if t == "winner" && isOldUser {
  66. items = append(items, "mwinner")
  67. } else if t == "title" {
  68. items = append(items, "title")
  69. } else if t == "content" {
  70. items = append(items, "detail")
  71. } else if t == "file" { //dev4.7.8 标讯优化:搜索范围附件-》全部用户可用
  72. items = append(items, "filetext")
  73. }
  74. }
  75. return
  76. }