public async Task <ResponsePagingBase> GetShopPaging([FromBody] GetShopPagingReqest request) { try { var action = new GetShopPagingAction(_shopBll, _areaBll); return(await action.ProcessAction(this.HttpContext, request)); } catch (Exception ex) { Log.Error(request, ex, this.GetType()); return(new ResponsePagingBase().GetResponseCodeError()); } }
/// <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)); }