60 lines
2.0 KiB
Go
60 lines
2.0 KiB
Go
// Code generated by goctl. DO NOT EDIT.
|
|
// Source: trade.proto
|
|
|
|
package server
|
|
|
|
import (
|
|
"context"
|
|
|
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
|
couponservicelogic "app-cloudep-trade-service/internal/logic/couponservice"
|
|
"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)
|
|
}
|