supplysearchlogic.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyInfo/rpc/consumer/consumerclient"
  4. "context"
  5. "app.yhyue.com/moapp/jybase/common"
  6. "app.yhyue.com/moapp/jyInfo/api/internal/svc"
  7. "app.yhyue.com/moapp/jyInfo/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type SupplySearchLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewSupplySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SupplySearchLogic {
  16. return &SupplySearchLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *SupplySearchLogic) SupplySearch(req *types.PubSupplyInfoReq) (resp *types.CommonRes, err error) {
  23. supplySearch, err0 := l.svcCtx.Consumer.SupplyInfoSearch(l.ctx, &consumerclient.SupplyInfoSearchReq{
  24. Keywords: req.Keywords,
  25. SearchType: req.SearchType,
  26. Province: req.Province,
  27. City: req.City,
  28. Time: req.Time,
  29. Status: req.Status,
  30. PageSize: req.PageSize,
  31. PageIndex: req.PageIndex,
  32. })
  33. if err0 != nil {
  34. return &types.CommonRes{
  35. Err_code: -1,
  36. Err_msg: "错误",
  37. Data: nil,
  38. }, nil
  39. }
  40. return &types.CommonRes{
  41. Err_code: common.IntAll(supplySearch.ErrCode),
  42. Err_msg: supplySearch.ErrMsg,
  43. Data: supplySearch.Data,
  44. }, nil
  45. }