public ActionResult CustomerServicesEdit() { var css = CustomerServiceApplication.GetPlatformCustomerService(); var count = 3;//客服个数,可设计成从站点配置取 var models = new PlatformCustomerServiceModel[count]; for (int i = 0; i < css.Count; i++) { models[i] = new PlatformCustomerServiceModel(); css[i].Map(models[i]); } for (int i = css.Count; i < models.Length; i++) { models[i] = new PlatformCustomerServiceModel(); models[i].CreateId = Guid.NewGuid(); models[i].Tool = Entities.CustomerServiceInfo.ServiceTool.QQ; } if (!models.Any(p => p.Tool == Entities.CustomerServiceInfo.ServiceTool.MeiQia)) { models.First(p => p.Id == 0).Tool = Entities.CustomerServiceInfo.ServiceTool.MeiQia;//设置其中一个客服为美洽客服 } return(View(models)); }
/// <summary> /// 获取平台客服信息 /// </summary> /// <returns></returns> public JsonResult GetPlatformCustomerService() { //List<CustomerService> result = CustomerServiceApplication.GetPlatformCustomerService(true, false).OrderBy(t => t.Tool); var result = CustomerServiceApplication.GetPlatformCustomerService(true, false).OrderByDescending(t => t.Tool); return(Json(result, true)); }
// GET: Mobile/Home public ActionResult Index(int ispv = 0, string tn = "") { string crrentTemplateName = "t1"; var curr = _iTemplateSettingsService.GetCurrentTemplate(0); if (null != curr) { crrentTemplateName = curr.CurrentTemplateName; } if (ispv == 1) { if (!string.IsNullOrWhiteSpace(tn)) { crrentTemplateName = tn; } } ViewBag.Title = SiteSettings.SiteName + "首页"; ViewBag.FootIndex = 0; var services = CustomerServiceApplication.GetPlatformCustomerService(true, true); ViewBag.CustomerServices = services; VTemplateHelper.DownloadTemplate(crrentTemplateName, VTemplateClientTypes.WapIndex, 0); return(View(string.Format("~/Areas/Admin/Templates/vshop/{0}/Skin-HomePage.cshtml", crrentTemplateName))); }
// GET: Mobile/CustomerServices public ActionResult PlatCustomerServices() { var services = CustomerServiceApplication.GetPlatformCustomerService(true, true); //var meiqia = CustomerServiceApplication.GetPlatformCustomerService(true, false).FirstOrDefault(p => p.Tool == Entities.CustomerServiceInfo.ServiceTool.MeiQia); //if (meiqia != null) // services.Insert(0, meiqia); return(View(services)); }
public ActionResult Header() { ViewBag.Now = DateTime.Now; bool isLogin = CurrentUser != null; var model = new ProductPartialHeaderModel(); model.PlatformCustomerServices = CustomerServiceApplication.GetPlatformCustomerService(true, false); model.isLogin = isLogin ? "true" : "false"; //用户积分 model.MemberIntegral = isLogin ? _iMemberIntegralService.GetMemberIntegral(CurrentUser.Id).AvailableIntegrals : 0; //关注诊疗项目 //var concern = isLogin ? _iProductService.GetUserAllConcern(CurrentUser.Id) : new List<FavoriteInfo>(); //model.Concern = concern.Take(10).ToList(); List <IBaseCoupon> baseCoupons = new List <IBaseCoupon>(); //优惠卷 var coupons = isLogin ? _iCouponService.GetAllUserCoupon(CurrentUser.Id).ToList() : new List <UserCouponInfo>(); coupons = coupons == null ? new List <UserCouponInfo>() : coupons; baseCoupons.AddRange(coupons); //红包 var shopBonus = isLogin ? _iShopBonusService.GetCanUseDetailByUserId(CurrentUser.Id) : new List <ShopBonusReceiveInfo>(); shopBonus = shopBonus == null ? new List <ShopBonusReceiveInfo>() : shopBonus; baseCoupons.AddRange(shopBonus); model.BaseCoupon = baseCoupons; //广告 var imageAds = _iSlideAdsService.GetImageAds(0).Where(p => p.TypeId == Himall.CommonModel.ImageAdsType.HeadRightAds).ToList(); if (imageAds.Count > 0) { ViewBag.HeadAds = imageAds; } else { ViewBag.HeadAds = _iSlideAdsService.GetImageAds(0).Take(1).ToList(); } //浏览的诊疗项目 //var browsingPro = isLogin ? BrowseHistrory.GetBrowsingProducts(10, CurrentUser == null ? 0 : CurrentUser.Id) : new List<ProductBrowsedHistoryModel>(); //model.BrowsingProducts = browsingPro; InitHeaderData(); return(PartialView("~/Areas/Web/Views/Shared/Header.cshtml", model)); }
// GET: Mobile/Home public ActionResult Index(int ispv = 0, string tn = "") { //Model.SlideAdInfo.SlideAdType slideAdType ; //switch(PlatformType) //{ // case Core.PlatformType.WeiXin: // slideAdType = Model.SlideAdInfo.SlideAdType.WeixinHome; // break; // default : // slideAdType = Model.SlideAdInfo.SlideAdType.WeixinHome;//暂时都调用微信端数据 // break; //} string crrentTemplateName = "t1"; var curr = _iTemplateSettingsService.GetCurrentTemplate(0); if (null != curr) { crrentTemplateName = curr.CurrentTemplateName; } if (ispv == 1) { if (!string.IsNullOrWhiteSpace(tn)) { crrentTemplateName = tn; } } Core.Log.Debug("crrentTemplateName=" + crrentTemplateName); ViewBag.Title = CurrentSiteSetting.SiteName + "首页"; ViewBag.FootIndex = 0; var services = CustomerServiceApplication.GetPlatformCustomerService(true, true); var meiqia = CustomerServiceApplication.GetPlatformCustomerService(true, false).FirstOrDefault(p => p.Tool == Model.CustomerServiceInfo.ServiceTool.MeiQia); if (meiqia != null) { services.Insert(0, meiqia); } ViewBag.CustomerServices = services; return(View(string.Format("~/Areas/Admin/Templates/vshop/{0}/Skin-HomePage.cshtml", crrentTemplateName))); }
//APP首页配置共用于安卓和IOS,这里的平台类型写的为IOS,安卓调用首页接口数据时平台类型也选IOS public APPHome Get(int pageNo, int pageSize) { var slideImageSettings = ServiceProvider.Instance <ISlideAdsService> .Create.GetSlidAds(0, Entities.SlideAdInfo.SlideAdType.IOSShopHome); var images = ServiceProvider.Instance <ISlideAdsService> .Create.GetImageAds(0, Himall.CommonModel.ImageAdsType.APPSpecial).ToList(); var mhproser = ServiceProvider.Instance <IMobileHomeProductsService> .Create; var data = mhproser.GetMobileHomeProducts(0, PlatformType.IOS, pageNo, pageSize); var totalProducts = data.Total; var homeProducts = data.Models; decimal discount = 1M; if (CurrentUser != null) { discount = CurrentUser.MemberDiscount; } var products = new List <HomeProduct>(); var limitService = ServiceProvider.Instance <ILimitTimeBuyService> .Create; var fight = FightGroupApplication.GetFightGroupPrice(); var allProducts = ProductManagerApplication.GetProducts(homeProducts.Select(p => p.ProductId)); var allShops = ShopApplication.GetShops(allProducts.Select(p => p.ShopId)); foreach (var item in homeProducts) { var limitBuy = limitService.GetLimitTimeMarketItemByProductId(item.ProductId); var product = allProducts.FirstOrDefault(p => p.Id == item.ProductId); var shop = allShops.FirstOrDefault(p => p.Id == product.ShopId); decimal minSalePrice = shop.IsSelf ? product.MinSalePrice * discount : product.MinSalePrice; if (limitBuy != null) { minSalePrice = limitBuy.MinPrice; //限时购不打折 } var isFight = fight.Where(r => r.ProductId == item.ProductId).FirstOrDefault(); long activeId = 0; if (isFight != null) { minSalePrice = isFight.ActivePrice; activeId = isFight.ActiveId; } products.Add(new HomeProduct() { Id = item.ProductId.ToString(), ImageUrl = HimallIO.GetRomoteProductSizeImage(product.RelativePath, 1, (int)CommonModel.ImageSize.Size_220), Name = product.ProductName, MarketPrice = product.MarketPrice.ToString(), SalePrice = minSalePrice.ToString("f2"), Discount = product.MarketPrice <= 0 ? "0" : (minSalePrice / product.MarketPrice).ToString("0.0"), Url = Core.HimallIO.GetRomoteImagePath("/m-ios/product/detail/" + item.ProductId), FightGroupId = activeId }); } var iconSettings = ServiceProvider.Instance <ISlideAdsService> .Create.GetSlidAds(0, Entities.SlideAdInfo.SlideAdType.APPIcon); var icon = iconSettings.ToArray().Select(item => new HomeSlides { Desc = item.Description, ImageUrl = Core.HimallIO.GetRomoteImagePath(item.ImageUrl), Url = item.Url }); var services = CustomerServiceApplication.GetPlatformCustomerService(true, true); //var meiqia = CustomerServiceApplication.GetPlatformCustomerService(true, false).FirstOrDefault(p => p.Tool == Entities.CustomerServiceInfo.ServiceTool.MeiQia); //if (meiqia != null) // services.Insert(0, meiqia); APPHome appHome = new APPHome(); appHome.success = true; //2017年9月1号 商城首页接口修改(把原广告图片的去掉,只保留商品) appHome.TotalProduct = totalProducts; appHome.Icon = icon; //appHome.Slide = slides;//轮播图数组 //appHome.Topic = homeImage;//专题数组 appHome.Product = products; appHome.CustomerServices = services; return(appHome); }
/// <summary> /// 页面缓存时间 /// </summary> // GET: Web/ProductPartial //[OutputCache(Duration = ConstValues.PAGE_CACHE_DURATION)] public ActionResult Header() { ViewBag.Now = DateTime.Now; bool isLogin = CurrentUser != null; var model = new ProductPartialHeaderModel(); model.PlatformCustomerServices = CustomerServiceApplication.GetPlatformCustomerService(true, false); model.isLogin = isLogin ? "true" : "false"; //用户积分 model.MemberIntegral = isLogin ? MemberIntegralApplication.GetAvailableIntegral(CurrentUser.Id) : 0; //关注商品 var user = CurrentUser?.Id ?? 0; var baseCoupons = new List <DisplayCoupon>(); //优惠卷 var usercoupons = _iCouponService.GetAllUserCoupon(user);//优惠卷 var coupons = CouponApplication.GetCouponInfo(usercoupons.Select(p => p.CouponId)); var shops = ShopApplication.GetShops(coupons.Select(p => p.ShopId)); var shopBonus = ShopBonusApplication.GetShopBounsByUser(user);//红包 baseCoupons.AddRange(usercoupons.Select(item => { var coupon = coupons.FirstOrDefault(p => p.Id == item.CouponId); var shop = shops.FirstOrDefault(p => p.Id == coupon.ShopId); return(new DisplayCoupon { Type = CommonModel.CouponType.Coupon, Limit = coupon.OrderAmount, Price = item.Price, ShopId = shop.Id, ShopName = shop.ShopName, EndTime = coupon.EndTime, }); })); baseCoupons.AddRange(shopBonus.Select(p => new DisplayCoupon { Type = CommonModel.CouponType.ShopBonus, EndTime = p.Bonus.DateEnd, Limit = p.Bonus.UsrStatePrice, Price = p.Receive.Price, ShopId = p.Shop.Id, ShopName = p.Shop.ShopName, UseState = p.Bonus.UseState })); model.BaseCoupon = baseCoupons; //广告 var imageAds = _iSlideAdsService.GetImageAds(0).Where(p => p.TypeId == Himall.CommonModel.ImageAdsType.HeadRightAds).ToList(); if (imageAds.Count > 0) { ViewBag.HeadAds = imageAds; } else { ViewBag.HeadAds = _iSlideAdsService.GetImageAds(0).Take(1).ToList(); } //浏览的商品 //var browsingPro = isLogin ? BrowseHistrory.GetBrowsingProducts(10, CurrentUser == null ? 0 : CurrentUser.Id) : new List<ProductBrowsedHistoryModel>(); //model.BrowsingProducts = browsingPro; InitHeaderData(); string html = System.IO.File.ReadAllText(this.Server.MapPath(_templateHeadHtmlFileFullName));//读取模板头部html静态文件内容 ViewBag.Html = html; return(PartialView("~/Areas/Web/Views/Shared/Header.cshtml", model)); }
//APP首页配置共用于安卓和IOS,这里的平台类型写的为IOS,安卓调用首页接口数据时平台类型也选IOS public APPHome Get(int pageNo, int pageSize) { var slideImageSettings = ServiceProvider.Instance <ISlideAdsService> .Create.GetSlidAds(0, SlideAdInfo.SlideAdType.IOSShopHome); //var slides = slideImageSettings.ToArray().Select(item => new HomeSlides { ImageUrl = "http://" + Url.Request.RequestUri.Host + item.ImageUrl, Url = item.Url }); var slides = slideImageSettings.ToArray().Select(item => new HomeSlides { ImageUrl = Core.HimallIO.GetRomoteImagePath(item.ImageUrl), Url = item.Url }); var images = ServiceProvider.Instance <ISlideAdsService> .Create.GetImageAds(0, Himall.CommonModel.ImageAdsType.APPSpecial).ToList(); //var images = ServiceProvider.Instance<ISlideAdsService>.Create.GetImageAds(0).Take(5).ToList(); var homeImage = images.Select(item => new HomeImage { //ImageUrl = "http://" + Url.Request.RequestUri.Host + item.ImageUrl, ImageUrl = Core.HimallIO.GetRomoteImagePath(item.ImageUrl), Url = item.Url }); var totalProducts = ServiceProvider.Instance <IMobileHomeProductsService> .Create.GetMobileHomePageProducts(0, Core.PlatformType.IOS).Count().ToString(); var homeProducts = ServiceProvider.Instance <IMobileHomeProductsService> .Create.GetMobileHomePageProducts(0, Core.PlatformType.IOS).OrderBy(item => item.Sequence).ThenByDescending(o => o.Id).Skip((pageNo - 1) * pageSize).Take(pageSize); decimal discount = 1M; if (CurrentUser != null) { discount = CurrentUser.MemberDiscount; } var products = new List <HomeProduct>(); if (homeProducts != null) { var limitService = ServiceProvider.Instance <ILimitTimeBuyService> .Create; foreach (var item in homeProducts.ToArray()) { var limitBuy = limitService.GetLimitTimeMarketItemByProductId(item.ProductId); decimal minSalePrice = item.Himall_Products.Himall_Shops.IsSelf ? item.Himall_Products.MinSalePrice * discount : item.Himall_Products.MinSalePrice; var isValidLimitBuy = "false"; if (limitBuy != null) { minSalePrice = limitBuy.MinPrice; //限时购不打折 } products.Add(new HomeProduct() { Id = item.ProductId.ToString(), // //ImageUrl = "http://" + Url.Request.RequestUri.Host + item.Himall_Products.GetImage(ProductInfo.ImageSize.Size_220), ImageUrl = Core.HimallIO.GetRomoteProductSizeImage(item.Himall_Products.RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_220), Name = item.Himall_Products.ProductName, MarketPrice = item.Himall_Products.MarketPrice.ToString(), SalePrice = minSalePrice.ToString("f2"), Discount = (minSalePrice / item.Himall_Products.MarketPrice).ToString("0.0"), //Url = "http://" + Url.Request.RequestUri.Host + "/m-ios/product/detail/" + item.ProductId Url = Core.HimallIO.GetRomoteImagePath("/m-ios/product/detail/" + item.ProductId) }); } } //var products = homeProducts.ToArray().Select(item => new HomeProduct //{ //CommentsCount=item.Himall_Products.Himall_Shops.IsSelf // Id = item.ProductId.ToString(), // //ImageUrl = "http://" + Url.Request.RequestUri.Host + item.Himall_Products.GetImage(ProductInfo.ImageSize.Size_220), // ImageUrl = Core.HimallIO.GetRomoteProductSizeImage(item.Himall_Products.RelativePath, 1, (int)Himall.CommonModel.ImageSize.Size_220), // Name = item.Himall_Products.ProductName, // MarketPrice = item.Himall_Products.MarketPrice.ToString(), // // SalePrice = item.Himall_Products.MinSalePrice.ToString(), // SalePrice = item.Himall_Products.Himall_Shops.IsSelf ? item.Himall_Products.MinSalePrice * discount.ToString() : item.Himall_Products.MinSalePrice.ToString(), // Discount = (item.Himall_Products.MinSalePrice / item.Himall_Products.MarketPrice).ToString("0.0"), // //Url = "http://" + Url.Request.RequestUri.Host + "/m-ios/product/detail/" + item.ProductId // Url = Core.HimallIO.GetRomoteImagePath("/m-ios/product/detail/" + item.ProductId) //}); var iconSettings = ServiceProvider.Instance <ISlideAdsService> .Create.GetSlidAds(0, SlideAdInfo.SlideAdType.APPIcon); var icon = iconSettings.ToArray().Select(item => new HomeSlides { Desc = item.Description, ImageUrl = Core.HimallIO.GetRomoteImagePath(item.ImageUrl), Url = item.Url }); var services = CustomerServiceApplication.GetPlatformCustomerService(true, true); var meiqia = CustomerServiceApplication.GetPlatformCustomerService(true, false).FirstOrDefault(p => p.Tool == CustomerServiceInfo.ServiceTool.MeiQia); if (meiqia != null) { services.Insert(0, meiqia); } APPHome appHome = new APPHome(); appHome.Success = "true"; appHome.TotalProduct = totalProducts; appHome.Icon = icon; appHome.Slide = slides; appHome.Topic = homeImage; appHome.Product = products; appHome.CustomerServices = services; return(appHome); }