addSearchScreenLogic.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "context"
  5. "jyBXBase/rpc/type/bxbase"
  6. "net/http"
  7. "jyBXBase/api/internal/svc"
  8. "jyBXBase/api/internal/types"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type AddSearchScreenLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. r *http.Request
  16. }
  17. func NewAddSearchScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *AddSearchScreenLogic {
  18. return &AddSearchScreenLogic{
  19. Logger: logx.WithContext(ctx),
  20. ctx: ctx,
  21. svcCtx: svcCtx,
  22. r: r,
  23. }
  24. }
  25. func (l *AddSearchScreenLogic) AddSearchScreen(req *types.AddSearchScreen) (resp *types.CommonRes, err error) {
  26. res, err0 := l.svcCtx.Bxbase.AddSearch(l.ctx, &bxbase.AddSearchReq{
  27. UserId: req.UserId,
  28. Type: req.Type,
  29. Keywords: req.Keywords,
  30. PublishTime: req.Publishtime,
  31. City: req.City,
  32. Area: req.Area,
  33. Subtype: req.Subtype,
  34. MinPrice: req.Minprice,
  35. MaxPrice: req.Maxprice,
  36. Industry: req.Industry,
  37. SelectType: req.SelectType,
  38. BuyerClass: req.Buyerclass,
  39. HasBuyerTel: req.Hasbuyertel,
  40. HasWinnerTel: req.Haswinnertel,
  41. FileExists: req.FileExists,
  42. NotKey: req.Notkey,
  43. InKey: req.InKey,
  44. AppId: req.AppId,
  45. SearchGroup: int64(req.SearchGroup),
  46. SearchMode: int64(req.SearchMode),
  47. WordsMode: int64(req.WordsMode),
  48. AdditionalWords: req.AdditionalWords,
  49. })
  50. if err0 != nil {
  51. return &types.CommonRes{
  52. Err_code: -1,
  53. Err_msg: "错误",
  54. Data: nil,
  55. }, nil
  56. }
  57. return &types.CommonRes{
  58. Err_code: common.IntAll(res.ErrCode),
  59. Err_msg: res.ErrMsg,
  60. Data: nil,
  61. }, nil
  62. }