/// <summary>
        /// 基本设置
        /// </summary>
        /// <returns></returns>
        public ActionResult BasicSettings()
        {
            SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings();

            if (string.IsNullOrEmpty(siteSettings.WeixinToken))
            {
                siteSettings.WeixinToken = this.CreateKey(8);
                this._iSiteSettingService.SetSiteSettings(siteSettings);
            }
            SiteSettingModel model = new SiteSettingModel
            {
                WeixinAppId     = string.IsNullOrEmpty(siteSettings.WeixinAppId) ? string.Empty : siteSettings.WeixinAppId.Trim(),
                WeixinAppSecret = string.IsNullOrEmpty(siteSettings.WeixinAppSecret) ? string.Empty : siteSettings.WeixinAppSecret.Trim(),
                WeixinToKen     = siteSettings.WeixinToken.Trim()
            };

            ((dynamic)base.ViewBag).Url = string.Format("{0}/m-Weixin/WXApi", CurrentUrlHelper.CurrentUrlNoPort());
            if (DemoAuthorityHelper.IsDemo())
            {
                model.WeixinAppId              = "*".PadRight(model.WeixinAppId.Length, '*');
                model.WeixinAppSecret          = "*".PadRight(model.WeixinAppSecret.Length, '*');
                ((dynamic)base.ViewBag).isDemo = true;
            }
            return(base.View(model));
        }
        public JsonResult ChargeSubmit(decimal amount)
        {
            string webRoot = CurrentUrlHelper.CurrentUrlNoPort();
            var    model   = BillingApplication.PaymentList(CurrentSellerManager.ShopId, amount, webRoot);

            return(Json(model.models));
        }
Example #3
0
        // GET: Mobile/Register
        public ActionResult Index(long id = 0, string openid = "")
        {
            ViewBag.Introducer = id;
            if (id > 0)
            {
                if (string.IsNullOrWhiteSpace(openid))
                {
                    string webRoot = CurrentUrlHelper.CurrentUrlNoPort();
                    string url     = webRoot + "/m-" + PlatformType + "/Register/InviteRegist?id=" + id;
                    if (PlatformType == PlatformType.WeiXin)
                    {
                        return(Redirect("/m-" + PlatformType.ToString() + "/WXApi/WXAuthorize?returnUrl=" + url));
                    }
                    else
                    {
                        return(Redirect(url));
                    }
                }
            }
            var setting = SiteSettingApplication.SiteSettings;
            var type    = setting.RegisterType;

            ViewBag.EmailVerifOpen = setting.EmailVerifOpen;
            if (type == (int)RegisterTypes.Mobile)
            {
                return(View("MobileReg"));
            }
            return(View());
        }
Example #4
0
        public JsonResult List(long?categoryId, string titleKeyWords, int rows, int page, string Sort, bool?isAsc)
        {
            var    articles = _iArticleService.Find(categoryId, titleKeyWords, rows, page, Sort: Sort, isAsc: isAsc);
            string host     = CurrentUrlHelper.CurrentUrl();
            string urltmp   = string.Format(@"{0}{1}/", host, Url.Action("Details", "Article", new { Area = "Web" }));

            ////如果未开启PC端授权,则只保留平台公告分类数据(FG:无平台公告分类)
            //if (!SiteSettingApplication.SiteSettings.IsOpenPC )
            //{
            //    articles.Models.RemoveAll(p => !p.ArticleCategoryInfo.Name.Contains("平台公告"));
            //}
            var categories    = _iArticleCategoryService.GetCategories();
            var articleModels = articles.Models.Select(item => new
            {
                id              = item.Id,
                categoryId      = item.CategoryId,
                categoryName    = categories.FirstOrDefault(p => p.Id == item.CategoryId)?.Name ?? string.Empty,
                isShow          = item.IsRelease,
                title           = item.Title,
                displaySequence = item.DisplaySequence,
                showurl         = urltmp + item.Id.ToString(),
                addDate         = item.AddDate.ToString("yyyy-MM-dd HH:mm:ss")
            });
            var data = new { rows = articleModels, total = articles.Total };

            return(Json(data));
        }
