app-cloudep-trade-service/internal/server/couponservice/coupon_service_server.go

60 lines
2.0 KiB
Go
Raw Permalink Normal View History

2024-10-25 10:17:27 +00:00
// Code generated by goctl. DO NOT EDIT.
// Source: trade.proto
package server
import (
"context"
"app-cloudep-trade-service/gen_result/pb/trade"
2024-10-25 16:42:58 +00:00
couponservicelogic "app-cloudep-trade-service/internal/logic/couponservice"
2024-10-25 10:17:27 +00:00
"app-cloudep-trade-service/internal/svc"
)
type CouponServiceServer struct {
svcCtx *svc.ServiceContext
trade.UnimplementedCouponServiceServer
}
func NewCouponServiceServer(svcCtx *svc.ServiceContext) *CouponServiceServer {
return &CouponServiceServer{
svcCtx: svcCtx,
}
}
// CreateCoupon 創建優惠券
func (s *CouponServiceServer) CreateCoupon(ctx context.Context, in *trade.CreateCouponReq) (*trade.CouponResp, error) {
l := couponservicelogic.NewCreateCouponLogic(ctx, s.svcCtx)
return l.CreateCoupon(in)
}
// UpdateCoupon更新優惠券
func (s *CouponServiceServer) UpdateCoupon(ctx context.Context, in *trade.UpdateCouponReq) (*trade.CouponResp, error) {
l := couponservicelogic.NewUpdateCouponLogic(ctx, s.svcCtx)
return l.UpdateCoupon(in)
}
// QueryCoupon查詢優惠券
func (s *CouponServiceServer) QueryCoupon(ctx context.Context, in *trade.CouponQueryReq) (*trade.CouponResp, error) {
l := couponservicelogic.NewQueryCouponLogic(ctx, s.svcCtx)
return l.QueryCoupon(in)
}
// DeleteCoupon 刪除優惠券
func (s *CouponServiceServer) DeleteCoupon(ctx context.Context, in *trade.CouponQueryReq) (*trade.OKResp, error) {
l := couponservicelogic.NewDeleteCouponLogic(ctx, s.svcCtx)
return l.DeleteCoupon(in)
}
// ListCoupons列出所有優惠券
func (s *CouponServiceServer) ListCoupons(ctx context.Context, in *trade.CouponListReq) (*trade.CouponListResp, error) {
l := couponservicelogic.NewListCouponsLogic(ctx, s.svcCtx)
return l.ListCoupons(in)
}
// ValidateCoupon 驗證優惠券 (在下單或支付時使用)
func (s *CouponServiceServer) ValidateCoupon(ctx context.Context, in *trade.ValidateCouponReq) (*trade.CouponValidationResp, error) {
l := couponservicelogic.NewValidateCouponLogic(ctx, s.svcCtx)
return l.ValidateCoupon(in)
}