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).
38 lines
869 B
Go
38 lines
869 B
Go
package order
|
|
|
|
import (
|
|
"context"
|
|
|
|
"muyu-apiserver/gateway/internal/svc"
|
|
"muyu-apiserver/gateway/internal/types"
|
|
"muyu-apiserver/pkg/ctxdata"
|
|
"muyu-apiserver/rpc/purchase/purchaseservice"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type GetPurchaseOrderLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewGetPurchaseOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPurchaseOrderLogic {
|
|
return &GetPurchaseOrderLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *GetPurchaseOrderLogic) GetPurchaseOrder() (*types.PurchaseOrderInfo, error) {
|
|
id := ctxdata.GetPathId(l.ctx)
|
|
resp, err := l.svcCtx.PurchaseRpc.GetPurchaseOrder(l.ctx, &purchaseservice.GetPurchaseOrderReq{
|
|
OrderId: id,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return purchaseOrderInfoFromPB(resp), nil
|
|
}
|