Example #5
0
        public ActionResult NotStart(long id)  //未开始
        {
            ShopBonusModel model = new ShopBonusModel(this._bonusService.GetShopBonus(id));

            model.ShareImg = CurrentUrlHelper.CurrentUrlNoPort() + model.ShareImg;
            return(View(model));
        }
Example #6
0
        public ActionResult Detail(long id)
        {
            string           url      = CurrentUrlHelper.CurrentUrlNoPort() + "/m-Mobile/BigWheel/index/";
            WeiActivityModel WeiModel = WeiActivityApplication.GetActivityModel(id, url);

            return(View(WeiModel));
        }
Example #7
0
        public ActionResult Detail(long Id)
        {
            var model = _iCouponService.GetCouponInfo(CurrentSellerManager.ShopId, Id);

            if (model != null)
            {
                if (model.IsSyncWeiXin == 1 && model.WXAuditStatus != (int)WXCardLogInfo.AuditStatusEnum.Audited)
                {
                    throw new MallException("同步微信优惠券未审核通过时不可修改。");
                }
            }
            string host = CurrentUrlHelper.CurrentUrlNoPort();

            ViewBag.Url = String.Format("{0}/m-wap/vshop/CouponInfo/{1}", host, model.Id);
            var          map = Core.Helper.QRCodeHelper.Create(ViewBag.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();
            //  显示
            ViewBag.Image = strUrl;
            var market = _iMarketService.GetMarketService(CurrentSellerManager.ShopId, MarketType.Coupon);

            ViewBag.EndTime = MarketApplication.GetServiceEndTime(market.Id).ToString("yyyy-MM-dd");
            return(View(model));
        }
Example #8
0
        public ActionResult BasicSettings()
        {
            var settings = SiteSettingApplication.SiteSettings;

            if (string.IsNullOrEmpty(settings.WeixinToken))
            {
                settings.WeixinToken = CreateKey(8);
                SiteSettingApplication.SaveChanges();
            }
            var siteSettingMode = new SiteSettingModel()
            {
                WeixinAppId     = string.IsNullOrEmpty(settings.WeixinAppId) ? string.Empty : settings.WeixinAppId.Trim(),
                WeixinAppSecret = string.IsNullOrEmpty(settings.WeixinAppSecret) ? string.Empty : settings.WeixinAppSecret.Trim(),
                WeixinToKen     = settings.WeixinToken.Trim()
            };

            ViewBag.Url = String.Format("{0}/m-Weixin/WXApi", CurrentUrlHelper.CurrentUrlNoPort());
            //TODO:演示站处理
            //如果是演示站,支付方式参数做特别处理
            if (DemoAuthorityHelper.IsDemo())
            {
                siteSettingMode.WeixinAppId     = "*".PadRight(siteSettingMode.WeixinAppId.Length, '*');
                siteSettingMode.WeixinAppSecret = "*".PadRight(siteSettingMode.WeixinAppSecret.Length, '*');
                ViewBag.isDemo = true;
            }
            return(View(siteSettingMode));
        }
Example #9
0
        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);

            Cache.Insert(CacheKeyCollection.CACHE_OAUTHLIST, rlt, 600);
            return(rlt);
        }
Example #10
0
        private void SaveServiceMySqlConnection(string configPath)
        {
            try
            {
                if (System.IO.File.Exists(configPath))
                {
                    var config = System.Configuration.ConfigurationManager.OpenExeConfiguration(configPath);
                    // 写入数据库连接信息
                    if (config.AppSettings.Settings["CurDomainUrl"] != null)
                    {
                        config.AppSettings.Settings["CurDomainUrl"].Value = CurrentUrlHelper.CurrentUrl();
                    }
                    if (config.ConnectionStrings.ConnectionStrings["mysql"] != null)
                    {
                        config.ConnectionStrings.ConnectionStrings["mysql"].ConnectionString = GetSimpleConnectionString();
                    }

                    config.Save();
                }
            }
            catch (Exception ex)
            {
                Core.Log.Error("设置服务数据库链接异常:" + ex.Message);
            }
        }
