示例#1
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }
            //1获得模版基本信息
            BLL.wx_templates tBll = new BLL.wx_templates();
            string           templateErJiFileName = tBll.GetErJiTemplatesFileNameByWid(wid);

            if (templateErJiFileName == null || templateErJiFileName.Trim() == "")
            {
                tPath = MyCommFun.GetRootPath() + "/templates/category/albums/category.html";
            }
            else
            {
                tPath = MyCommFun.GetRootPath() + "/templates/category/" + templateErJiFileName + "/category.html";
            }



            TemplateMgr template = new TemplateMgr(tPath, wid);

            template.tType  = TemplateType.Channel;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(templateErJiFileName, wid);
        }
示例#2
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_book_templates tBll = new BLL.wx_book_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("book", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }


            serverPath = MyCommFun.GetRootPath() + "/book/templates/" + templateFileName + "/category.html";
            bookTemplateMgr template = new bookTemplateMgr("/book/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.Class;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(wid);
        }
示例#3
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }
            string _action = MyCommFun.QueryString("myact");

            if (_action == "editAddr")
            {
                EditAddr();
            }
            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/editaddr.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.editaddr;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(wid);
        }
示例#4
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }
            //1获得模版基本信息
            BLL.wx_templates tBll = new BLL.wx_templates();
            templateIndexFileName = tBll.GetTemplatesFileNameByWid(wid);
            if (templateIndexFileName == null || templateIndexFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }

            tPath = MyCommFun.GetRootPath() + "/templates/content/type1/content.html";
            TemplateMgr template = new TemplateMgr(tPath, wid);

            template.tType  = TemplateType.News;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml("type1", wid);
        }
示例#5
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }
            MyCommFun.RequestOpenid();
            MyCommFun.getTotalUrl();

            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/index.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.Index;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(wid);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }

            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/order_success.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.orderSuccess;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(wid);
        }
示例#7
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }

            BLL.wx_userweixin   bll     = new BLL.wx_userweixin();
            Model.wx_userweixin wxModel = bll.GetModel(wid);
            string thisUrl = MyCommFun.getTotalUrl();

            OAuth2BaseProc(wxModel, "cart", thisUrl);

            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/category.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.Index;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(wid);
        }
示例#8
0
        private string GetImagePath(string imageName)
        {
            string folderName = "weixin/photo/uploadimages";
            string path       = MyCommFun.GetRootPath() + folderName;

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

            return(string.Format("{0}/{1}.jpg", folderName, imageName));
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }


            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }


            //授权

            int orderId = MyCommFun.RequestInt("orderid");

            BLL.wx_userweixin   bll     = new BLL.wx_userweixin();
            Model.wx_userweixin wxModel = bll.GetModel(wid);
            string thisUrl = MyCommFun.getWebSite() + "/shop/order_detail.aspx?wid=" + wid + "&orderid=" + orderId;

            OAuth2BaseProc(wxModel, "order_detail", thisUrl);

            //授权结束



            BLL.wx_shop_user_addr           uAddrBll  = new BLL.wx_shop_user_addr();
            IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid);

            if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
            {
                //该微信用户没有添加地址
                Response.Redirect("/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx");
                // MessageBox.ResponseScript(this, "window.location.href =/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx");
                return;
            }
            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/order_detail.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.orderDetail;
            template.openid = openid;
            template.OutPutHtml(wid);
        }
示例#10
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }



            //授权
            string openid = MyCommFun.RequestOpenid();

            //BLL.wx_userweixin bll = new BLL.wx_userweixin();
            //Model.wx_userweixin wxModel = bll.GetModel(wid);
            //string code = MyCommFun.QueryString("code");
            //if (code == null || code.Trim() == "")
            //{

            //    openid = MyCommFun.RequestOpenid();
            //    string thisUrl = MyCommFun.getWebSite() + "/shop/index.aspx?wid=" + wid;
            //    string newUrl = OAuthApi.GetAuthorizeUrl(wxModel.AppId, thisUrl, "reg", OAuthScope.snsapi_base);
            //    Response.Redirect(newUrl);
            //}
            //else
            //{
            //    var result = OAuthApi.GetAccessToken(wxModel.AppId, wxModel.AppSecret, code);
            //    openid = result.openid;
            //}
            //授权结束

            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/index.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType = TemplateType.Index;
            //template.openid = MyCommFun.RequestOpenid();
            template.openid = openid;
            template.OutPutHtml(wid);
        }
示例#11
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }


            tPath = MyCommFun.GetRootPath() + "/templates_portal/register.html";
            PortalTemplate template = new PortalTemplate(tPath);

            template.tType = TemplateType.Index;

            template.OutPutHtml(templateIndexFileName);
        }
