newestBiddingLogic.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. "context"
  5. "jyBXBase/rpc/bxbase"
  6. "net/http"
  7. "strconv"
  8. "jyBXBase/api/internal/svc"
  9. "jyBXBase/api/internal/types"
  10. "github.com/zeromicro/go-zero/core/logx"
  11. )
  12. type NewestBiddingLogic struct {
  13. logx.Logger
  14. ctx context.Context
  15. svcCtx *svc.ServiceContext
  16. r *http.Request
  17. }
  18. func NewNewestBiddingLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *http.Request) *NewestBiddingLogic {
  19. return &NewestBiddingLogic{
  20. Logger: logx.WithContext(ctx),
  21. ctx: ctx,
  22. svcCtx: svcCtx,
  23. r: r,
  24. }
  25. }
  26. func (l *NewestBiddingLogic) NewestBidding(req *types.NewestReq) (resp *types.CommonRes, err error) {
  27. newUserId, _ := strconv.ParseInt(req.NewUserId, 10, 64)
  28. positionType, _ := strconv.ParseInt(req.PositionType, 10, 64)
  29. res, err0 := l.svcCtx.Bxbase.NewestBidding(l.ctx, &bxbase.NewestBiddingReq{
  30. UserId: req.UserId,
  31. AppId: req.AppId,
  32. City: req.City,
  33. IsSearch: req.IsSearch,
  34. EntUserId: req.EntUserId,
  35. NewUserId: newUserId,
  36. EntId: req.EntId,
  37. PositionType: positionType,
  38. })
  39. if err0 != nil {
  40. return &types.CommonRes{
  41. Err_code: -1,
  42. Err_msg: "错误",
  43. Data: nil,
  44. }, nil
  45. }
  46. return &types.CommonRes{
  47. Err_code: common.IntAll(res.ErrCode),
  48. Err_msg: res.ErrMsg,
  49. Data: res.Data,
  50. }, nil
  51. }