youtu_grpc/app/ranking_service/internal/logic/remove_ranking_logic.go

35 lines
914 B
Go
Raw Normal View History

2025-02-17 16:44:44 +08:00
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
}