Exemplo n.º 1
0
        public static EQRHuge CreateQRHuge(EQRHuge qrHuge)
        {
            string site = ConfigurationManager.AppSettings["Main_SiteUrl"];
            string url  = site + "Wap/PayHuge?QRHugeId=" + qrHuge.ID;

            string filePath = "/Content/QR/QRHuge/";
            string filename = "QRHuge_" + qrHuge.ID + "_" + System.DateTime.Now.ToString("yyyyMMddHHmm") + (new Random()).Next(1, 100).ToString()
                              + ".jpg";

            filePath       += filename;
            qrHuge.QRUrl    = url;
            qrHuge.FilePath = filePath;

            Bitmap logo = new Bitmap(System.Web.HttpContext.Current.Server.MapPath(@"/Content/QR/QRHugeLogo.png"));

            filePath = System.Web.HttpContext.Current.Server.MapPath(filePath);

            Bitmap qrImg = QRManager.CreateQR(url, filePath, logo, "金额[" + qrHuge.Amount + "]");


            logo.Dispose();
            qrImg.Dispose();


            return(qrHuge);
        }
Exemplo n.º 2
0
        public static EQRStoreAuth CreateStoreAuthUrlById(EQRStoreAuth qr)
        {
            try
            {
                string site = ConfigurationManager.AppSettings["Main_SiteUrl"];
                string url  = site + "Wap/Auth_Store?Id=" + qr.ID;

                string filePath = ConfigurationManager.AppSettings["QR_AuthStore_FP"];
                string filename = "QRAS" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + (new Random()).Next(1, 100).ToString()
                                  + ".jpg";

                filePath    += filename;
                qr.FilePath  = filePath;
                qr.TargetUrl = url;

                //Create QR
                // filePath = PageController.Server.MapPath(filePath);
                filePath = System.Web.HttpContext.Current.Server.MapPath(filePath);
                QRManager.CreateQR(url, filePath, null);
            }
            catch (Exception ex)
            {
                NLogHelper.ErrorTxt(ex.Message);
                throw ex;
            }
            return(qr);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 收款二维码
        /// </summary>
        public static EQRUser CreateUserUrlById(EQRUser qrUser, string logoUrl = "")
        {
            try
            {
                string site = ConfigurationManager.AppSettings["IQBWX_SiteUrl"];
                string url  = site + "PP/PaySelection?Id=" + qrUser.OpenId;

                string filePath = ConfigurationManager.AppSettings["QR_ARUser_FP"];
                string filename = "QRARU_" + qrUser.ID + "_" + System.DateTime.Now.ToString("yyyyMMdd") + (new Random()).Next(1, 100).ToString()
                                  + ".jpg";

                filePath += filename;

                qrUser.OrigQRFilePath = filePath;
                //Create QR
                filePath = System.Web.HttpContext.Current.Server.MapPath(filePath);

                //Logo
                Image LogoImg = null;
                //根据头像创建收款码Logo
                //if (!string.IsNullOrEmpty(logoUrl))
                //{
                //    LogoImg = ImgHelper.GetImgFromUrl(logoUrl);
                //    LogoImg = ImgHelper.resizeImage(LogoImg, new Size(56, 56));
                //    LogoImg = ImgHelper.AddImgBorder(new Bitmap(LogoImg), 4, Color.Wheat);
                //}

                //收款码统一Logo
                string LogoAddr = HttpContext.Current.Server.MapPath("/Content/QR/ReceiveMoney_Logo.png");
                LogoImg = new Bitmap(LogoAddr);

                Bitmap qrImg = QRManager.CreateQR(url, filePath, LogoImg);


                //BK
                //+ "ARUserBK1.jpg";
                string bkAdree = HttpContext.Current.Server.MapPath("/Content/QR/BK/bk_spring.jpg");
                Bitmap bkImg   = new Bitmap(bkAdree);

                //添加文字
                using (Graphics g = Graphics.FromImage(bkImg))
                {
                    string s    = "欢迎使用支付宝付款";
                    Font   font = new Font("黑体", 12, FontStyle.Bold);

                    SolidBrush b = new SolidBrush(Color.FromArgb(50, 159, 250));

                    g.DrawString(s, font, b, new PointF(96, 125));
                }

                Bitmap finImg = ImgHelper.ImageWatermark(bkImg, qrImg);

                filePath  = ConfigurationManager.AppSettings["QR_ARUser_FP"];
                filename  = "BK_" + qrUser.ID + "_" + filename;
                filePath += filename;

                finImg.Save(HttpContext.Current.Server.MapPath(filePath));
                finImg.Dispose();
                bkImg.Dispose();


                qrUser.FilePath  = filePath;
                qrUser.TargetUrl = url;
            }
            catch (Exception ex)
            {
                IQBLog log = new IQBLog();
                log.log("CreateUserUrlById Error:" + ex.Message);
                throw ex;
            }

            return(qrUser);
        }
Exemplo n.º 4
0
        /// <summary>
        /// O2O入口
        /// </summary>
        public static EQRUser CreateO2OEntryQR(EQRUser qrUser)
        {
            try
            {
                string site = ConfigurationManager.AppSettings["Main_SiteUrl"];
                string url  = site + "/O2OWap/Index?aoId=" + qrUser.OpenId;

                string filePath = "/Content/QR/O2O/";
                string filename = "QRO2O_" + qrUser.ID + "_" + System.DateTime.Now.ToString("yyyyMMdd") + (new Random()).Next(1, 100).ToString()
                                  + ".jpg";

                filePath += filename;

                qrUser.OrigQRFilePath = filePath;
                //Create QR
                filePath = System.Web.HttpContext.Current.Server.MapPath(filePath);

                //Logo
                Image LogoImg = null;

                //O2O统一Logo
                string LogoAddr = HttpContext.Current.Server.MapPath("/Content/QR/O2O_Logo.png");
                LogoImg = new Bitmap(LogoAddr);

                Bitmap qrImg = QRManager.CreateQR(url, filePath, LogoImg);


                //BK
                string bkAdree = HttpContext.Current.Server.MapPath("/Content/QR/BK/bk_O2O.jpg");
                Bitmap bkImg   = new Bitmap(bkAdree);

                //添加文字
                //using (Graphics g = Graphics.FromImage(bkImg))
                //{
                //    string s = "欢迎来到O2O特惠商城";
                //    Font font = new Font("黑体", 12, FontStyle.Bold);

                //    SolidBrush b = new SolidBrush(Color.FromArgb(50, 159, 250));

                //    g.DrawString(s, font, b, new PointF(96, 125));
                //}

                Bitmap finImg = ImgHelper.ImageWatermark(bkImg, qrImg);

                filePath  = "/Content/QR/O2O/";
                filename  = "BK_" + qrUser.ID + "_" + filename;
                filePath += filename;

                finImg.Save(HttpContext.Current.Server.MapPath(filePath));
                finImg.Dispose();
                bkImg.Dispose();


                qrUser.FilePath  = filePath;
                qrUser.TargetUrl = url;
            }
            catch (Exception ex)
            {
                IQBLog log = new IQBLog();
                log.log("CreateUserUrlById Error:" + ex.Message);
                throw ex;
            }

            return(qrUser);
        }