35 lines
914 B
Go
35 lines
914 B
Go
|
package logic
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/logic/rankings"
|
||
|
|
||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/svc"
|
||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/ranking"
|
||
|
|
||
|
"github.com/zeromicro/go-zero/core/logx"
|
||
|
)
|
||
|
|
||
|
type RemoveRankingLogic struct {
|
||
|
ctx context.Context
|
||
|
svcCtx *svc.ServiceContext
|
||
|
logx.Logger
|
||
|
}
|
||
|
|
||
|
func NewRemoveRankingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveRankingLogic {
|
||
|
return &RemoveRankingLogic{
|
||
|
ctx: ctx,
|
||
|
svcCtx: svcCtx,
|
||
|
Logger: logx.WithContext(ctx),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (l *RemoveRankingLogic) RemoveRanking(in *ranking.RemoveRankingRequest) (*ranking.BaseResult, error) {
|
||
|
cacheKey := rankings.GetRankingsCacheKey(in.AppId, in.Type)
|
||
|
err := l.svcCtx.RedisRanking.Remove(l.ctx, cacheKey)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return &ranking.BaseResult{}, nil
|
||
|
}
|