From 8f11380e7abe7be64a9279af72c1fb4b95c75c44 Mon Sep 17 00:00:00 2001 From: Chang lue Tsen Date: Thu, 4 Sep 2025 09:32:39 -0400 Subject: [PATCH] feat: delete common GetSubscription --- .../handler/common/getSubscriptionHandler.go | 18 -------- internal/logic/common/getSubscriptionLogic.go | 41 ------------------- 2 files changed, 59 deletions(-) delete mode 100644 internal/handler/common/getSubscriptionHandler.go delete mode 100644 internal/logic/common/getSubscriptionLogic.go diff --git a/internal/handler/common/getSubscriptionHandler.go b/internal/handler/common/getSubscriptionHandler.go deleted file mode 100644 index 94e98e4..0000000 --- a/internal/handler/common/getSubscriptionHandler.go +++ /dev/null @@ -1,18 +0,0 @@ -package common - -import ( - "github.com/gin-gonic/gin" - "github.com/perfect-panel/server/internal/logic/common" - "github.com/perfect-panel/server/internal/svc" - "github.com/perfect-panel/server/pkg/result" -) - -// Get Subscription -func GetSubscriptionHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) { - return func(c *gin.Context) { - - l := common.NewGetSubscriptionLogic(c.Request.Context(), svcCtx) - resp, err := l.GetSubscription() - result.HttpResult(c, resp, err) - } -} diff --git a/internal/logic/common/getSubscriptionLogic.go b/internal/logic/common/getSubscriptionLogic.go deleted file mode 100644 index 463abfe..0000000 --- a/internal/logic/common/getSubscriptionLogic.go +++ /dev/null @@ -1,41 +0,0 @@ -package common - -import ( - "context" - - "github.com/perfect-panel/server/internal/svc" - "github.com/perfect-panel/server/internal/types" - "github.com/perfect-panel/server/pkg/logger" - "github.com/perfect-panel/server/pkg/tool" - "github.com/perfect-panel/server/pkg/xerr" - "github.com/pkg/errors" -) - -type GetSubscriptionLogic struct { - logger.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// Get Subscription -func NewGetSubscriptionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubscriptionLogic { - return &GetSubscriptionLogic{ - Logger: logger.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *GetSubscriptionLogic) GetSubscription() (resp *types.GetSubscriptionResponse, err error) { - resp = &types.GetSubscriptionResponse{ - List: make([]types.Subscribe, 0), - } - // Get the subscription list - data, err := l.svcCtx.SubscribeModel.QuerySubscribeListByShow(l.ctx) - if err != nil { - l.Errorw("[Site GetSubscription]", logger.Field("err", err.Error())) - return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "get subscription list error: %v", err.Error()) - } - tool.DeepCopy(&resp.List, data) - return -}