Пример #1
0
        public object GetVShops(int pageNo, int pageSize)
        {
            int total;
            var vshops = ServiceProvider.Instance <IVShopService> .Create.GetVShops(pageNo, pageSize, out total, Entities.VShopInfo.VShopStates.Normal, true).ToArray();

            long[] favoriteShopIds = new long[] { };
            if (CurrentUser != null)
            {
                favoriteShopIds = ServiceProvider.Instance <IShopService> .Create.GetFavoriteShopInfos(CurrentUser.Id).Select(item => item.ShopId).ToArray();
            }
            var model = vshops.Select(item => new
            {
                id = item.Id,
                //image = "http://" + Url.Request.RequestUri.Host + item.BackgroundImage,
                image          = Core.MallIO.GetRomoteImagePath(item.WXLogo),
                tags           = item.Tags,
                name           = item.Name,
                shopId         = item.ShopId,
                favorite       = favoriteShopIds.Contains(item.ShopId),
                productCount   = ProductManagerApplication.GetProductCount(item.ShopId),
                FavoritesCount = ServiceProvider.Instance <IShopService> .Create.GetShopFavoritesCount(item.ShopId)//关注人数
            });

            dynamic result = new ExpandoObject();

            result.total  = total;
            result.VShops = model;
            //return result;
            return(Json(new { result }));
        }
Пример #2
0
        public JsonResult GetProductNum(string brandName)
        {
            var query = new ProductQuery {
                BrandName = brandName
            };
            var count = ProductManagerApplication.GetProductCount(query);

            return(SuccessResult <dynamic>(data: new { ProductNum = count }));
        }
Пример #3
0
        public object GetShopHome()
        {
            CheckUserLogin();

            var now = DateTime.Now;

            var orderQuery = new OrderCountStatisticsQuery()
            {
                ShopId = CurrentUser.ShopId,
                Fields = new List <OrderCountStatisticsFields> {
                    OrderCountStatisticsFields.ActualPayAmount
                }
            };

            //三月内
            orderQuery.OrderDateBegin = new DateTime(now.Year, now.Month, 1).AddMonths(-2);
            var threeMonthAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;

            //本周
            orderQuery.OrderDateBegin = now.Date.AddDays(-(int)now.DayOfWeek);
            var weekAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;

            //今天
            orderQuery.OrderDateBegin = now.Date;
            var todayAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;

            //近三天发布商品数
            var productCount = ProductManagerApplication.GetProductCount(new ProductQuery
            {
                ShopId      = CurrentUser.ShopId,
                AuditStatus = new[] { Entities.ProductInfo.ProductAuditStatus.Audited },
                StartDate   = now.Date.AddDays(-2)
            });

            //待审核退货/退款
            var refundCount = RefundApplication.GetOrderRefundsCount(new RefundQuery()
            {
                ShopId      = CurrentUser.ShopId,
                AuditStatus = Entities.OrderRefundInfo.OrderRefundAuditStatus.WaitAudit,
            });

            return(new
            {
                success = true,
                data = new
                {
                    shopName = CurrentShopBranch.ShopBranchName,
                    todayAmount = todayAmount,
                    weekAmount = weekAmount,
                    threeMonthAmounht = threeMonthAmount,
                    createProductCount = productCount,
                    refundCount = refundCount
                }
            });
        }
Пример #4
0
 public JsonResult SaveProductAuditOnOff(int value, int value2)
 {
     SiteSettingApplication.SiteSettings.ProdutAuditOnOff      = value;
     SiteSettingApplication.SiteSettings.ProductSaleCountOnOff = value2;
     SiteSettingApplication.SaveChanges();
     if (value == 0)
     {
         var count = ProductManagerApplication.GetProductCount(new ProductQuery
         {
             //参数参照商品管理待审核列表功能
             AuditStatus = new ProductInfo.ProductAuditStatus[] { ProductInfo.ProductAuditStatus.WaitForAuditing },
             SaleStatus  = ProductInfo.ProductSaleStatus.OnSale
         });
         if (count > 0)//有待审核的商品,提示用户
         {
             return(SuccessResult <dynamic>(code: 1));
         }
     }
     return(SuccessResult <dynamic>(code: 0));
 }
Пример #5
0
        public object GetShopBranchHome()
        {
            try
            {
                CheckUserLogin();

                var now = DateTime.Now;

                var orderQuery = new OrderCountStatisticsQuery()
                {
                    ShopBranchId = CurrentShopBranch.Id,
                    Fields       = new List <OrderCountStatisticsFields> {
                        OrderCountStatisticsFields.ActualPayAmount
                    }
                };
                //三月内
                orderQuery.OrderDateBegin = new DateTime(now.Year, now.Month, 1).AddMonths(-2);
                var threeMonthAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;
                //本周
                orderQuery.OrderDateBegin = now.Date.AddDays(-(int)now.DayOfWeek);
                var weekAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;
                //今天
                orderQuery.OrderDateBegin = now.Date;
                var todayAmount = StatisticApplication.GetOrderCount(orderQuery).TotalActualPayAmount;


                //待自提订单数
                orderQuery = new OrderCountStatisticsQuery()
                {
                    ShopBranchId       = CurrentShopBranch.Id,
                    OrderOperateStatus = Entities.OrderInfo.OrderOperateStatus.WaitSelfPickUp,
                    Fields             = new List <OrderCountStatisticsFields> {
                        OrderCountStatisticsFields.OrderCount
                    }
                };
                var pickUpOrderCount = StatisticApplication.GetOrderCount(orderQuery).OrderCount;

                //近三天发布商品数
                var productCount = ProductManagerApplication.GetProductCount(new ProductQuery
                {
                    ShopBranchId = CurrentShopBranch.Id,
                    AuditStatus  = new[] { Entities.ProductInfo.ProductAuditStatus.Audited },
                    StartDate    = now.Date.AddDays(-2)
                });


                var vshop = ServiceProvider.Instance <IVShopService> .Create.GetVShopByShopId(CurrentShopBranch.ShopId);

                var logo = "/Images/branchapp.jpg";
                if (vshop != null && vshop.State == Entities.VShopInfo.VShopStates.Normal && !string.IsNullOrEmpty(vshop.WXLogo))
                {
                    logo = vshop.WXLogo;
                }
                var shopBranch       = ShopBranchApplication.GetShopBranchById(CurrentShopBranch.Id);
                var isShelvesProduct = false;
                if (shopBranch != null && shopBranch.Status == ShopBranchStatus.Normal)
                {
                    isShelvesProduct = shopBranch.IsShelvesProduct;
                }
                return(new
                {
                    success = true,
                    data = new
                    {
                        shopName = CurrentShopBranch.ShopBranchName,
                        todayAmount = todayAmount,
                        weekAmount = weekAmount,
                        threeMonthAmounht = threeMonthAmount,
                        createProductCount = productCount,
                        pickUpOrderCount = pickUpOrderCount,
                        logo = logo,
                        shopBranchId = CurrentShopBranch.Id,
                        IsShelvesProduct = isShelvesProduct
                    }
                });
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                return(new { success = false, data = new { } });
            }
        }