app-cloudep-trade-service/internal/server/subscriptionservice/subscription_service_server.go

72 lines
3.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
subscriptionservicelogic "app-cloudep-trade-service/internal/logic/subscriptionservice"
2024-10-25 10:17:27 +00:00
"app-cloudep-trade-service/internal/svc"
)
type SubscriptionServiceServer struct {
svcCtx *svc.ServiceContext
trade.UnimplementedSubscriptionServiceServer
}
func NewSubscriptionServiceServer(svcCtx *svc.ServiceContext) *SubscriptionServiceServer {
return &SubscriptionServiceServer{
svcCtx: svcCtx,
}
}
// CreateSubscription 建立訂閱
func (s *SubscriptionServiceServer) CreateSubscription(ctx context.Context, in *trade.SubscriptionCreateReq) (*trade.SubscriptionResp, error) {
l := subscriptionservicelogic.NewCreateSubscriptionLogic(ctx, s.svcCtx)
return l.CreateSubscription(in)
}
// UpdateSubscription 更新訂閱設定
func (s *SubscriptionServiceServer) UpdateSubscription(ctx context.Context, in *trade.SubscriptionUpdateReq) (*trade.SubscriptionResp, error) {
l := subscriptionservicelogic.NewUpdateSubscriptionLogic(ctx, s.svcCtx)
return l.UpdateSubscription(in)
}
// CancelSubscription 取消訂閱
func (s *SubscriptionServiceServer) CancelSubscription(ctx context.Context, in *trade.SubscriptionCancelReq) (*trade.OKResp, error) {
l := subscriptionservicelogic.NewCancelSubscriptionLogic(ctx, s.svcCtx)
return l.CancelSubscription(in)
}
// QuerySubscription 查詢單一訂閱資訊
func (s *SubscriptionServiceServer) QuerySubscription(ctx context.Context, in *trade.SubscriptionQueryReq) (*trade.SubscriptionResp, error) {
l := subscriptionservicelogic.NewQuerySubscriptionLogic(ctx, s.svcCtx)
return l.QuerySubscription(in)
}
// ListSubscriptions 查詢所有訂閱 (用於管理和監控)
func (s *SubscriptionServiceServer) ListSubscriptions(ctx context.Context, in *trade.ListSubscriptionsReq) (*trade.SubscriptionListResp, error) {
l := subscriptionservicelogic.NewListSubscriptionsLogic(ctx, s.svcCtx)
return l.ListSubscriptions(in)
}
// RenewSubscription 續訂訂閱
func (s *SubscriptionServiceServer) RenewSubscription(ctx context.Context, in *trade.SubscriptionRenewReq) (*trade.SubscriptionResp, error) {
l := subscriptionservicelogic.NewRenewSubscriptionLogic(ctx, s.svcCtx)
return l.RenewSubscription(in)
}
// CheckSubscriptionStatus 查詢訂閱狀態 (啟用/過期/取消)
func (s *SubscriptionServiceServer) CheckSubscriptionStatus(ctx context.Context, in *trade.SubscriptionStatusQueryReq) (*trade.SubscriptionStatusResp, error) {
l := subscriptionservicelogic.NewCheckSubscriptionStatusLogic(ctx, s.svcCtx)
return l.CheckSubscriptionStatus(in)
}
// RefreshSubscriptionStatus cron 改變訂閱的狀態(時間到了要過期,需要續約自動續約),每 5 分鐘執行一次
func (s *SubscriptionServiceServer) RefreshSubscriptionStatus(ctx context.Context, in *trade.NoneReq) (*trade.OKResp, error) {
l := subscriptionservicelogic.NewRefreshSubscriptionStatusLogic(ctx, s.svcCtx)
return l.RefreshSubscriptionStatus(in)
}