Pull latest changes from upstream/main (GitHub) including: - Purchase RPC service (proto, server, logic, models) - Gateway route updates for purchase endpoints - SQL migration and config updates Excludes deploy/bin/ pre-compiled arm64 binaries (builds use multi-stage Dockerfiles targeting amd64).
40 lines
1013 B
Go
40 lines
1013 B
Go
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 CreatePurchasePaymentLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewCreatePurchasePaymentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePurchasePaymentLogic {
|
|
return &CreatePurchasePaymentLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *CreatePurchasePaymentLogic) CreatePurchasePayment(req *types.CreatePurchasePaymentReq) (*types.IdResp, error) {
|
|
resp, err := l.svcCtx.PurchaseRpc.CreatePurchasePayment(l.ctx, &purchaseservice.CreatePurchasePaymentReq{
|
|
OrderId: req.OrderId,
|
|
PaymentDate: req.PaymentDate,
|
|
Amount: req.Amount,
|
|
PaymentMethod: req.PaymentMethod,
|
|
Remark: req.Remark,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &types.IdResp{Id: resp.Id}, nil
|
|
}
|