Exemple #1
0
        /// <summary>
        /// 通过地区获取店面信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetShopPagingReqest request)
        {
            var shopRequest = new GetShopPageRequest()
            {
                LoginUserId = request.LoginUserId,
                PageCurrent = request.PageCurrent,
                PageSize    = request.PageSize,
            };

            if (!ComLib.HandleRequest(httpContext, shopRequest))
            {
                return(ResponsePagingBase.Success(new List <OpShopView>(), 0));
            }
            var shops = await _shopBll.GetShopPage(shopRequest);

            if (shops == null || shops.Item2 == 0)
            {
                return(ResponsePagingBase.Success(new List <OpShopView>(), 0));
            }
            var areaIds = new List <long>();

            foreach (var g in shops.Item1)
            {
                areaIds.Add(g.Province.Value);
                areaIds.Add(g.City.Value);
                areaIds.Add(g.District.Value);
                areaIds.Add(g.Street.Value);
            }
            var areas = await _areaBll.GetArea(areaIds.Distinct().ToList());

            return(ResponsePagingBase.Success(shops.Item1.Select(p => new OpShopView()
            {
                ShopName = p.ShopName,
                ShopTelphone = p.ShopTelphone,
                ShopAddress = p.ShopAddress,
                ShopLinkMan = p.ShopLinkMan,
                Province = GetAreaName(p.Province.Value, areas),
                City = GetAreaName(p.City.Value, areas),
                District = GetAreaName(p.District.Value, areas),
                Stree = GetAreaName(p.Street.Value, areas)
            }), shops.Item2));
        }
        /// <summary>
        /// 通过地区获取店面信息
        /// </summary>
        /// <param name="httpContext"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ResponsePagingBase> ProcessAction(HttpContext httpContext, GetShopPageRequest request)
        {
            if (request.SceneType != (int)GetShopPageSceneTypeEnum.DataLimitSetting && !ComLib.HandleRequest(httpContext, request))
            {
                return(ResponsePagingBase.Success(new List <GetShopPageView>(), 0));
            }
            var shops = await _shopBll.GetShopPage(request);

            var leaderNames = GetLeaderNames(shops.Item1.ToList(), request.SceneType);

            return(ResponsePagingBase.Success(shops.Item1.Select(p => new GetShopPageView()
            {
                ShopId = p.ShopId,
                ShopName = p.ShopName,
                ShopTelphone = p.ShopTelphone,
                ProvinceName = GetAreaName(p.Province),
                CityName = GetAreaName(p.City),
                DistrictName = GetAreaName(p.District),
                LicenseNum = string.Empty,
                ShopAddress = p.ShopAddress,
                LeaderName = GetLeaderName(p.OrgId, request.SceneType, leaderNames)
            }), shops.Item2));
        }