buyerSearchListLogic.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package logic
  2. import (
  3. "context"
  4. "jyBXBuyer/rpc/type/bxbuyer"
  5. "net/http"
  6. "jyBXBuyer/api/internal/svc"
  7. "jyBXBuyer/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type BuyerSearchListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. r *http.Request
  15. }
  16. func NewBuyerSearchListLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *BuyerSearchListLogic {
  17. return &BuyerSearchListLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. r: r,
  22. }
  23. }
  24. func (l *BuyerSearchListLogic) BuyerSearchList(req *types.BuyerListReq) (resp *types.CommonResp, err error) {
  25. if req.EntUserId == "" {
  26. req.IsCheckReceive = false
  27. }
  28. if req.UserId == "" {
  29. req.IsCheckFollow = false
  30. }
  31. res, err0 := l.svcCtx.Buyer.BuyerList(l.ctx, &bxbuyer.BuyerListReq{
  32. AppId: req.AppId,
  33. BuyerName: req.BuyerName,
  34. Province: req.Province,
  35. City: req.City,
  36. BuyerClass: req.BuyerClass,
  37. IsCheckFollow: req.IsCheckFollow,
  38. IsCheckReceive: req.IsCheckReceive,
  39. UserType: req.UserType,
  40. UserId: l.r.Header.Get("userId"),
  41. EntId: req.EntId,
  42. EntUserId: req.EntUserId,
  43. PageSize: req.PageSize,
  44. PageNum: req.PageNum,
  45. IsContact: req.IsContact,
  46. PositionType: req.PositionType,
  47. PositionId: req.PositionId,
  48. AccountId: req.AccountId,
  49. MgoUserId: req.MgoUserId,
  50. NewUserId: req.NewUserId,
  51. EntAccountId: req.EntAccountId,
  52. Phone: req.Phone,
  53. })
  54. if err0 != nil {
  55. return &types.CommonResp{
  56. Err_code: -1,
  57. Err_msg: "错误",
  58. Data: nil,
  59. }, nil
  60. }
  61. return &types.CommonResp{
  62. Err_code: res.ErrCode,
  63. Err_msg: res.ErrMsg,
  64. Data: res.Data,
  65. }, nil
  66. }