Exemple #1
0
        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));
        }
Exemple #2
0
        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)));
        }
Exemple #3
0
        public async Task <APIResult> GetShopCommoditiesAndCombos([FromBody] GetShopCategoryAndCommoditiesArgsModel args)
        {
            if (string.IsNullOrEmpty(args.ShopFlag))
            {
                throw new Exception("ShopFlag不能为空");
            }
            var res = await Task.Run(() =>
            {
                ShopBrandCommodityServer server = new ShopBrandCommodityServer(db, args.ShopFlag, args.DiningWay);
                GetShopCommoditiesAndCombos rtn = new GetShopCommoditiesAndCombos()
                {
                    CategoryAndCommodity = server.GetCategoryAndCommodity(),
                    Commodity            = server.GetComboList()
                };
                return(rtn);
            });

            return(Success(res));
        }