public async Task <APIResult> GetCommoditiesForMember([FromBody] GetShopCategoryAndCommoditiesArgsModel args) { if (string.IsNullOrEmpty(args.ShopFlag)) { throw new Exception("ShopFlag不能为空"); } var res = await Task.Run(() => { var shop = db.Query <Shop>() .Where(m => !m.IsDel) .Where(m => m.Flag == args.ShopFlag) .FirstOrDefault(); var memberId = GetMemberId(); var shopMember = ShopMemberServer.GetShopMember(db, shop.Id, memberId); ShopMemberLevel shopMemberLevel = null; if (shopMember != null) { shopMemberLevel = db.GetSingle <ShopMemberLevel>(shopMember.ShopMemberLevelId); } ShopBrandCommodityServer server = new ShopBrandCommodityServer(db, shop, args.DiningWay); GetShopCommoditiesAndCombos rtn = new GetShopCommoditiesAndCombos() { CategoryAndCommodity = server.GetCategoryAndCommodity(shopMemberLevel?.Discount), Commodity = server.GetComboList() }; return(rtn); }); return(Success(res)); }
public APIResult GetComboList([FromBody] GetComboListArgsModel args) { if (!args.ShopId.HasValue) { throw new Exception("ShopId不能为空"); } if (!args.DiningWay.HasValue) { throw new Exception("渠道不能为空"); } ShopBrandCommodityServer server = new ShopBrandCommodityServer(db, args.DiningWay.Value); return(Success(server.GetComboList(args.ShopId.Value))); }
//[Authorize(AuthenticationSchemes = "jwt")] public async Task <APIResult> GetShopCategoryAndCommodities([FromBody] GetShopCategoryAndCommoditiesArgsModel args) { if (string.IsNullOrEmpty(args.ShopFlag)) { throw new Exception("ShopFlag不能为空"); } var rtn = await Task.Run(() => { ShopBrandCommodityServer server = new ShopBrandCommodityServer(db, args.ShopFlag, args.DiningWay); return(server.GetCategoryAndCommodity()); }); return(Success(rtn)); }
public async Task <APIResult> GetShopCommodities([FromBody] IdArgsModel args) { if (args.Id == 0) { throw new Exception("ShopId不能为空"); } var res = await Task.Run(() => { Shop shop = db.GetSingle <Shop>(args.Id); if (shop == null) { throw new Exception("商铺记录不存在"); } ShopBrandCommodityServer server = new ShopBrandCommodityServer(db, shop, DiningWay.所有); CategoryAndCommodityModel rtn = server.GetCategoryAndCommodity(); return(rtn); }); return(Success(res)); }