feat: delete common GetSubscription
This commit is contained in:
parent
7ecf955eb7
commit
8f11380e7a
@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user