addsearchlogic.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "context"
  5. "jyBXBase/rpc/bxcollection/bxcol"
  6. "jyBXBase/api/internal/svc"
  7. "jyBXBase/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type AddSearchLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewAddSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddSearchLogic {
  16. return &AddSearchLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *AddSearchLogic) AddSearch(req *types.AddSearch) (resp *types.CommonRes, err error) {
  23. // todo: add your logic here and delete this line
  24. res, err0 := l.svcCtx.Bxcollection.AddSearch(l.ctx, &bxcol.AddSearchReq{
  25. UserId: req.UserId,
  26. Type: req.Type,
  27. Keywords: req.Keywords,
  28. PublishTime: req.Publishtime,
  29. City: req.City,
  30. Area: req.Area,
  31. Subtype: req.Subtype,
  32. MinPrice: req.Minprice,
  33. MaxPrice: req.Maxprice,
  34. Industry: req.Industry,
  35. SelectType: req.SelectType,
  36. BuyerClass: req.Buyerclass,
  37. HasBuyerTel: req.Hasbuyertel,
  38. HasWinnerTel: req.Haswinnertel,
  39. FileExists: req.FileExists,
  40. NotKey: req.Notkey,
  41. TabularFlag: req.Tabularflag,
  42. })
  43. if err0 != nil {
  44. return &types.CommonRes{
  45. Err_code: -1,
  46. Err_msg: "错误",
  47. Data: nil,
  48. }, nil
  49. }
  50. return &types.CommonRes{
  51. Err_code: common.IntAll(res.ErrCode),
  52. Err_msg: res.ErrMsg,
  53. Data: nil,
  54. }, nil
  55. }