111
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public interface INoticeService
|
||||
{
|
||||
Task<List<game_notice>> GetNoticeDataByTake(int take);
|
||||
Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace Application.Domain;
|
||||
|
||||
public class NoticeService:INoticeService,ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _dbClient;
|
||||
private readonly IRedisCache _redisClient;
|
||||
|
||||
public NoticeService(ISqlSugarClient dbClient, IRedisCache redisClient)
|
||||
{
|
||||
_dbClient = dbClient;
|
||||
_redisClient = redisClient;
|
||||
}
|
||||
|
||||
public async Task<List<game_notice>> GetNoticeDataByTake(int take)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().Take(take).OrderByDescending(it=>it.addTime).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<game_notice>> GetNoticeData(int page, int limit, RefAsync<int> total)
|
||||
{
|
||||
var db = _dbClient.AsTenant().GetConnectionWithAttr<game_notice>();
|
||||
return await db.Queryable<game_notice>().ToPageListAsync(page, limit, total);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user