示例#12
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息04e11d01b9df2865
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }

            //授权
            BLL.wx_userweixin   bll     = new BLL.wx_userweixin();
            Model.wx_userweixin wxModel = bll.GetModel(wid);

            string type = MyCommFun.QueryString("type");

            if (type != "")
            {
                type = "&type=new";
            }

            string thisUrl = MyCommFun.getWebSite() + "/shop/list.aspx?wid=" + wid + "&cid=" + MyCommFun.RequestInt("cid") + type;

            OAuth2BaseProc(wxModel, "list", thisUrl);
            //授权结束


            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/list.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.Class;
            template.openid = openid;
            template.OutPutHtml(wid);
            DataSet ds = new DataSet();
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }
            string openid = MyCommFun.RequestOpenid();

            BLL.wx_book_user_addr           uAddrBll  = new BLL.wx_book_user_addr();
            IList <Model.wx_book_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid);

            if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
            {
                //该微信用户没有添加地址
                Response.Redirect("/book/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx");
                // MessageBox.ResponseScript(this, "window.location.href =/book/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx");
                return;
            }


            //1获得模版基本信息
            BLL.wx_book_templates tBll = new BLL.wx_book_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("book", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }


            serverPath = MyCommFun.GetRootPath() + "/book/templates/" + templateFileName + "/confirmOrder.html";
            bookTemplateMgr template = new bookTemplateMgr("/book/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.confirmOrder;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(wid);
        }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int    wid    = MyCommFun.RequestInt("wid");
                string openid = MyCommFun.RequestOpenid();
                int    aid    = MyCommFun.RequestInt("aid");
                if (wid == 0 || openid == "" || aid == 0)
                {
                    return;
                }

                tPath = MyCommFun.GetRootPath() + "/weixin/vote/templates/temp1.html";
                TemplateMgr template = new TemplateMgr(tPath, wid);
                template.tType  = TemplateType.voteList;
                template.openid = MyCommFun.RequestOpenid();
                template.OutPutHtml("type1", wid);

                // BindData(wid, aid, openid);
            }
        }
示例#15
0
        public void DownLoadImage(string mediaId, int wid)
        {
            AjaxResult result = null;

            try
            {
                string error;
                var    accessToken = WeiXinPF.WeiXinComm.WeiXinCRMComm.getAccessToken(wid, out error);
                if (!string.IsNullOrEmpty(error))
                {
                    throw new Exception(error);
                }

                if (string.IsNullOrEmpty(accessToken) || string.IsNullOrEmpty(mediaId))
                {
                    throw new ArgumentNullException("参数不能为空!");
                }


                string imageName = Guid.NewGuid().ToString();
                string imagePath = GetImagePath(imageName);
                string path      = MyCommFun.GetRootPath() + imagePath;

                var image = WeiXinMediaFun.SaveImage(accessToken, mediaId);

                var imgUrl = string.Format("{0}/{1}", MyCommFun.getWebSite(), imagePath);

                image.Save(path);

                result = AjaxResult.Success(new { imgName = imageName, imgUrl = imgUrl });
            }
            catch (Exception ex)
            {
                result = AjaxResult.Error(ex.Message);
            }

            HttpContext.Current.Response.Write(result);
        }
示例#16
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }
            //1获得模版基本信息
            BLL.wx_templates tBll = new BLL.wx_templates();
            templateListFileName = tBll.GetLieBiaoTemplatesFileNameByWid(wid);
            if (templateListFileName == null || templateListFileName.Trim() == "")
            {
                templateListFileName = "type1";
            }
            tPath = MyCommFun.GetRootPath() + "/templates/list/" + templateListFileName + "/news_list.html";
            TemplateMgr template = new TemplateMgr(tPath, wid);

            template.tType  = TemplateType.Class;
            template.openid = MyCommFun.RequestOpenid();
            template.OutPutHtml(templateListFileName, wid);
        }
