/// <summary> /// 门店首页 /// </summary> /// <param name="shopBranchId">门店ID</param> /// <returns></returns> public object GetStoreHome(long shopBranchId) { var shopBranch = ShopBranchApplication.GetShopBranchById(shopBranchId); if (shopBranch == null) { return(Json(new { Success = false, Message = "获取当前门店信息错误!" })); } shopBranch.ShopImages = string.IsNullOrWhiteSpace(shopBranch.ShopImages) ? "" : Core.HimallIO.GetRomoteImagePath(shopBranch.ShopImages); shopBranch.AddressDetail = ShopBranchApplication.RenderAddress(shopBranch.AddressPath, shopBranch.AddressDetail, 2); var shopCategory = ShopCategoryApplication.GetCategoryByParentId(0, shopBranch.ShopId).Select(item => { return(new { Id = item.Id, Name = item.Name }); }); var result = new { Success = true, StoreInfo = shopBranch, ShopCategory = shopCategory }; return(Json(result)); }
/// <summary> /// 获取门店信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult <Result <dynamic> > GetStoreInfo(long id, string fromLatLng = "") { CheckOpenStore(); var shopBranch = ShopBranchApplication.GetShopBranchById(id); if (shopBranch == null) { throw new HimallApiException(ApiErrorCode.Parameter_Error, "id"); } var shop = ShopApplication.GetShop(shopBranch.ShopId); if (null != shop && shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.HasExpired) { return(Json(ErrorResult <dynamic>("此店铺已过期"))); } if (null != shop && shop.ShopStatus == Entities.ShopInfo.ShopAuditStatus.Freeze) { return(Json(ErrorResult <dynamic>("此店铺已冻结"))); } if (!string.IsNullOrWhiteSpace(fromLatLng)) { shopBranch.Distance = ShopBranchApplication.GetLatLngDistances(fromLatLng, string.Format("{0},{1}", shopBranch.Latitude, shopBranch.Longitude)); } shopBranch.AddressDetail = ShopBranchApplication.RenderAddress(shopBranch.AddressPath, shopBranch.AddressDetail, 2); shopBranch.ShopImages = HimallIO.GetRomoteImagePath(shopBranch.ShopImages); Mapper.CreateMap <ShopBranch, HomeGetShopBranchInfoModel>(); var store = Mapper.Map <ShopBranch, HomeGetShopBranchInfoModel>(shopBranch); var homepageBranch = ProcessBranchHomePageData(new List <ShopBranch>() { shopBranch }, true).FirstOrDefault(); //过滤不能领取的优惠券 homepageBranch.ShopAllActives.ShopCoupons = homepageBranch.ShopAllActives.ShopCoupons.ToList(); //统计门店访问人数 StatisticApplication.StatisticShopBranchVisitUserCount(shopBranch.ShopId, shopBranch.Id); return(JsonResult <dynamic>(new { Store = store, homepageBranch.ShopAllActives, CommentScore = ShopBranchApplication.GetServiceMark(store.Id).ComprehensiveMark, //评分 })); }
/// <summary> /// 门店首页 /// </summary> /// <param name="id">门店ID</param> /// <returns></returns> public ActionResult Index(long id = 0) { bool isOpenStore = SiteSettingApplication.GetSiteSettings() != null && SiteSettingApplication.GetSiteSettings().IsOpenStore; if (!isOpenStore) { throw new Core.HimallException("门店未授权!"); } var shopBranch = ShopBranchApplication.GetShopBranchById(id); if (shopBranch == null) { return(RedirectToAction("Error404", "Error", new { area = "Web" })); } shopBranch.AddressDetail = ShopBranchApplication.RenderAddress(shopBranch.AddressPath, shopBranch.AddressDetail, 2); ViewBag.ShopBranch = shopBranch; ViewBag.ShopCategory = ShopCategoryApplication.GetCategoryByParentId(0, shopBranch.ShopId); return(View()); }