Example #11
0
        public object ConfirmRefund(ConfirmRefund args)
        {
            string notifyurl = CurrentUrlHelper.CurrentUrlNoPort() + "/Pay/RefundNotify/{0}";
            var    result    = RefundApplication.ConfirmRefund(args.RefundId, args.Remark, "", notifyurl);

            return(new { success = true });
        }
        public ActionResult Index()
        {
            var userId   = CurrentUser.Id;
            var model    = _iMemberInviteService.GetMemberInviteInfo(userId);
            var rule     = _iMemberInviteService.GetInviteRule();
            var Integral = _iMemberIntegralService.GetIntegralChangeRule();

            if (Integral != null && Integral.IntegralPerMoney > 0)
            {
                ViewBag.IntergralMoney = (rule.InviteIntegral / Integral.IntegralPerMoney).ToString("f2");
            }
            string host = CurrentUrlHelper.CurrentUrlNoPort();

            model.InviteLink = String.Format("{0}/Register/index/{1}", host, userId);
            //rule.ShareIcon = string.Format("http://{0}{1}", host, rule.ShareIcon);
            rule.ShareIcon = !string.IsNullOrWhiteSpace(rule.ShareIcon) ? HimallIO.GetRomoteImagePath(rule.ShareIcon) : "";
            var          map = Core.Helper.QRCodeHelper.Create(model.InviteLink);
            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();
            model.QR       = strUrl;
            ViewBag.WeiXin = PlatformType == PlatformType.WeiXin;
            var m = new Tuple <UserInviteModel, Entities.InviteRuleInfo, Entities.MemberInfo>(model, rule, CurrentUser);

            return(View(m));
        }
        /// <summary>
        /// 老用户
        /// </summary>
        /// <returns></returns>
        public ActionResult Share()
        {
            var userId = base.UserId;

            if (userId != 0)
            {
                var model    = _iMemberInviteService.GetMemberInviteInfo(userId);
                var rule     = _iMemberInviteService.GetInviteRule();
                var Integral = _iMemberIntegralService.GetIntegralChangeRule();
                if (Integral != null && Integral.IntegralPerMoney > 0)
                {
                    ViewBag.IntergralMoney = (rule.InviteIntegral / Integral.IntegralPerMoney).ToString("f2");
                }
                string host = CurrentUrlHelper.CurrentUrlNoPort();
                model.InviteLink = String.Format("{0}/Register/index/{1}", host, userId);
                //rule.ShareIcon = string.Format("http://{0}{1}", host, rule.ShareIcon);
                //var map = Core.Helper.QRCodeHelper.Create(model.InviteLink);
                //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();
                //model.QR = strUrl;
                var m = new Tuple <UserInviteModel, Entities.InviteRuleInfo, Entities.MemberInfo>(model, rule, CurrentUser);

                return(View(m));
            }
            else
            {
                Response.Redirect("/m-Wap/Login/Entrance?returnUrl=" + HttpUtility.UrlEncode(Request.GetDisplayUrl().ToString()));
                return(View());
            }
        }
Example #14
0
        public JsonResult List(int page, int rows, string titleKeyword, string tagsKeyword)
        {
            TopicQuery query = new TopicQuery()
            {
                IsAsc        = false,
                PageSize     = rows,
                PageNo       = page,
                Name         = titleKeyword,
                Tags         = tagsKeyword,
                PlatformType = PlatformType.Mobile,
                ShopId       = CurrentSellerManager.ShopId,
                Sort         = "id"
            };

            var topics = _iTopicService.GetTopics(query);
            var curUrl = CurrentUrlHelper.CurrentUrlNoPort();
            var list   = new
            {
                rows = topics.Models.ToArray().Select(item => new
                {
                    id     = item.Id,
                    url    = curUrl + "/m-wap/topic/detail/" + item.Id,
                    name   = item.Name,
                    imgUrl = item.FrontCoverImage,
                    tags   = string.IsNullOrWhiteSpace(item.Tags) ? "" : item.Tags.Replace(",", " ")
                }),
                total = topics.Total
            };

            return(Json(list));
        }
