CloudGamingAdmin/admin-server/CloudGaming.Api.Admin/ApplicationServices/Apps/App/T_User_PlayGameTimeService.cs
2024-12-01 01:12:18 +08:00

47 lines
1.9 KiB
C#

using CloudGaming.Repository.Game.Entities.App;
namespace CloudGaming.Api.Admin.ApplicationServices.Apps.App;
/// <summary>
/// 用户游玩时间表,总表,一个游戏一条数据 服务 T_User_PlayGameTimeService
/// </summary>
public class T_User_PlayGameTimeService(IServiceProvider serviceProvider)
: ApplicationUserService<T_User_PlayGameTime,int,T_User_PlayGameTime,T_User_PlayGameTime>(serviceProvider)
{
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async override Task<PagingView> FindListAsync(PagingSearchInput<T_User_PlayGameTime> pagingSearchInput)
{
var query = this.Repository.Select
//游戏Id
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.GameId),
w => w.GameId.Contains(pagingSearchInput.Search.GameId ?? ""))
//用户id
.WhereIf(pagingSearchInput.Search?.UserId!=null&&pagingSearchInput.Search?.UserId>0,
w => w.UserId== pagingSearchInput.Search.UserId)
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
w.UserId,w.GameId,w.PlayTime,w.FreePlayTime,w.DiamondPlayTime,w.NightCardPlayTime,w.UpdateTime,w.Createtime,w.TenantId,
})
;
var result = await Repository.AsPagingViewAsync(query, pagingSearchInput);
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w. !).SetColumn<SysUser>(w => w.Name!);
result
.FormatValue(query, w => w.UpdateTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
.FormatValue(query, w => w.Createtime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
;
return result;
}
}