relatesInformationLogic.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 RelatesInformationLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. r *http.Request
  15. }
  16. func NewRelatesInformationLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *RelatesInformationLogic {
  17. return &RelatesInformationLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. r: r,
  22. }
  23. }
  24. func (l *RelatesInformationLogic) RelatesInformation(req *types.RelatesInformationReq) (resp *types.CommonResp, err error) {
  25. res, err0 := l.svcCtx.Buyer.RelatesInfo(l.ctx, &bxbuyer.RelatesInformationReq{
  26. Area: req.Area,
  27. City: req.City,
  28. BiddingCount: int64(req.BiddingCount),
  29. BuyerCount: int64(req.BuyerCount),
  30. Buyer: req.Buyer,
  31. PositionId: req.PositionId,
  32. PositionType: req.PositionType,
  33. Phone: req.Phone,
  34. })
  35. if err0 != nil {
  36. return &types.CommonResp{
  37. Err_code: -1,
  38. Err_msg: "错误",
  39. Data: nil,
  40. }, nil
  41. }
  42. return &types.CommonResp{
  43. Err_code: res.ErrCode,
  44. Err_msg: res.ErrMsg,
  45. Data: res.Data,
  46. }, nil
  47. }