Example #15
0
        public object GetOrderBonus(string orderIds)
        {
            CheckUserLogin();
            List <BonuModel> bonus    = new List <BonuModel>();
            string           orderids = orderIds;

            string[] orderArray = orderids.Split(',');
            foreach (string item in orderArray)
            {
                long orderid = 0;
                if (long.TryParse(item, out orderid))
                {
                    var BonusInfo = ShopBonusApplication.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    = ShopApplication.GetShop(info.ShopId).ShopName;
                        bonus.Add(bonuObject);
                    }
                }
            }
            return(Json(bonus));
        }
        public JsonResult BatchConfirmRefund(string ids, string managerRemark)
        {
            Result result    = new Result();
            string notifyurl = "";

            string webRoot = CurrentUrlHelper.CurrentUrlNoPort();

            //获取异步通知地址
            notifyurl = webRoot + "/Pay/RefundNotify/{0}";
            if (string.IsNullOrWhiteSpace(ids))
            {
                return(ErrorResult("审核的ID,不能为空"));
            }
            var idArray = ids.Split(',').Select(e =>
            {
                long id = 0;
                long.TryParse(e, out id);
                return(id);
            }).Where(e => e > 0);

            foreach (long refundId in idArray)
            {
                _iRefundService.ConfirmRefund(refundId, managerRemark, CurrentManager.UserName, notifyurl);
            }
            result.success = true;
            return(Json(result));
        }
Example #17
0
        private bool SaveConfig(out string errorMsg)
        {
            try
            {
                Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);

                // 删除安装标识配置节
                config.AppSettings.Settings["IsInstalled"].Value = "true";

                //写入当前网址
                var curhttp = System.Web.HttpContext.Current;
                config.AppSettings.Settings["CurDomainUrl"].Value = CurrentUrlHelper.CurrentUrl();

                // 写入数据库连接信息

                //config.ConnectionStrings.ConnectionStrings["Entities"].ConnectionString = GetEFConnectionString();
                config.ConnectionStrings.ConnectionStrings["mysql"].ConnectionString = GetSimpleConnectionString();
                config.Save();

                errorMsg = null;
                return(true);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return(false);
            }
        }
Example #18
0
        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));
        }
Example #19
0
        // 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 }));
        }
Example #20
0
        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"));
        }
Example #21
0
        private string GetQRCode(string verificationCode)
        {
            string qrCodeImagePath = string.Empty;
            Image  qrcode          = Core.Helper.QRCodeHelper.Create(verificationCode);
            string fileName        = DateTime.Now.ToString("yyMMddHHmmssffffff") + ".jpg";

            qrCodeImagePath = CurrentUrlHelper.CurrentUrl() + "/temp/" + fileName;
            qrcode.Save(HttpContext.Current.Server.MapPath("~/temp/") + fileName);
            return(qrCodeImagePath);
        }
        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"));
        }
        /// <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();//主题设置
        }
Example #24
0
        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));
        }
Example #25
0
        //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));
        }
Example #26
0
        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));
        }
Example #27
0
        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));
        }
Example #28
0
        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 });
        }
Example #29
0
        public ActionResult HasReceive(long id, string openId = "", long grantid = 0, string wxhead = "", string host = "")  //已领取过
        {
            host = CurrentUrlHelper.CurrentUrl();
            ShopBonusDataModel dataModel = new ShopBonusDataModel();

            dataModel.GrantId   = grantid;
            dataModel.ShareHref = host + "/m-weixin/shopbonus/index/" + grantid.ToString();
            dataModel.OpenId    = openId;
            dataModel.HeadImg   = wxhead;
            ShopBonusModel model = new ShopBonusModel(this._bonusService.GetShopBonus(id));

            dataModel.ShopAddress = GetShopAddress(model.ShopId);
            ViewBag.DataModel     = dataModel;
            model.ShareImg        = host + model.ShareImg;
            return(View(model));
        }
Example #30
0
        // 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));
        }