//[Authorize(AuthenticationSchemes = "jwt")] public async Task <APIResult> GetMemberCardInfo([FromBody] ShopIdModel input) { var shopMemberCardInfo = await db.ShopMemberCardInfo.FirstOrDefaultAsync(m => m.ShopId.Equals(input.ShopId) && !m.IsDel); if (shopMemberCardInfo == null) { if (shopMemberCardInfo == null) { shopMemberCardInfo = new ShopMemberCardInfo() { AddIp = GetIp(), AddTime = DateTime.Now, CardCover = "http://91huichihuihe.oss-cn-shenzhen.aliyuncs.com/DmHsyw_1536202883673.png", IsValidityLong = true, PrivilegeExplain = "本店会员根据会员级别可在本店享有专属会员折扣,对应福利如下: 普通会员——**折 银卡会员——**折 金卡会员——**折 钻卡会员——**折", ShopId = input.ShopId, ServePhone = "", UsedKnow = "1、每个微信用户仅能申请一张会员卡;2、申请会员卡需要绑定手机号,且一个微信号对应一个手机号,即同一个微信或同一个手机号仅能绑定一张会员卡;3、会员折扣仅限通过本小程序点餐支付方可享受相应折扣;4、会员卡可在本店享受对应会员服务,不能在其他门店享受会员服务5、本店在法律允许范围内保留最终解释权", ValidityBeginTime = DateTime.Now, ValidityEndTime = DateTime.Now }; await db.ShopMemberCardInfo.AddAsync(shopMemberCardInfo); await db.SaveChangesAsync(); //return await Task.FromResult(Error("未找到记录")); } } return(await Task.FromResult(Success(shopMemberCardInfo))); }
public async Task <APIResult> GetTopUp([FromBody] ShopIdModel input) { var shopTopUpSets = db.ShopTopUpSet.Where(m => m.ShopId.Equals(input.ShopId) && !m.IsDel).ToList(); var addshopMemberCardInfo = _mapper.Map <List <GetTopUpModel> >(shopTopUpSets); return(await Task.FromResult(Success(addshopMemberCardInfo))); }
public async Task <APIResult> GetShopCustomTopUpSet([FromBody] ShopIdModel input) { var shopMemberSet = await db.ShopMemberSet.FirstOrDefaultAsync(m => !m.IsDel && m.ShopId.Equals(input.ShopId)); var shopCustomTopUpSet = await db.ShopCustomTopUpSet.FirstOrDefaultAsync(m => m.ShopId.Equals(input.ShopId) && !m.IsDel); var getCustomTopUpModel = _mapper.Map <GetCustomTopUpModel>(shopCustomTopUpSet); getCustomTopUpModel.IsShowCustomTopUpSet = shopMemberSet.IsShowCustomTopUpSet; return(await Task.FromResult(Success(getCustomTopUpModel))); }
//[Authorize] public async Task <APIResult> MemberStatistics([FromBody] ShopIdModel input) { var shopMembers = db.ShopMembers.Where(m => !m.IsDel && m.ShopId.Equals(input.ShopId)).AsNoTracking(); var nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); var startNowTime = nowTime.AddDays(-1); var endNowTime = nowTime.AddDays(-7); return(await Task.FromResult(Success(new { Number = await shopMembers.CountAsync(), DayNumber = await shopMembers.Where(m => m.AddTime <= startNowTime && m.AddTime >= endNowTime).CountAsync(), Credits = await shopMembers.SumAsync(m => m.Credits) }))); }