public async Task <APIResult> GetIntegralList([FromBody] GetPagedListBaseModelB input) { input.MemberId = GetMemberId(); var shopMember = await db.ShopMembers.FirstOrDefaultAsync(m => m.MemberId.Equals(input.MemberId) && !m.IsDel); if (shopMember == null) { return(Error("未注册")); } var shopIntegralRecharges = db.ShopIntegralRecharge. Where(m => !m.IsDel && m.MemberId.Equals(input.MemberId) && m.ShopId.Equals(input.ShopId) && m.ShopMemberId.Equals(shopMember.Id)) .ToPagedList(input.PageIndex, input.PageSize) .Select(m => new { m.Id, IntegralCount = m.Count, m.CodeStatut, m.SourceRemark, AddTime = m.AddTime.ToString("yyyy-MM-dd HH:mm:ss") }); return(await Task.FromResult(Success(new { input.PageIndex, input.PageSize, shopIntegralRecharges = shopIntegralRecharges, shopMember.Credits }))); }
//[Authorize] public async Task <APIResult> GetMemberList([FromBody] GetPagedListBaseModelB input) { int shopId = input.ShopId; //CheckShopActor(shopId, ShopActorType.超级管理员); var list = (from m in db.ShopMembers join c in db.ShopMemberLevel on m.ShopMemberLevelId equals c.Id into d from g in d.DefaultIfEmpty() where !m.IsDel && m.ShopId.Equals(input.ShopId) orderby m.AddTime descending select new MemberListModel() { Id = m.Id, Name = m.Name, Level = g == null ? "无等级" : $"{g.LevelName}({g.MemberLevel})", Credits = m.Credits, AddTime = m.AddTime.ToString("yyyy-MM-dd HH:mm:ss") }).AsNoTracking().ToPagedList(input.PageIndex, input.PageSize); var resultlist = list.ToList().Select(m => new MemberListModel() { Id = m.Id, Name = m.Name, Level = m.Level, Credits = m.Credits, AddTime = GetConsumeTime(m.Id) }).ToList(); //var list = db.Query<ShopMember>() // .Where(m => !m.IsDel && m.ShopId == shopId) // .Select(m => new // { // m.Id, // m.Name, // Level = m.ShopMemberLevel == null ? "" : $"{m.ShopMemberLevel.LevelName}({m.ShopMemberLevel.MemberLevel})", // m.Credits, // AddTime = m.AddTime.ToString("yyyy-MM-dd HH:mm:ss") // }) return(await Task.FromResult(Success(new { Total = list.TotalItemCount, input.PageIndex, input.PageSize, list = resultlist }))); }