Ejemplo n.º 1
0
        public ActionResult Mall(MallModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.IsGuestSC            = model.IsGuestSC;
                mallConfigInfo.SCSubmitType         = model.SCSubmitType;
                mallConfigInfo.GuestSCCount         = model.GuestSCCount;
                mallConfigInfo.MemberSCCount        = model.MemberSCCount;
                mallConfigInfo.SCExpire             = model.SCExpire;
                mallConfigInfo.OSNFormat            = model.OSNFormat;
                mallConfigInfo.OnlinePayExpire      = model.OnlinePayExpire;
                mallConfigInfo.ReceiveExpire        = model.ReceiveExpire;
                mallConfigInfo.BroHisCount          = model.BroHisCount;
                mallConfigInfo.MaxShipAddress       = model.MaxShipAddress;
                mallConfigInfo.FavoriteProductCount = model.FavoriteProductCount;
                mallConfigInfo.FavoriteStoreCount   = model.FavoriteStoreCount;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                AddMallAdminLog("修改商城设置");
                return(PromptView(Url.Action("mall"), "修改商城设置成功"));
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存上传的广告图片
        /// </summary>
        /// <param name="image">广告图片</param>
        /// <returns></returns>
        public string SaveUploadAdvertImage(HttpPostedFileBase image)
        {
            if (image == null)
            {
                return("-1");
            }

            MallConfigInfo mallConfig = BMAConfig.MallConfig;

            string fileName  = image.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, mallConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = image.ContentLength;

            if (fileSize > mallConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath("/upload/adv/");
            string newFileName = string.Format("ad_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);//生成文件名

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            image.SaveAs(dirPath + newFileName);

            return(newFileName);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存上传的店铺banner
        /// </summary>
        /// <param name="storeId">店铺id</param>
        /// <param name="storeBanner">店铺banner</param>
        /// <returns></returns>
        public static string SaveUploadStoreBanner(int storeId, HttpPostedFileBase storeBanner)
        {
            if (storeBanner == null)
            {
                return("-1");
            }

            MallConfigInfo mallConfig = HaConfig.MallConfig;

            string fileName  = storeBanner.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, mallConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = storeBanner.ContentLength;

            if (fileSize > mallConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath(string.Format("/upload/store/{0}/banner/", storeId));
            string newFileName = string.Format("sb_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);//生成文件名

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            storeBanner.SaveAs(dirPath + newFileName);

            return(newFileName);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 保存上传的友情链接Logo
        /// </summary>
        /// <param name="friendLinkLogo">友情链接logo</param>
        /// <returns></returns>
        public static string SaveUploadFriendLinkLogo(HttpPostedFileBase friendLinkLogo)
        {
            if (friendLinkLogo == null)
            {
                return("-1");
            }

            MallConfigInfo mallConfig = HaConfig.MallConfig;

            string fileName  = friendLinkLogo.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, mallConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = friendLinkLogo.ContentLength;

            if (fileSize > mallConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath("/upload/friendlink/");
            string newFileName = string.Format("fr_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);//生成文件名

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            friendLinkLogo.SaveAs(dirPath + newFileName);

            return(newFileName);
        }
Ejemplo n.º 5
0
        public ActionResult Access(AccessModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.IsClosed           = model.IsClosed;
                mallConfigInfo.CloseReason        = model.CloseReason == null ? "" : model.CloseReason;
                mallConfigInfo.BanAccessTime      = model.BanAccessTime == null ? "" : model.BanAccessTime;
                mallConfigInfo.BanAccessIP        = model.BanAccessIP == null ? "" : model.BanAccessIP;
                mallConfigInfo.AllowAccessIP      = model.AllowAccessIP == null ? "" : model.AllowAccessIP;
                mallConfigInfo.AdminAllowAccessIP = model.AdminAllowAccessIP == null ? "" : model.AdminAllowAccessIP;
                mallConfigInfo.SecretKey          = model.SecretKey;
                mallConfigInfo.CookieDomain       = model.CookieDomain == null ? "" : model.CookieDomain.Trim('.');
                mallConfigInfo.RandomLibrary      = model.RandomLibrary == null ? "" : model.RandomLibrary;
                mallConfigInfo.VerifyPages        = CommonHelper.StringArrayToString(model.VerifyPages);
                mallConfigInfo.IgnoreWords        = model.IgnoreWords == null ? "" : model.IgnoreWords;
                mallConfigInfo.AllowEmailProvider = model.AllowEmailProvider == null ? "" : model.AllowEmailProvider;
                mallConfigInfo.BanEmailProvider   = model.BanEmailProvider == null ? "" : model.BanEmailProvider;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                Randoms.ResetRandomLibrary();
                FilterWords.ResetIgnoreWordsRegex();
                AddMallAdminLog("修改访问控制");
                return(PromptView(Url.Action("access"), "修改访问控制成功"));
            }

            ViewData["verifyPages"] = CommonHelper.StringArrayToString(model.VerifyPages);
            return(View(model));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 重置商城信息
 /// </summary>
 public static void ResetMall()
 {
     lock (_locker)
     {
         _mallconfiginfo = BMAConfig.MallConfig;
     }
 }
Ejemplo n.º 7
0
        public ActionResult Performance(PerformanceModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.ImageCDN             = model.ImageCDN == null ? "" : model.ImageCDN;
                mallConfigInfo.CSSCDN               = model.CSSCDN == null ? "" : model.CSSCDN;
                mallConfigInfo.ScriptCDN            = model.ScriptCDN == null ? "" : model.ScriptCDN;
                mallConfigInfo.OnlineUserExpire     = model.OnlineUserExpire;
                mallConfigInfo.UpdateOnlineTimeSpan = model.UpdateOnlineTimeSpan;
                mallConfigInfo.MaxOnlineCount       = model.MaxOnlineCount;
                mallConfigInfo.OnlineCountExpire    = model.OnlineCountExpire;
                mallConfigInfo.IsStatBrowser        = model.IsStatBrowser;
                mallConfigInfo.IsStatOS             = model.IsStatOS;
                mallConfigInfo.IsStatRegion         = model.IsStatRegion;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                AddMallAdminLog("修改性能设置");
                return(PromptView(Url.Action("performance"), "修改性能设置成功"));
            }
            return(View(model));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 保存上传的banner图片
        /// </summary>
        /// <param name="bannerImg">banner图片</param>
        /// <returns></returns>
        public static string SaveUploadBannerImg(HttpPostedFileBase bannerImg)
        {
            if (bannerImg == null)
            {
                return("-1");
            }

            MallConfigInfo shopConfig = BMAConfig.MallConfig;

            string fileName  = bannerImg.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, shopConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = bannerImg.ContentLength;

            if (fileSize > shopConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath("/upload/banner/");
            string newFileName = string.Format("fr_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);//生成文件名

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            bannerImg.SaveAs(dirPath + newFileName);

            return(newFileName);
        }
Ejemplo n.º 9
0
        public ActionResult Upload(UploadModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.UploadImgType            = model.UploadImgType;
                mallConfigInfo.UploadImgSize            = model.UploadImgSize * 1000;
                mallConfigInfo.WatermarkType            = model.WatermarkType;
                mallConfigInfo.WatermarkQuality         = model.WatermarkQuality;
                mallConfigInfo.WatermarkPosition        = model.WatermarkPosition;
                mallConfigInfo.WatermarkImg             = model.WatermarkImg == null ? "" : model.WatermarkImg;
                mallConfigInfo.WatermarkImgOpacity      = model.WatermarkImgOpacity;
                mallConfigInfo.WatermarkText            = model.WatermarkText == null ? "" : model.WatermarkText;
                mallConfigInfo.WatermarkTextFont        = model.WatermarkTextFont;
                mallConfigInfo.WatermarkTextSize        = model.WatermarkTextSize;
                mallConfigInfo.BrandThumbSize           = model.BrandThumbSize;
                mallConfigInfo.ProductShowThumbSize     = model.ProductShowThumbSize;
                mallConfigInfo.UserAvatarThumbSize      = model.UserAvatarThumbSize;
                mallConfigInfo.UserRankAvatarThumbSize  = model.UserRankAvatarThumbSize;
                mallConfigInfo.StoreRankAvatarThumbSize = model.StoreRankAvatarThumbSize;
                mallConfigInfo.StoreLogoThumbSize       = model.StoreLogoThumbSize;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                AddMallAdminLog("修改上传设置");
                return(PromptView(Url.Action("upload"), "修改上传设置成功"));
            }

            LoadFont();
            return(View(model));
        }
Ejemplo n.º 10
0
        public ActionResult Upload()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            UploadModel model = new UploadModel();

            model.UploadImgType            = mallConfigInfo.UploadImgType;
            model.UploadImgSize            = mallConfigInfo.UploadImgSize / 1000;
            model.WatermarkType            = mallConfigInfo.WatermarkType;
            model.WatermarkQuality         = mallConfigInfo.WatermarkQuality;
            model.WatermarkPosition        = mallConfigInfo.WatermarkPosition;
            model.WatermarkImg             = mallConfigInfo.WatermarkImg;
            model.WatermarkImgOpacity      = mallConfigInfo.WatermarkImgOpacity;
            model.WatermarkText            = mallConfigInfo.WatermarkText;
            model.WatermarkTextFont        = mallConfigInfo.WatermarkTextFont;
            model.WatermarkTextSize        = mallConfigInfo.WatermarkTextSize;
            model.BrandThumbSize           = mallConfigInfo.BrandThumbSize;
            model.ProductShowThumbSize     = mallConfigInfo.ProductShowThumbSize;
            model.UserAvatarThumbSize      = mallConfigInfo.UserAvatarThumbSize;
            model.UserRankAvatarThumbSize  = mallConfigInfo.UserRankAvatarThumbSize;
            model.StoreRankAvatarThumbSize = mallConfigInfo.StoreRankAvatarThumbSize;
            model.StoreLogoThumbSize       = mallConfigInfo.StoreLogoThumbSize;

            LoadFont();
            return(View(model));
        }
Ejemplo n.º 11
0
        private static MallConfigInfo _mallconfiginfo = null;         //商城配置

        static SMSes()
        {
            _ismsstrategy          = BMASMS.Instance;
            _smsconfiginfo         = BMAConfig.SMSConfig;
            _mallconfiginfo        = BMAConfig.MallConfig;
            _ismsstrategy.Url      = _smsconfiginfo.Url;
            _ismsstrategy.UserName = _smsconfiginfo.UserName;
            _ismsstrategy.Password = _smsconfiginfo.Password;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 保存上传的店铺logo
        /// </summary>
        /// <param name="storeId">店铺id</param>
        /// <param name="storeLogo">店铺logo</param>
        /// <returns></returns>
        public static string SaveUploadStoreLogo(int storeId, HttpPostedFileBase storeLogo)
        {
            if (storeLogo == null)
            {
                return("-1");
            }

            MallConfigInfo mallConfig = HaConfig.MallConfig;

            string fileName  = storeLogo.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, mallConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = storeLogo.ContentLength;

            if (fileSize > mallConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath(string.Format("/upload/store/{0}/logo/", storeId));
            string newFileName = string.Format("s_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);

            string[] sizeList = StringHelper.SplitString(mallConfig.StoreLogoThumbSize);

            string sourceDirPath = dirPath + "source/";

            if (!Directory.Exists(sourceDirPath))
            {
                Directory.CreateDirectory(sourceDirPath);
            }

            string sourcePath = sourceDirPath + newFileName;

            storeLogo.SaveAs(sourcePath);

            foreach (string size in sizeList)
            {
                string thumbDirPath = string.Format("{0}thumb{1}/", dirPath, size);
                if (!Directory.Exists(thumbDirPath))
                {
                    Directory.CreateDirectory(thumbDirPath);
                }
                string[] widthAndHeight = StringHelper.SplitString(size, "_");
                IOHelper.GenerateThumb(sourcePath,
                                       thumbDirPath + newFileName,
                                       TypeHelper.StringToInt(widthAndHeight[0]),
                                       TypeHelper.StringToInt(widthAndHeight[1]),
                                       "H");
            }
            return(newFileName);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 保存上传的用户等级头像
        /// </summary>
        /// <param name="avatar">头像</param>
        /// <returns></returns>
        public static string SaveUploadUserRankAvatar(HttpPostedFileBase avatar)
        {
            if (avatar == null)
            {
                return("-1");
            }

            MallConfigInfo shopConfig = BMAConfig.MallConfig;

            string fileName  = avatar.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, shopConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = avatar.ContentLength;

            if (fileSize > shopConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath("/upload/userrank/");
            string newFileName = string.Format("ura_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);

            string[] sizeList = StringHelper.SplitString(shopConfig.UserRankAvatarThumbSize);

            string sourceDirPath = dirPath + "source/";

            if (!Directory.Exists(sourceDirPath))
            {
                Directory.CreateDirectory(sourceDirPath);
            }

            string sourcePath = sourceDirPath + newFileName;

            avatar.SaveAs(sourcePath);

            foreach (string size in sizeList)
            {
                string thumbDirPath = string.Format("{0}thumb{1}/", dirPath, size);
                if (!Directory.Exists(thumbDirPath))
                {
                    Directory.CreateDirectory(thumbDirPath);
                }
                string[] widthAndHeight = StringHelper.SplitString(size, "_");
                IOHelper.GenerateThumb(sourcePath,
                                       thumbDirPath + newFileName,
                                       TypeHelper.StringToInt(widthAndHeight[0]),
                                       TypeHelper.StringToInt(widthAndHeight[1]),
                                       "H");
            }
            return(newFileName);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 保存商城配置信息
 /// </summary>
 public static void SaveMallConfig(MallConfigInfo mallConfigInfo)
 {
     lock (_locker)
     {
         if (_iconfigstrategy.SaveMallConfig(mallConfigInfo))
         {
             _mallconfiginfo = mallConfigInfo;
         }
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 保存商品编辑器中的图片
        /// </summary>
        /// <param name="storeId">店铺id</param>
        /// <param name="image">图片</param>
        /// <returns></returns>
        public static string SaveProductEditorImage(int storeId, HttpPostedFileBase image)
        {
            if (image == null)
            {
                return("-1");
            }

            MallConfigInfo mallConfig = HaConfig.MallConfig;

            string fileName  = image.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, mallConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = image.ContentLength;

            if (fileSize > mallConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath(string.Format("/upload/store/{0}/product/editor/", storeId));
            string newFileName = string.Format("pe_{0}{1}", DateTime.Now.ToString("yyMMddHHmmssfffffff"), extension);//生成文件名

            string sourceDirPath = dirPath + "source/";

            if (!Directory.Exists(sourceDirPath))
            {
                Directory.CreateDirectory(sourceDirPath);
            }
            string sourcePath = sourceDirPath + newFileName;

            image.SaveAs(sourcePath);

            string path = dirPath + newFileName;

            if (mallConfig.WatermarkType == 1)//文字水印
            {
                IOHelper.GenerateTextWatermark(sourcePath, path, mallConfig.WatermarkText, mallConfig.WatermarkTextSize, mallConfig.WatermarkTextFont, mallConfig.WatermarkPosition, mallConfig.WatermarkQuality);
            }
            else if (mallConfig.WatermarkType == 2)//图片水印
            {
                string watermarkPath = IOHelper.GetMapPath("/watermarks/" + mallConfig.WatermarkImg);
                IOHelper.GenerateImageWatermark(sourcePath, watermarkPath, path, mallConfig.WatermarkPosition, mallConfig.WatermarkImgOpacity, mallConfig.WatermarkQuality);
            }
            else
            {
                image.SaveAs(path);
            }

            return(newFileName);
        }
Ejemplo n.º 16
0
        private static MallConfigInfo _mallconfiginfo   = null; //商城配置信息

        /// <summary>
        /// 静态构造函数
        /// </summary>
        static Emails()
        {
            _iemailstrategy          = BMAEmail.Instance;
            _emailconfiginfo         = BMAConfig.EmailConfig;
            _mallconfiginfo          = BMAConfig.MallConfig;
            _iemailstrategy.Host     = _emailconfiginfo.Host;
            _iemailstrategy.Port     = _emailconfiginfo.Port;
            _iemailstrategy.UserName = _emailconfiginfo.UserName;
            _iemailstrategy.Password = _emailconfiginfo.Password;
            _iemailstrategy.From     = _emailconfiginfo.From;
            _iemailstrategy.FromName = _emailconfiginfo.FromName;
        }
Ejemplo n.º 17
0
        private static UploadConfigInfo _uploadconfiginfo = null; //上传配置信息



        static BMAConfig()
        {
            try
            {
                string[] fileNameList = Directory.GetFiles(System.Web.HttpRuntime.BinDirectory, "MyTiptop.ConfigStrategy.*.dll", SearchOption.TopDirectoryOnly);
                _iconfigstrategy = (IConfigStrategy)Activator.CreateInstance(Type.GetType(string.Format("MyTiptop.ConfigStrategy.{0}.ConfigStrategy, MyTiptop.ConfigStrategy.{0}", fileNameList[0].Substring(fileNameList[0].LastIndexOf("ConfigStrategy.") + 15).Replace(".dll", "")),
                                                                                          false,
                                                                                          true));
            }
            catch
            {
                throw new Exception("创建'配置策略对象'失败,可能存在的原因:未将'配置策略程序集'添加到bin目录中;'配置策略程序集'文件名不符合'MyTiptop.ConfigStrategy.{策略名称}.dll'格式");
            }

            _mallconfiginfo = _iconfigstrategy.GetMallConfig();
        }
Ejemplo n.º 18
0
        public ActionResult Site()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            SiteModel model = new SiteModel();

            model.MallName       = mallConfigInfo.MallName;
            model.SiteUrl        = mallConfigInfo.SiteUrl;
            model.SiteTitle      = mallConfigInfo.SiteTitle;
            model.SEOKeyword     = mallConfigInfo.SEOKeyword;
            model.SEODescription = mallConfigInfo.SEODescription;
            model.ICP            = mallConfigInfo.ICP;
            model.Script         = mallConfigInfo.Script;
            model.IsLicensed     = mallConfigInfo.IsLicensed;

            return(View(model));
        }
Ejemplo n.º 19
0
        public ActionResult Account()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            AccountModel model = new AccountModel();

            model.RegType        = StringToIntArray(mallConfigInfo.RegType);
            model.ReservedName   = mallConfigInfo.ReservedName;
            model.RegTimeSpan    = mallConfigInfo.RegTimeSpan;
            model.IsWebcomeMsg   = mallConfigInfo.IsWebcomeMsg;
            model.WebcomeMsg     = mallConfigInfo.WebcomeMsg;
            model.LoginType      = StringToIntArray(mallConfigInfo.LoginType);
            model.ShadowName     = mallConfigInfo.ShadowName;
            model.IsRemember     = mallConfigInfo.IsRemember;
            model.LoginFailTimes = mallConfigInfo.LoginFailTimes;

            return(View(model));
        }
Ejemplo n.º 20
0
        public ActionResult Performance()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            PerformanceModel model = new PerformanceModel();

            model.ImageCDN             = mallConfigInfo.ImageCDN;
            model.CSSCDN               = mallConfigInfo.CSSCDN;
            model.ScriptCDN            = mallConfigInfo.ScriptCDN;
            model.OnlineUserExpire     = mallConfigInfo.OnlineUserExpire;
            model.UpdateOnlineTimeSpan = mallConfigInfo.UpdateOnlineTimeSpan;
            model.MaxOnlineCount       = mallConfigInfo.MaxOnlineCount;
            model.OnlineCountExpire    = mallConfigInfo.OnlineCountExpire;
            model.IsStatBrowser        = mallConfigInfo.IsStatBrowser;
            model.IsStatOS             = mallConfigInfo.IsStatOS;
            model.IsStatRegion         = mallConfigInfo.IsStatRegion;

            return(View(model));
        }
Ejemplo n.º 21
0
        public ActionResult Mall()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            MallModel model = new MallModel();

            model.IsGuestSC            = mallConfigInfo.IsGuestSC;
            model.SCSubmitType         = mallConfigInfo.SCSubmitType;
            model.GuestSCCount         = mallConfigInfo.GuestSCCount;
            model.MemberSCCount        = mallConfigInfo.MemberSCCount;
            model.SCExpire             = mallConfigInfo.SCExpire;
            model.OSNFormat            = mallConfigInfo.OSNFormat;
            model.OnlinePayExpire      = mallConfigInfo.OnlinePayExpire;
            model.ReceiveExpire        = mallConfigInfo.ReceiveExpire;
            model.BroHisCount          = mallConfigInfo.BroHisCount;
            model.MaxShipAddress       = mallConfigInfo.MaxShipAddress;
            model.FavoriteProductCount = mallConfigInfo.FavoriteProductCount;
            model.FavoriteStoreCount   = mallConfigInfo.FavoriteStoreCount;

            return(View(model));
        }
Ejemplo n.º 22
0
        public ActionResult Access()
        {
            MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

            AccessModel model = new AccessModel();

            model.IsClosed           = mallConfigInfo.IsClosed;
            model.CloseReason        = mallConfigInfo.CloseReason;
            model.BanAccessTime      = mallConfigInfo.BanAccessTime;
            model.BanAccessIP        = mallConfigInfo.BanAccessIP;
            model.AllowAccessIP      = mallConfigInfo.AllowAccessIP;
            model.AdminAllowAccessIP = mallConfigInfo.AdminAllowAccessIP;
            model.SecretKey          = mallConfigInfo.SecretKey;
            model.CookieDomain       = mallConfigInfo.CookieDomain;
            model.RandomLibrary      = mallConfigInfo.RandomLibrary;
            model.VerifyPages        = StringHelper.SplitString(mallConfigInfo.VerifyPages);
            model.IgnoreWords        = mallConfigInfo.IgnoreWords;
            model.AllowEmailProvider = mallConfigInfo.AllowEmailProvider;
            model.BanEmailProvider   = mallConfigInfo.BanEmailProvider;

            ViewData["verifyPages"] = mallConfigInfo.VerifyPages;
            return(View(model));
        }
Ejemplo n.º 23
0
        public ActionResult Site(SiteModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.MallName       = model.MallName == null ? "" : model.MallName;
                mallConfigInfo.SiteUrl        = model.SiteUrl == null ? "" : model.SiteUrl;
                mallConfigInfo.SiteTitle      = model.SiteTitle == null ? "" : model.SiteTitle;
                mallConfigInfo.SEOKeyword     = model.SEOKeyword == null ? "" : model.SEOKeyword;
                mallConfigInfo.SEODescription = model.SEODescription == null ? "" : model.SEODescription;
                mallConfigInfo.ICP            = model.ICP == null ? "" : model.ICP;
                mallConfigInfo.Script         = model.Script == null ? "" : model.Script;
                mallConfigInfo.IsLicensed     = model.IsLicensed;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                AddMallAdminLog("修改站点信息");
                return(PromptView(Url.Action("site"), "修改站点信息成功"));
            }
            return(View(model));
        }
Ejemplo n.º 24
0
        public ActionResult Account(AccountModel model)
        {
            if (ModelState.IsValid)
            {
                MallConfigInfo mallConfigInfo = BMAConfig.MallConfig;

                mallConfigInfo.RegType        = model.RegType == null ? "" : CommonHelper.IntArrayToString(model.RegType, "");
                mallConfigInfo.ReservedName   = model.ReservedName ?? "";
                mallConfigInfo.RegTimeSpan    = model.RegTimeSpan;
                mallConfigInfo.IsWebcomeMsg   = model.IsWebcomeMsg;
                mallConfigInfo.WebcomeMsg     = model.WebcomeMsg ?? "";
                mallConfigInfo.LoginType      = model.LoginType == null ? "" : CommonHelper.IntArrayToString(model.LoginType, "");
                mallConfigInfo.ShadowName     = model.ShadowName ?? "";
                mallConfigInfo.IsRemember     = model.IsRemember;
                mallConfigInfo.LoginFailTimes = model.LoginFailTimes;

                BMAConfig.SaveMallConfig(mallConfigInfo);
                Emails.ResetMall();
                SMSes.ResetMall();
                AddMallAdminLog("修改账号设置");
                return(PromptView(Url.Action("account"), "修改账号设置成功"));
            }
            return(View(model));
        }
Ejemplo n.º 25
0
 /// <summary>
 /// 保存商城基本配置
 /// </summary>
 /// <param name="configInfo">商城基本配置信息</param>
 /// <returns>是否保存结果</returns>
 public bool SaveMallConfig(MallConfigInfo configInfo)
 {
     return(SaveConfigInfo(configInfo, IOHelper.GetMapPath(_mallconfigfilepath)));
 }
Ejemplo n.º 26
0
        /// <summary>
        /// 保存上传的店铺图片
        /// </summary>
        /// <param name="storeId">店铺id</param>
        /// <param name="productImage">商品图片</param>
        /// <returns></returns>
        public static string SaveUploadStoreImage(int storeId, HttpPostedFileBase productImage)
        {
            if (productImage == null)
            {
                return("-1");
            }

            MallConfigInfo mallConfig = HaConfig.MallConfig;

            string fileName  = productImage.FileName;
            string extension = Path.GetExtension(fileName);

            if (!ValidateHelper.IsImgFileName(fileName) || !CommonHelper.IsInArray(extension, mallConfig.UploadImgType))
            {
                return("-2");
            }

            int fileSize = productImage.ContentLength;

            if (fileSize > mallConfig.UploadImgSize)
            {
                return("-3");
            }

            string dirPath     = IOHelper.GetMapPath(string.Format("/upload/store/{0}/pics/", storeId));
            string name        = "ps_" + DateTime.Now.ToString("yyMMddHHmmssfffffff");
            string newFileName = name + extension;

            string[] sizeList = StringHelper.SplitString(mallConfig.ProductShowThumbSize);

            string sourceDirPath = string.Format("{0}source/", dirPath);

            if (!Directory.Exists(sourceDirPath))
            {
                Directory.CreateDirectory(sourceDirPath);
            }
            string sourcePath = sourceDirPath + newFileName;

            productImage.SaveAs(sourcePath);

            if (mallConfig.WatermarkType == 1)//文字水印
            {
                string path = string.Format("{0}{1}_text{2}", sourceDirPath, name, extension);
                IOHelper.GenerateTextWatermark(sourcePath, path, mallConfig.WatermarkText, mallConfig.WatermarkTextSize, mallConfig.WatermarkTextFont, mallConfig.WatermarkPosition, mallConfig.WatermarkQuality);
                sourcePath = path;
            }
            else if (mallConfig.WatermarkType == 2)//图片水印
            {
                string path          = string.Format("{0}{1}_img{2}", sourceDirPath, name, extension);
                string watermarkPath = IOHelper.GetMapPath("/watermarks/" + mallConfig.WatermarkImg);
                IOHelper.GenerateImageWatermark(sourcePath, watermarkPath, path, mallConfig.WatermarkPosition, mallConfig.WatermarkImgOpacity, mallConfig.WatermarkQuality);
                sourcePath = path;
            }

            foreach (string size in sizeList)
            {
                string thumbDirPath = string.Format("{0}thumb{1}/", dirPath, size);
                if (!Directory.Exists(thumbDirPath))
                {
                    Directory.CreateDirectory(thumbDirPath);
                }
                string[] widthAndHeight = StringHelper.SplitString(size, "_");
                IOHelper.GenerateThumb(sourcePath,
                                       thumbDirPath + newFileName,
                                       TypeHelper.StringToInt(widthAndHeight[0]),
                                       TypeHelper.StringToInt(widthAndHeight[1]),
                                       "H");
            }
            return(newFileName);
        }