subscribeListLogic.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "context"
  5. "jyBXSubscribe/api/internal/svc"
  6. "jyBXSubscribe/api/internal/types"
  7. "jyBXSubscribe/rpc/type/bxsubscribe"
  8. "net/http"
  9. "strings"
  10. "github.com/zeromicro/go-zero/core/logx"
  11. )
  12. type SubscribeListLogic struct {
  13. logx.Logger
  14. ctx context.Context
  15. svcCtx *svc.ServiceContext
  16. r *http.Request
  17. }
  18. func NewSubscribeListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *SubscribeListLogic {
  19. return &SubscribeListLogic{
  20. Logger: logx.WithContext(ctx),
  21. ctx: ctx,
  22. svcCtx: svcCtx,
  23. r: r,
  24. }
  25. }
  26. func (l *SubscribeListLogic) SubscribeList(req *types.SubscribeReq) (resp *types.CommonResp, err error) {
  27. //关键词处理
  28. //分类
  29. matchitemsArr := []string{}
  30. matchitems := ""
  31. //关键词
  32. matchkeysArr := []string{}
  33. matchkeys := ""
  34. if req.IsEnt {
  35. for k, v := range req.Item {
  36. if common.InterfaceToStr(v) == "" {
  37. matchitemsArr = append(matchitemsArr, common.InterfaceToStr(k))
  38. } else {
  39. matchkeysArr = append(matchkeysArr, common.InterfaceToStr(v))
  40. }
  41. }
  42. if len(matchitemsArr) == 0 {
  43. matchkeys = strings.Join(matchkeysArr, ",")
  44. } else {
  45. matchitems = strings.Join(matchitemsArr, ",")
  46. }
  47. } else {
  48. matchkeys = req.KeyWords
  49. }
  50. res, err := l.svcCtx.Suscribe.GetSubList(l.ctx, &bxsubscribe.SubscribeInfosReq{
  51. <<<<<<< HEAD
  52. PageNum: req.PageNum,
  53. PageSize: req.PageSize,
  54. SelectTime: req.SelectTime,
  55. Area: req.Area,
  56. City: req.City,
  57. Industry: req.Industry,
  58. BuyerClass: req.BuyerClass,
  59. KeyWords: req.KeyWords,
  60. Subtype: req.Subtype,
  61. UserType: req.UserType,
  62. Price: req.Price,
  63. FileExists: req.FileExists,
  64. IsRead: req.IsRead,
  65. Source: req.Source,
  66. Staffs: req.Staffs,
  67. UserId: req.UserId,
  68. EntId: req.EntId,
  69. EntUserId: req.EntUserId,
  70. DeptId: req.DeptId,
  71. NewUserId: req.NewUserId,
  72. IsEnt: req.IsEnt,
  73. PositionType: req.PositionType,
  74. AccountId: req.AccountId,
  75. PositionId: req.PositionId,
  76. MgoUserId: req.MgoUserId,
  77. =======
  78. PageNum: req.PageNum,
  79. PageSize: req.PageSize,
  80. SelectTime: req.SelectTime,
  81. Area: req.Area,
  82. City: req.City,
  83. Industry: req.Industry,
  84. BuyerClass: req.BuyerClass,
  85. KeyWords: matchkeys,
  86. Subtype: req.Subtype,
  87. UserType: req.UserType,
  88. Price: req.Price,
  89. FileExists: req.FileExists,
  90. IsRead: req.IsRead,
  91. Source: req.Source,
  92. Staffs: req.Staffs,
  93. UserId: req.UserId,
  94. EntId: req.EntId,
  95. EntUserId: req.EntUserId,
  96. DeptId: req.DeptId,
  97. NewUserId: req.NewUserId,
  98. IsEnt: req.IsEnt,
  99. PositionType: req.PositionType,
  100. NotReturnCount: req.NotReturnCount,
  101. Item: matchitems,
  102. >>>>>>> master
  103. })
  104. if err != nil {
  105. return &types.CommonResp{
  106. Err_code: res.ErrCode,
  107. Err_msg: res.ErrMsg,
  108. Data: nil,
  109. }, nil
  110. }
  111. return &types.CommonResp{
  112. Err_code: res.ErrCode,
  113. Err_msg: res.ErrMsg,
  114. Data: res.Data,
  115. }, nil
  116. }