示例#17
0
        public void CropImage(int x, int y, int width, int height, string imgName)
        {
            AjaxResult result = null;

            try
            {
                ImageCut ic = new ImageCut(x, y, width, height);

                var cutImageName = Guid.NewGuid().ToString();
                //string path = MyCommFun.GetRootPath() + GetImagePath(cutImageName);
                string cutPath    = MyCommFun.GetRootPath() + GetImagePath(cutImageName);
                var    sourcePath = MyCommFun.GetRootPath() + GetImagePath(imgName);
                Bitmap cuted      = ic.KiCut(new Bitmap(Image.FromFile(sourcePath)));

                cuted.Save(cutPath, ImageFormat.Jpeg);
                result = AjaxResult.Success(cutImageName);
            }
            catch (Exception ex)
            {
                result = AjaxResult.Error(ex.Message);
            }

            HttpContext.Current.Response.Write(result);
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.OnInit(e);
            if (errInitTemplates != "")
            {
                Response.Write(errInitTemplates);
                return;
            }

            //1获得模版基本信息
            BLL.wx_module_templates tBll = new BLL.wx_module_templates();
            templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid);
            if (templateFileName == null || templateFileName.Trim() == "")
            {
                errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!";
                Response.Write(errInitTemplates);
                Response.End();
                return;
            }

            //授权
            BLL.wx_userweixin   bll     = new BLL.wx_userweixin();
            Model.wx_userweixin wxModel = bll.GetModel(wid);
            string openid = "";
            string code   = MyCommFun.QueryString("code");

            if (code == null || code.Trim() == "")
            {
                // openid = MyCommFun.RequestOpenid();
                int    orderId = MyCommFun.RequestInt("orderid");
                string thisUrl = MyCommFun.getWebSite() + "/shop/confirmOrder.aspx?wid=" + wid;
                string newUrl  = OAuth.GetAuthorizeUrl(wxModel.AppId, thisUrl, "confirmOrder", OAuthScope.snsapi_base);
                Response.Redirect(newUrl);
            }
            else
            {
                var result = OAuth.GetAccessToken(wxModel.AppId, wxModel.AppSecret, code);
                openid = result.openid;
            }
            //授权结束



            BLL.wx_shop_user_addr           uAddrBll  = new BLL.wx_shop_user_addr();
            IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddr(openid, wid);

            if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
            {
                //该微信用户没有添加地址
                Response.Redirect("/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx");
                // MessageBox.ResponseScript(this, "window.location.href =/shop/editaddr.aspx?wid=" + wid + "&openid=" + openid + "&frompage=confirmOrder.aspx");
                return;
            }

            serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/confirmOrder.html";
            ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid);

            template.tType  = TemplateType.confirmOrder;
            template.openid = openid;
            template.OutPutHtml(wid);
        }
示例#19
0
        public string Apply_refund()
        {
            int    orderId = MyCommFun.RequestInt("orderid");
            int    wid     = MyCommFun.RequestInt("wid");
            string code    = MyCommFun.RequestParam("code");
            string state   = MyCommFun.RequestParam("state");

            BLL.wx_payment_wxpay   wxPayBll    = new BLL.wx_payment_wxpay();
            Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid);
            BLL.wx_userweixin      wx          = new BLL.wx_userweixin();
            Model.wx_userweixin    wxModel     = wx.GetModel(wid);
            BLL.orders             otBll       = new BLL.orders();
            Model.orders           orderEntity = otBll.GetModel(orderId, wid);
            litout_trade_no = orderEntity.order_no;
            amount          = orderEntity.order_amount.ToString();
            string         nonceStr          = TenPayV3Util.GetNoncestr();
            RequestHandler packageReqHandler = new RequestHandler(null);

            //设置package订单参数
            packageReqHandler.SetParameter("appid", paymentInfo.appId);            //公众账号ID
            packageReqHandler.SetParameter("mch_id", paymentInfo.partnerId);       //商户号
            packageReqHandler.SetParameter("out_trade_no", orderEntity.order_no);  //填入商家订单号
            packageReqHandler.SetParameter("out_refund_no", orderEntity.order_no); //填入退款订单号
            packageReqHandler.SetParameter("total_fee", amount);                   //填入总金额
            packageReqHandler.SetParameter("refund_fee", amount);                  //填入退款金额
            packageReqHandler.SetParameter("op_user_id", paymentInfo.partnerId);   //操作员Id,默认就是商户号
            packageReqHandler.SetParameter("nonce_str", nonceStr);                 //随机字符串
            string sign = packageReqHandler.CreateMd5Sign("key", paymentInfo.paySignKey);

            packageReqHandler.SetParameter("sign", sign);                           //签名
            //退款需要post的数据
            string data = packageReqHandler.ParseXML();


            //退款接口地址
            string url = "https://api.mch.weixin.qq.com/secapi/pay/refund";
            //本地或者服务器的证书位置(证书在微信支付申请成功发来的通知邮件中)
            string cert = MyCommFun.GetRootPath() + paymentInfo.CertInfoPath;

            //私钥(在安装证书时设置)
            string password = paymentInfo.partnerPwd;

            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            //调用证书
            X509Certificate2 cer = new X509Certificate2(cert, password, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet);

            #region 发起post请求
            HttpWebRequest webrequest = (HttpWebRequest)HttpWebRequest.Create(url);
            webrequest.ClientCertificates.Add(cer);
            webrequest.Method = "post";

            byte[] postdatabyte = Encoding.UTF8.GetBytes(data);
            webrequest.ContentLength = postdatabyte.Length;
            Stream stream;
            stream = webrequest.GetRequestStream();
            stream.Write(postdatabyte, 0, postdatabyte.Length);
            stream.Close();

            HttpWebResponse httpWebResponse = (HttpWebResponse)webrequest.GetResponse();
            StreamReader    streamReader    = new StreamReader(httpWebResponse.GetResponseStream());
            string          responseContent = streamReader.ReadToEnd();
            #endregion

            var    res    = XDocument.Parse(responseContent);
            string openid = res.Element("xml").Element("out_refund_no").Value;

            return(openid);
        }