public JsonResult GetOAuthList() { if (Cache.Exists(CacheKeyCollection.CACHE_OAUTHLIST)) { return(Cache.Get <JsonResult>(CacheKeyCollection.CACHE_OAUTHLIST)); } List <OAuthInfo> result = new List <OAuthInfo>(); var oauthPlugins = Core.PluginsManagement.GetPlugins <IOAuthPlugin>(true); //string siteDomain = Request.Url.Scheme + "://" + Request.Url.Host + (Request.Url.Port == 80 ? "" : ":" + Request.Url.Port); string siteDomain = CurrentUrlHelper.CurrentUrlNoPort();//信任登录不能有端口 string rootDir = IOHelper.GetMapPath("/"); result = oauthPlugins.Select(item => { return(new OAuthInfo() { Name = item.Biz.ShortName, Url = item.Biz.GetOpenLoginUrl(siteDomain + "/Login/OauthCallBack?oauthId=" + item.PluginInfo.PluginId), LogoDefault = item.Biz.Icon_Default.Replace(rootDir, "/").Replace("\\", "/"), LogoHover = item.Biz.Icon_Hover.Replace(rootDir, "/").Replace("\\", "/") }); }).ToList(); JsonResult rlt = Json(result, JsonRequestBehavior.AllowGet); Cache.Insert(CacheKeyCollection.CACHE_OAUTHLIST, rlt, 600); return(rlt); }
public object GetOrderBonus(string orderIds) { CheckUserLogin(); List <BonuModel> bonus = new List <BonuModel>(); var shopService = ServiceProvider.Instance <IShopService> .Create; var orderService = ServiceProvider.Instance <IOrderService> .Create; var bonusService = ServiceProvider.Instance <IShopBonusService> .Create; string orderids = orderIds; string[] orderArray = orderids.Split(','); foreach (string item in orderArray) { long orderid = 0; if (long.TryParse(item, out orderid)) { var BonusInfo = bonusService.GetGrantByUserOrder(orderid, CurrentUser.Id); if (BonusInfo != null) { BonuModel bonuObject = new BonuModel(); var info = ShopBonusApplication.GetBonus(BonusInfo.ShopBonusId); bonuObject.ShareHref = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/shopbonus/index/" + BonusInfo.Id; bonuObject.ShareCount = info.Count; bonuObject.ShareDetail = info.ShareDetail; bonuObject.ShareTitle = info.ShareTitle; bonuObject.ShopName = shopService.GetShop(info.ShopId).ShopName; bonus.Add(bonuObject); } } } return(new { success = true, List = bonus }); }
private ActionResult SendActivityToUser(BonusModel bonusModel, IRequestMessageBase requestBaseMsg) { string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/Bonus/Index/" + bonusModel.Id; string content = string.Format("<a href='" + url + "'>您参加{0},成功获得{1}赠送的红包</a>,点击去拆红包", bonusModel.Name, bonusModel.MerchantsName); string result = DealTextMsg(requestBaseMsg, content); return(new XmlResult(result)); }
// GET: Mobile/Payment public JsonResult Get(string orderIds) { var mobilePayments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(item => item.Biz.SupportPlatforms.Contains(PlatformType)); string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); string urlPre = webRoot + "/m-" + PlatformType + "/Payment/"; //获取待支付的所有订单 var orderService = _iOrderService; var orders = orderService.GetOrders(orderIds.Split(',').Select(t => long.Parse(t))).ToList(); var waitPayOrders = orders.Where(p => p.OrderStatus == Entities.OrderInfo.OrderOperateStatus.WaitPay); var totalAmount = waitPayOrders.Sum(t => t.OrderTotalAmount - t.CapitalAmount); /* 移到 Payment/pay实现 lly * //获取所有订单中的商品名称 * string productInfos = GetProductNameDescriptionFromOrders(orders); * string openId = Core.Helper.WebHelper.GetCookie(CookieKeysCollection.Mall_USER_OpenID); * if (!string.IsNullOrWhiteSpace(openId)) * { * openId = Core.Helper.SecureHelper.AESDecrypt(openId, "Mobile"); * } * else * { * var openUserInfo = _iMemberService.GetMember(CurrentUser.Id).MemberOpenIdInfo.FirstOrDefault(item => item.AppIdType == MemberOpenIdInfo.AppIdTypeEnum.Payment); * if (openUserInfo != null) * openId = openUserInfo.OpenId; * } * string[] strIds = orderIds.Split(','); * string notifyPre = urlPre + "Notify/", returnPre = webRoot + "/m-" + PlatformType + "/Member/PaymentToOrders?ids=" + orderIds; * * var orderPayModel = waitPayOrders.Select(p => new OrderPayInfo * { * PayId = 0, * OrderId = p.Id * }); * * //保存支付订单 * var payid = orderService.SaveOrderPayInfo(orderPayModel, PlatformType); * var ids = payid.ToString(); * */ var model = mobilePayments.ToArray().Select(item => { string url = string.Empty; return(new { id = item.PluginInfo.PluginId, //name = item.PluginInfo.DisplayName, name = PaymentApplication.GetForeGroundPaymentName(item.PluginInfo.DisplayName), logo = item.Biz.Logo, url = url }); }).OrderByDescending(d => d.id); foreach (var item in model) { Core.Log.Debug(item.id + " " + item.name); } return(Json(new { data = model, totalAmount = totalAmount })); }
public ActionResult UploadApkFile() { string strResult = "NoFile"; if (Request.Form.Files.Count > 0) { var file = Request.Form.Files[0]; if (file.Length == 0) { strResult = "文件长度为0,格式异常。"; } else { var appName = _configuration.GetValue <string>("AppName"); string filename = appName + Path.GetExtension(file.FileName); if (!CheckApkFileType(filename)) { return(Content("上传的文件格式不正确", "text/html")); } string DirUrl = IOHelper.GetMapPath("~/app/"); if (!System.IO.Directory.Exists(DirUrl)) //检测文件夹是否存在,不存在则创建 { System.IO.Directory.CreateDirectory(DirUrl); } //var curhttp = System.Web.HttpContext.Current; string url = CurrentUrlHelper.CurrentUrlNoPort(); string strfile = url + "/app/" + filename; try { var opcount = Core.Cache.Get <int>(CacheKeyCollection.UserImportOpCount); if (opcount == 0) { Core.Cache.Insert(CacheKeyCollection.UserImportOpCount, 1); } else { Core.Cache.Insert(CacheKeyCollection.UserImportOpCount, opcount + 1); } // file.SaveAs(Path.Combine(DirUrl, filename)); var fileStream = new FileStream(Path.Combine(DirUrl, filename), FileMode.OpenOrCreate); file.CopyToAsync(fileStream).Wait(); } catch { var opcount = Core.Cache.Get <int>(CacheKeyCollection.UserImportOpCount); if (opcount != 0) { Core.Cache.Insert(CacheKeyCollection.UserImportOpCount, opcount - 1); } strfile = "Error"; } strResult = strfile; } } return(Content(strResult, "text/html")); }
public ActionResult UploadApkFile() { string strResult = "NoFile"; if (Request.Files.Count > 0) { var file = Request.Files[0]; if (file.ContentLength == 0) { strResult = "文件长度为0,格式异常。"; } else { var config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); var appName = config.AppSettings.Settings["AppName"].Value; string filename = appName + Path.GetExtension(file.FileName); if (!CheckApkFileType(filename)) { return(Content("上传的文件格式不正确", "text/html")); } string DirUrl = Server.MapPath("~/app/"); if (!System.IO.Directory.Exists(DirUrl)) //检测文件夹是否存在,不存在则创建 { System.IO.Directory.CreateDirectory(DirUrl); } //var curhttp = System.Web.HttpContext.Current; string url = CurrentUrlHelper.CurrentUrlNoPort(); string strfile = url + "/app/" + filename; try { var opcount = Core.Cache.Get <int>(CacheKeyCollection.UserImportOpCount); if (opcount == 0) { Core.Cache.Insert(CacheKeyCollection.UserImportOpCount, 1); } else { Core.Cache.Insert(CacheKeyCollection.UserImportOpCount, opcount + 1); } file.SaveAs(Path.Combine(DirUrl, filename)); } catch { var opcount = Core.Cache.Get <int>(CacheKeyCollection.UserImportOpCount); if (opcount != 0) { Core.Cache.Insert(CacheKeyCollection.UserImportOpCount, opcount - 1); } strfile = "Error"; } strResult = strfile; } } return(Content(strResult, "text/html")); }
public JsonResult GetFootNew() { //页脚 var articleCategoryService = _iArticleCategoryService; var articleService = _iArticleService; //服务文章 var pageFootServiceCategory = articleCategoryService.GetSpecialArticleCategory(SpecialCategory.PageFootService); if (pageFootServiceCategory == null) { return(Json(null)); } var pageFootServiceSubCategies = articleCategoryService.GetArticleCategoriesByParentId(pageFootServiceCategory.Id).ToList(); dynamic noticeInfo = new System.Dynamic.ExpandoObject(); var allArticle = articleService.GetArticleByArticleCategoryIds(pageFootServiceSubCategies.Select(a => a.Id).ToList()).Where(p => p.IsRelease).ToList(); FootNoticeModel info = null; List <FootNoticeModel> resultList = new List <FootNoticeModel>(); pageFootServiceSubCategies.ForEach(p => { info = new FootNoticeModel() { CateogryName = p.Name, List = allArticle.Where(x => x.CategoryId == p.Id).Select(y => new ArticleInfo { Id = y.Id, Title = y.Title }).ToList() }; resultList.Add(info); }); noticeInfo.PageFootService = resultList; //页脚 noticeInfo.PageFoot = SiteSettings.PageFoot; noticeInfo.QRCode = SiteSettings.QRCode; noticeInfo.SiteName = SiteSettings.SiteName; noticeInfo.Logo = SiteSettings.Logo; noticeInfo.PCBottomPic = SiteSettings.PCBottomPic; noticeInfo.Site_SEOTitle = SiteSettings.Site_SEOTitle; noticeInfo.APPCanDownload = SiteSettings.CanDownload; if (SiteSettings.CanDownload) { string host = CurrentUrlHelper.CurrentUrlNoPort(); var link = String.Format("{0}/m-wap/home/downloadApp", host); var map = Core.Helper.QRCodeHelper.Create(link); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); noticeInfo.appqr = strUrl; } return(Json(noticeInfo, true)); }
/// <summary> /// 初始化页面头部 此方法在使用redis缓存时有可能比较慢,所以增加调试信息输出 /// </summary> void InitHeaderData() { //SiteName ViewBag.SiteName = SiteSettings.SiteName; //Logo ViewBag.Logo = SiteSettings.Logo; //搜索输入框关键字 ViewBag.Keyword = SiteSettings.Keyword; //热门关键字 ViewBag.HotKeyWords = !string.IsNullOrWhiteSpace(SiteSettings.Hotkeywords) ? SiteSettings.Hotkeywords.Split(',') : new string[] { }; //导航 ViewBag.Navigators = _iNavigationService.GetPlatNavigations().ToArray(); //分类 var categories = _iHomeCategoryService.GetHomeCategorySets().ToList(); ViewBag.Categories = categories; var categoryService = _iCategoryService; ViewBag.AllSecondCategoies = categoryService.GetFirstAndSecondLevelCategories().Where(item => item.Depth == 2 && item.IsDeleted == false).ToList(); var service = _iBrandService; var brands = new Dictionary <int, IEnumerable <BrandInfo> >(); //页脚 ViewBag.PageFoot = SiteSettings.PageFoot; //分类品牌 ViewBag.CategoryBrands = brands; //会员信息 ViewBag.Member = CurrentUser; ViewBag.APPCanDownload = SiteSettings.CanDownload; if (SiteSettings.CanDownload) { string host = CurrentUrlHelper.CurrentUrlNoPort(); var link = String.Format("{0}/m-wap/home/downloadApp", host); var map = Core.Helper.QRCodeHelper.Create(link); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); ViewBag.APPQR = strUrl; } setTheme();//主题设置 }
public ActionResult Expired(long id, string openId = "", long grantid = 0, string wxhead = "") //已过期 { ShopBonusDataModel dataModel = new ShopBonusDataModel(); dataModel.GrantId = grantid; dataModel.HeadImg = wxhead; ShopBonusModel model = new ShopBonusModel(this._bonusService.GetShopBonus(id)); dataModel.ShopAddress = GetShopAddress(model.ShopId); ViewBag.DataModel = dataModel; model.ShareImg = CurrentUrlHelper.CurrentUrlNoPort() + model.ShareImg; return(View(model)); }
//TODO:增加资产充值 /// <summary> /// 增加资产充值 /// </summary> /// <param name="orderIds">订单id集合</param> /// <returns></returns> public ActionResult ChargePay(string orderIds) { string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); if (string.IsNullOrEmpty(orderIds)) { return(RedirectToAction("index", "userCenter", new { url = "/UserCapital", tar = "UserCapital" })); } var viewmodel = OrderApplication.ChargePay(UserId, orderIds, webRoot); ViewBag.Keyword = SiteSettings.Keyword; return(View(viewmodel)); }
public object GetPaymentList(string orderIds, string typeid) { var mobilePayments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).OrderByDescending(d => d.PluginInfo.PluginId).Where(item => item.Biz.SupportPlatforms.Contains(Core.PlatformType.Android)); string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); string urlPre = webRoot + "/m-" + Core.PlatformType.Android + "/Payment/"; //获取待支付的所有订单 var orderService = ServiceProvider.Instance <IOrderService> .Create; var orders = orderService.GetOrders(orderIds.Split(',').Select(t => long.Parse(t))).Where(r => r.OrderStatus == Entities.OrderInfo.OrderOperateStatus.WaitPay); var totalAmount = orders.Sum(t => t.OrderTotalAmount - t.CapitalAmount); //获取所有订单中的商品名称 string productInfos = GetProductNameDescriptionFromOrders(orders); string[] strIds = orderIds.Split(','); string notifyPre = urlPre + "Notify/", returnPre = webRoot + "/m-" + Core.PlatformType.Android + "/Member/PaymentToOrders?ids=" + orderIds; var orderPayModel = strIds.Select(item => new Entities.OrderPayInfo { PayId = 0, OrderId = long.Parse(item) }); //保存支付订单 var payid = orderService.SaveOrderPayInfo(orderPayModel, Core.PlatformType.Android); var ids = payid.ToString(); var model = mobilePayments.ToArray().Select(item => { string url = string.Empty; try { url = item.Biz.GetRequestUrl(returnPre, notifyPre + item.PluginInfo.PluginId.Replace(".", "-") + "/", ids, totalAmount, productInfos); } catch (Exception ex) { Core.Log.Error("获取支付方式错误:", ex); } return(new { id = item.PluginInfo.PluginId, //name = item.PluginInfo.DisplayName, name = PaymentApplication.GetForeGroundPaymentName(item.PluginInfo.DisplayName), logo = item.Biz.Logo, url = url }); }); model = model.Where(item => !string.IsNullOrWhiteSpace(item.url) && item.id.Contains(typeid)).OrderByDescending(d => d.id); return(new { success = true, data = model }); }
public ActionResult Edit(FormCollection fc) { WeiActivityModel model = WeiActivityApplication.GetActivityModel(Convert.ToInt32(fc["activityId"])); if (!string.IsNullOrWhiteSpace(fc["activityTitle"])) { model.activityTitle = fc["activityTitle"].ToString(); } if (!string.IsNullOrWhiteSpace(fc["activityDetails"])) { model.activityDetails = fc["activityDetails"].ToString(); } if (!string.IsNullOrWhiteSpace(fc["endTime"])) { model.endTime = Convert.ToDateTime(fc["endTime"].ToString()); } if (!string.IsNullOrWhiteSpace(fc["participationType"])) { model.participationType = (WeiParticipateType)Enum.Parse(typeof(WeiParticipateType), fc["participationType"].ToString()); } if (!string.IsNullOrWhiteSpace(fc["participationCount"])) { model.participationCount = Convert.ToInt32(fc["participationCount"].ToString().Replace(",", " ").Trim()); } if (!string.IsNullOrWhiteSpace(fc["isPoint"])) { if (Convert.ToInt32(fc["isPoint"]) > 0) { model.consumePoint = Convert.ToInt32(fc["consumePoint"].ToString()); } else { model.consumePoint = 0; } } //临时图片地址 model.activityUrl = fc["activityUrl"]; string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-Mobile/ScratchCard/index/"; model.codeUrl = url; model.activityType = WeiActivityType.ScratchCard; long id = WeiActivityApplication.AddActivitySubmit(model); return(RedirectToAction("Detail/" + id)); }
// GET: SellerAdmin/Weixin public ActionResult Management() { var vshop = _iVShopService.GetVShopByShopId(CurrentSellerManager.ShopId); string qrCodeImagePath = string.Empty; if (vshop != null) { string vshopUrl = CurrentUrlHelper.CurrentUrlNoPort() + "/m-" + PlatformType.WeiXin.ToString() + "/vshop/detail/" + vshop.Id; qrCodeImagePath = CurrentUrlHelper.CurrentUrlNoPort() + GenerateQR(vshopUrl, vshop.Id, vshop.StrLogo); } ViewBag.QRCode = qrCodeImagePath; ViewBag.ShopId = CurrentSellerManager.ShopId; ViewBag.Shop = ShopApplication.GetShop(CurrentSellerManager.ShopId); return(View(vshop)); }
public JsonResult ShopList(int page, int rows, string titleKeyword, string tagsId, string addressId, bool?isRecommend) { ShopBranchQuery query = new ShopBranchQuery(); query.PageNo = page; query.PageSize = rows; if (!string.IsNullOrEmpty(titleKeyword)) { query.ShopBranchName = titleKeyword; } if (!string.IsNullOrEmpty(addressId)) { var regionid = Convert.ToInt32(addressId); var region = RegionApplication.GetRegion(regionid); switch (region.Level) { case Region.RegionLevel.Province: query.ProvinceId = regionid; break; case Region.RegionLevel.City: query.CityId = regionid; break; } } if (!string.IsNullOrEmpty(tagsId)) { query.ShopBranchTagId = Convert.ToInt64(tagsId); } if (isRecommend.HasValue) { query.IsRecommend = isRecommend; } var shopBranchs = ShopBranchApplication.GetShopBranchs(query); var curUrl = CurrentUrlHelper.CurrentUrlNoPort(); var list = new { rows = shopBranchs.Models.Select(item => new { id = item.Id, name = item.ShopBranchName, imgUrl = item.ShopImages, url = "/" + item.Id, tags = string.IsNullOrWhiteSpace(item.ShopBranchInTagNames) ? "" : item.ShopBranchInTagNames.Replace(",", " ") }), total = shopBranchs.Total }; return(Json(list)); }
public JsonResult AddMenu(string title, string url, string parentId, int urlType) { short num = !(parentId == "0") ? (short)2 : (short)1; string str = CurrentUrlHelper.CurrentUrlNoPort(); switch (urlType) { case 1: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/"; break; case 2: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/vshop"; break; case 3: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/category/Index"; break; case 4: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/member/center"; break; case 5: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/cart/cart"; break; } if (!string.IsNullOrEmpty(url) && (!url.ToLower().Contains("http://") && !url.ToLower().Contains("https://"))) { throw new HimallException("链接必须以http://开头"); } BaseController.Result result = new BaseController.Result(); this._iWeixinMenuService.AddMenu(new MenuInfo() { Title = title, Url = url, ParentId = Convert.ToInt64(parentId), Platform = PlatformType.WeiXin, Depth = num, ShopId = this.CurrentManager.ShopId, FullIdPath = "1", Sequence = (short)1, UrlType = new MenuInfo.UrlTypes?((MenuInfo.UrlTypes)urlType) }); result.success = true; return(this.Json((object)result)); }
/// <summary> /// 门店发货 /// </summary> /// <param name="model"></param> /// <returns></returns> public object PostShopSendGood(OrderDeliveryModel model) { CheckUserLogin(); string shopkeeperName = ""; long shopid = CurrentShopBranch.ShopId; long sbid = CurrentUser.ShopBranchId; shopkeeperName = CurrentShopBranch.UserName; var returnurl = String.Format("{0}/Common/ExpressData/SaveExpressData", CurrentUrlHelper.CurrentUrlNoPort()); if (model.deliveryType == DeliveryType.CityExpress.GetHashCode()) //同城物流 { var dadaconfig = CityExpressConfigApplication.GetDaDaCityExpressConfig(shopid); if (!dadaconfig.IsEnable) { throw new HimallApiException("未开启同城合作物流"); } var order = OrderApplication.GetOrder(model.orderId); if (order == null || order.ShopId != shopid || !(order.ShopBranchId > 0) || order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitDelivery) { throw new HimallApiException("错误的订单编号"); } //Log.Error("达达发货ShopBranchOrder-开始01:orderId:" + model.orderId); var sbdata = ShopBranchApplication.GetShopBranchById(sbid); string json = ExpressDaDaHelper.addAfterQuery(shopid, sbdata.DaDaShopId, model.shipOrderNumber); var resultObj = JsonConvert.DeserializeObject(json) as JObject; string status = resultObj["status"].ToString(); //Log.Error("达达发货ShopBranchOrder-开始02:status:" + status); if (status != "success") { //订单码过期,重发单 json = SendDaDaExpress(model.orderId, shopid, sbid, false); var rObj2 = JsonConvert.DeserializeObject(json) as JObject; string status2 = rObj2["status"].ToString(); if (status2 != "success") { string msg = rObj2["msg"].ToString(); return(ErrorResult(msg)); } } } OrderApplication.ShopSendGood(model.orderId, model.deliveryType, shopkeeperName, model.companyName, model.shipOrderNumber, returnurl); return(SuccessResult("发货成功")); }
public ActionResult Detail(long id) { FightGroupActiveModel source = FightGroupApplication.GetActive(id, false, true); if (source == null) { throw new HimallException("错误的活动信息"); } source.InitProductImages(); Mapper.CreateMap <FightGroupActiveModel, FightGroupActiveDetailModel>(); FightGroupActiveDetailModel model = Mapper.Map <FightGroupActiveDetailModel>(source); decimal memberDiscount = 1; if (base.CurrentUser != null) { memberDiscount = base.CurrentUser.MemberDiscount; } ((dynamic)base.ViewBag).Discount = memberDiscount; Shop shop = ShopApplication.GetShop(model.ShopId, false); ((dynamic)base.ViewBag).IsSelf = shop.IsSelf; model.ShareUrl = string.Format("{0}/m-{1}/FightGroup/Detail/{2}", CurrentUrlHelper.CurrentUrlNoPort(), "WeiXin", source.Id); model.ShareTitle = (source.ActiveStatus == FightGroupActiveStatus.WillStart) ? "限时限量火拼 即将开始" : "限时限量火拼 正在进行"; model.ShareImage = source.ProductDefaultImage; if (!string.IsNullOrWhiteSpace(model.ShareImage) && (model.ShareImage.Substring(0, 4) != "http")) { model.ShareImage = HimallIO.GetRomoteImagePath(model.ShareImage, null); } model.ShareDesc = source.ProductName; if (!string.IsNullOrWhiteSpace(source.ProductShortDescription)) { model.ShareDesc = model.ShareDesc + ",(" + source.ProductShortDescription + ")"; } if (model.ProductId.HasValue) { StatisticApplication.StatisticVisitCount(model.ProductId.Value, model.ShopId); } List <CustomerService> mobileCustomerService = CustomerServiceApplication.GetMobileCustomerService(model.ShopId); CustomerService item = CustomerServiceApplication.GetPreSaleByShopId(model.ShopId).FirstOrDefault <CustomerService>(p => p.Tool == CustomerServiceInfo.ServiceTool.MeiQia); if (item != null) { mobileCustomerService.Insert(0, item); } ((dynamic)base.ViewBag).CustomerServices = mobileCustomerService; return(base.View(model)); }
public JsonResult UpdateMenu(string menuId, string menuName, int urlType, string url, string parentId) { var curUrl = CurrentUrlHelper.CurrentUrlNoPort(); switch (urlType) { case 1: url = curUrl + "/m-" + PlatformType.WeiXin.ToString() + "/"; break; case 2: url = curUrl + "/m-" + PlatformType.WeiXin.ToString() + "/vshop"; break; case 3: url = curUrl + "/m-" + PlatformType.WeiXin.ToString() + "/category/Index"; break; case 4: url = curUrl + "/m-" + PlatformType.WeiXin.ToString() + "/member/center"; break; case 5: url = curUrl + "/m-" + PlatformType.WeiXin.ToString() + "/cart/cart"; break; default: break; } if ((!string.IsNullOrEmpty(url)) && (!(url.ToLower().Contains("http://") || url.ToLower().Contains("https://")))) { throw new Himall.Core.HimallException("链接必须以http://开头"); } Result result = new Result(); var menuInfo = new Entities.MenuInfo(); menuInfo.Id = Convert.ToInt64(menuId); menuInfo.Title = menuName; menuInfo.UrlType = (Entities.MenuInfo.UrlTypes)urlType; menuInfo.Url = url; menuInfo.ParentId = Convert.ToInt64(parentId); _iWeixinMenuService.UpdateMenu(menuInfo); result.success = true; return(Json(result)); }
/// <summary> /// 二維碼分享 /// </summary> /// <param name="sharePath">需分享的url</param> /// <param name="imgUrl"></param> /// <param name="imgCode"></param> public static void CreateQCode(string sharePath, out string fullPath, out string imgCode) { //var curhttp = System.Web.HttpContext.Current; string url = CurrentUrlHelper.CurrentUrlNoPort(); url = url + sharePath; fullPath = url; var map = Core.Helper.QRCodeHelper.Create(url); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); imgCode = strUrl; }
public ActionResult PaymentToOrders(string ids) { //红包数据 var bonusGrantIds = new Dictionary <long, Entities.ShopBonusInfo>(); string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/shopbonus/index/"; if (!string.IsNullOrEmpty(ids)) { string[] strIds = ids.Split(','); List <long> longIds = new List <long>(); foreach (string id in strIds) { longIds.Add(long.Parse(id)); } var result = PaymentHelper.GenerateBonus(longIds, Request.Url.Host.ToString()); foreach (var item in result) { bonusGrantIds.Add(item.Key, item.Value); } } ViewBag.Path = url; ViewBag.BonusGrantIds = bonusGrantIds; ViewBag.Shops = ShopApplication.GetShops(bonusGrantIds.Select(p => p.Value.ShopId)); ViewBag.BaseAddress = CurrentUrlHelper.CurrentUrlNoPort(); var statistic = StatisticApplication.GetMemberOrderStatistic(CurrentUser.Id); ViewBag.WaitingForComments = statistic.WaitingForComments; ViewBag.AllOrders = statistic.OrderCount; ViewBag.WaitingForRecieve = statistic.WaitingForRecieve + OrderApplication.GetWaitConsumptionOrderNumByUserId(CurrentUser.Id); ViewBag.WaitingForPay = statistic.WaitingForPay; ViewBag.WaitingForDelivery = statistic.WaitingForDelivery; var order = OrderApplication.GetUserOrders(CurrentUser.Id, 1).FirstOrDefault(); if (order != null && order.OrderType == OrderInfo.OrderTypes.FightGroup) { var gpord = FightGroupApplication.GetOrder(order.Id); if (gpord != null) { return(Redirect(string.Format("/m-{0}/FightGroup/GroupOrderOk?orderid={1}", PlatformType.ToString(), order.Id))); } } return(View("~/Areas/Mobile/Templates/Default/Views/Member/Orders.cshtml")); }
public ActionResult BasicVShopSettings() { var vshopSetting = _iVShopService.GetVShopSetting(CurrentSellerManager.ShopId); if (vshopSetting == null) { vshopSetting = new Entities.WXshopInfo(); } if (string.IsNullOrEmpty(vshopSetting.Token)) { vshopSetting.Token = CreateKey(8); } ViewBag.Url = String.Format("{0}/m-Weixin/WXApi/{1}", CurrentUrlHelper.CurrentUrlNoPort(), CurrentSellerManager.ShopId); ViewBag.VShop = _iVShopService.GetVShopByShopId(CurrentSellerManager.ShopId); ViewBag.ShopId = CurrentSellerManager.ShopId; return(View(vshopSetting)); }
public JsonResult ShopList(int page, int rows, string titleKeyword, string tagsId, string addressId, bool?isRecommend) { ShopBranchQuery query = new ShopBranchQuery { PageNo = page, PageSize = rows }; if (!string.IsNullOrEmpty(titleKeyword)) { query.ShopBranchName = titleKeyword; } if (!string.IsNullOrEmpty(addressId)) { int num = Convert.ToInt32(addressId); switch (RegionApplication.GetRegion((long)num).Level) { case Region.RegionLevel.Province: query.ProvinceId = num; break; case Region.RegionLevel.City: query.CityId = num; break; } } if (!string.IsNullOrEmpty(tagsId)) { query.ShopBranchTagId = new long?(Convert.ToInt64(tagsId)); } if (isRecommend.HasValue) { query.IsRecommend = isRecommend; } QueryPageModel <ShopBranch> shopBranchs = ShopBranchApplication.GetShopBranchs(query); string str = CurrentUrlHelper.CurrentUrlNoPort(); var data = new { rows = from item in shopBranchs.Models select new { id = item.Id, name = item.ShopBranchName, imgUrl = item.ShopImages, url = "/" + item.Id, tags = string.IsNullOrWhiteSpace(item.ShopBranchInTagNames) ? "" : item.ShopBranchInTagNames.Replace(",", " ") }, total = shopBranchs.Total }; return(base.Json(data)); }
/// <summary> /// 入驻链接 /// </summary> /// <returns></returns> public ActionResult SettledLink() { #region 商家入驻链接和二维码 string LinkUrl = String.Format("{0}/m-weixin/shopregister/step1", CurrentUrlHelper.CurrentUrlNoPort()); ViewBag.LinkUrl = LinkUrl; string qrCodeImagePath = string.Empty; if (!string.IsNullOrWhiteSpace(LinkUrl)) { Bitmap map; map = Core.Helper.QRCodeHelper.Create(LinkUrl); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); qrCodeImagePath = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); // 将图片内存流转成base64,图片以DataURI形式显示 ms.Dispose(); } ViewBag.Imgsrc = qrCodeImagePath; #endregion return(View()); }
public object GetEnablePaymentList() { var mobilePayments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).OrderByDescending(d => d.PluginInfo.PluginId).Where(item => item.Biz.SupportPlatforms.Contains(Core.PlatformType.Android)); string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); string urlPre = webRoot + "/m-" + Core.PlatformType.Android + "/Payment/"; var model = mobilePayments.ToArray().Select(item => { string url = string.Empty; return(new { id = item.PluginInfo.PluginId, name = PaymentApplication.GetForeGroundPaymentName(item.PluginInfo.DisplayName), logo = item.Biz.Logo, url = url }); }).OrderByDescending(d => d.id); return(new { success = true, data = model }); }
public ActionResult Index() { string link = string.Format("{0}/m-Wap/RegisterActivity/Gift", CurrentUrlHelper.CurrentUrlNoPort()); var map = Core.Helper.QRCodeHelper.Create(link); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); ViewBag.QR = strUrl; ViewBag.link = link; var model = CouponApplication.GetCouponSendByRegister(); return(View(model)); }
/// <summary> /// 更新菜单 /// </summary> /// <param name="menuId"></param> /// <param name="menuName"></param> /// <param name="urlType"></param> /// <param name="url"></param> /// <param name="parentId"></param> /// <returns></returns> public JsonResult UpdateMenu(string menuId, string menuName, int urlType, string url, string parentId) { string str = CurrentUrlHelper.CurrentUrlNoPort(); switch (urlType) { case 1: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/"; break; case 2: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/vshop"; break; case 3: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/category/Index"; break; case 4: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/member/center"; break; case 5: url = str + "/m-" + PlatformType.WeiXin.ToString() + "/cart/cart"; break; } if (!string.IsNullOrEmpty(url) && (!url.ToLower().Contains("http://") && !url.ToLower().Contains("https://"))) { throw new HimallException("链接必须以http://开头"); } BaseController.Result result = new BaseController.Result(); this._iWeixinMenuService.UpdateMenu(new MenuInfo() { Id = Convert.ToInt64(menuId), Title = menuName, UrlType = new MenuInfo.UrlTypes?((MenuInfo.UrlTypes)urlType), Url = url, ParentId = Convert.ToInt64(parentId) }); result.success = true; return(this.Json((object)result)); }
public JsonResult ConfirmRefund(long refundId, string managerRemark) { Result result = new Result(); string notifyurl = ""; string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); //获取异步通知地址 notifyurl = webRoot + "/Pay/RefundNotify/{0}"; string refundurl = _iRefundService.ConfirmRefund(refundId, managerRemark, CurrentManager.UserName, notifyurl); result.success = true; if (!string.IsNullOrWhiteSpace(refundurl)) { result.msg = refundurl; result.status = 2; //表示需要继续异步请求 } return(Json(result)); }
public JsonResult PaymentList(decimal balance) { string webRoot = CurrentUrlHelper.CurrentUrlNoPort(); //获取同步返回地址 string returnUrl = webRoot + "/pay/CapitalChargeReturn/{0}"; //获取异步通知地址 string payNotify = webRoot + "/pay/CapitalChargeNotify/{0}/"; var payments = Core.PluginsManagement.GetPlugins <IPaymentPlugin>(true).Where(item => item.Biz.SupportPlatforms.Contains(PlatformType.PC)); const string RELATEIVE_PATH = "/Plugins/Payment/"; //不重复数字 string ids = _iMemberCapitalService.CreateCode(Mall.Entities.CapitalDetailInfo.CapitalDetailType.ChargeAmount).ToString(); var models = payments.Select(item => { string requestUrl = string.Empty; try { requestUrl = item.Biz.GetRequestUrl(string.Format(returnUrl, EncodePaymentId(item.PluginInfo.PluginId) + "-" + balance.ToString() + "-" + CurrentUser.Id.ToString()), string.Format(payNotify, EncodePaymentId(item.PluginInfo.PluginId) + "-" + balance.ToString() + "-" + CurrentUser.Id.ToString()), ids, balance, "预存款充值"); } catch (Exception ex) { Core.Log.Error("支付页面加载支付插件出错", ex); } return(new PaymentModel() { Logo = RELATEIVE_PATH + item.PluginInfo.ClassFullName.Split(',')[1] + "/" + item.Biz.Logo, RequestUrl = requestUrl, UrlType = item.Biz.RequestUrlType, Id = item.PluginInfo.PluginId }); }).OrderByDescending(d => d.Id).AsEnumerable(); models = models.Where(item => !string.IsNullOrEmpty(item.RequestUrl));//只选择正常加载的插件 return(Json(models)); }
// GET: SellerAdmin/Login public ActionResult Index() { ViewBag.SiteName = SiteSettings.SiteName; ViewBag.Logo = SiteSettings.Logo; ViewBag.IsOpenPC = SiteSettings.IsOpenPC ? 1 : 0; var oauthPlugins = Core.PluginsManagement.GetPlugins <IOAuthPlugin>(true); //string siteDomain = Request.Url.Scheme + "://" + Request.Url.Host + (Request.Url.Port == 80 ? "" : ":" + Request.Url.Port); string siteDomain = CurrentUrlHelper.CurrentUrlNoPort();//信任登录不能有端口 string rootDir = IOHelper.GetMapPath("/"); var oauthPluginsModel = oauthPlugins.Select(item => { return(new OAuthInfo() { Name = item.Biz.ShortName, Url = item.Biz.GetOpenLoginUrl(siteDomain + "/Login/OauthCallBack?oauthId=" + item.PluginInfo.PluginId), LogoDefault = item.Biz.Icon_Default.Replace(rootDir, "/"), LogoHover = item.Biz.Icon_Hover.Replace(rootDir, "/") }); }); return(View(oauthPluginsModel)); }
public ActionResult Add(BonusModel model) { if (!string.IsNullOrEmpty(model.ImagePath)) { if (!HimallIO.ExistDir("/Storage/Plat/Bonus")) { HimallIO.CreateDir("/Storage/Plat/Bonus"); } //转移图片 if (model.ImagePath.Contains("/temp/")) { string source = model.ImagePath.Substring(model.ImagePath.LastIndexOf("/temp")); string dest = @"/Storage/Plat/Bonus/"; model.ImagePath = Path.Combine(dest, Path.GetFileName(source)); Core.HimallIO.CopyFile(source, model.ImagePath, true); } else if (model.ImagePath.Contains("/Storage/")) { model.ImagePath = model.ImagePath.Substring(model.ImagePath.LastIndexOf("/Storage")); } } else { model.ImagePath = ""; } model.StartTime = DateTime.Now; if (Himall.Entities.BonusInfo.BonusType.Prize == model.Type) { model.EndTime = DateTime.Now.AddYears(20); } string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/bonus/index/"; _iBonusService.Add(model, url); return(RedirectToAction("Management")); throw new HimallException("验证失败"); }