package payment import ( "context" "muyu-apiserver/gateway/internal/svc" "muyu-apiserver/gateway/internal/types" "muyu-apiserver/rpc/purchase/purchaseservice" "github.com/zeromicro/go-zero/core/logx" ) type ListPurchasePaymentLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewListPurchasePaymentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListPurchasePaymentLogic { return &ListPurchasePaymentLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *ListPurchasePaymentLogic) ListPurchasePayment(req *types.ListPurchasePaymentReq) (*types.ListPurchasePaymentResp, error) { rpcResp, err := l.svcCtx.PurchaseRpc.ListPurchasePayment(l.ctx, &purchaseservice.ListPurchasePaymentReq{ Page: req.Page, PageSize: req.PageSize, OrderId: req.OrderId, StartDate: req.StartDate, EndDate: req.EndDate, }) if err != nil { return nil, err } list := make([]types.PurchasePaymentInfo, 0, len(rpcResp.List)) for _, p := range rpcResp.List { list = append(list, types.PurchasePaymentInfo{ PaymentId: p.PaymentId, OrderId: p.OrderId, SupplierId: p.SupplierId, PaymentDate: p.PaymentDate, Amount: p.Amount, PaymentMethod: p.PaymentMethod, Operator: p.Operator, Remark: p.Remark, CreatedAt: p.CreatedAt, }) } return &types.ListPurchasePaymentResp{Total: rpcResp.Total, List: list}, nil }