コード例 #1
0
 public ActionResult SiteBase(SiteInfo p_si)
 {
     SiteInfo m_site = SiteInfo.GetModel(t => t.id != 0);
     if (IsGet)
     {
         SetSaveFormCollection = b_BLL_SiteInfo.NameValueCollectionEx(ref m_site);
     }
     if (IsPost)
         try
         {
             p_si.id = m_site.id;
             b_BLL_SiteInfo.AESiteInfo(this, true, ref p_si);
         }
         catch (Exception ce)
         {
             IsSaveForm = true;
             ExceptionEx.MyExceptionLog.WriteLog(this, ce);
         }
     try
     {
         ViewData["_WebFriendLinks"] = string.IsNullOrEmpty(p_si.WebFriendLinks) ? m_site.WebFriendLinks : p_si.WebFriendLinks;
         ViewData["_WebWeiXinImage"] = string.IsNullOrEmpty(p_si.WebWeiXinImage) ? m_site.WebWeiXinImage : p_si.WebWeiXinImage;
         ViewData["_WebWeiBoImage"] = string.IsNullOrEmpty(p_si.WebWeiBoImage) ? m_site.WebWeiBoImage : p_si.WebWeiBoImage;
     }
     catch { }
     return View(p_si ?? new SiteInfo());
 }
コード例 #2
0
        /// <summary>
        /// 跳转支付函数
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult Checkout(string obj_uid, string M_UID, string cate, double?money)
        {
            string HomeUrl = SiteInfo.GetModel(t => t.id != 0).WebAddress;

            v_mid = "22483778";                                        // 商户号,这里为测试商户号20000400,替换为自己的商户号即可
            v_url = HomeUrl + "/CBPayMenForChongZhi/CBPayMen_Return";; // 商户自定义返回接收支付结果的页面
            // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
            string key = "klfd235d6s8922fd2s3afsa";                    // 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/

            // 登陆后在上面的导航栏里可能找到“资料管理”,在资料管理的二级导航栏里有“MD5密钥设置”
            // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了

            #region 充值 操作
            if (!string.IsNullOrEmpty(obj_uid) && money > 0)
            {
                //网站这边订单号
                v_oid    = obj_uid;           //Request["v_oid"];//订单编号
                v_amount = money.ToString2(); //订单金额
                if (v_oid == null || v_oid.Equals(""))
                {
                    DateTime dt      = DateTime.Now;
                    string   v_ymd   = dt.ToString("yyyyMMdd"); // yyyyMMdd
                    string   timeStr = dt.ToString("HHmmss");   // HHmmss
                    v_oid = v_ymd + v_mid + timeStr;
                }

                v_moneytype = "CNY";

                string text = v_amount + v_moneytype + v_oid + v_mid + v_url + key; // 拼凑加密串

                v_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();

                //收货信息
                //v_rcvname = "";// Request["v_rcvname"];
                //v_rcvaddr = "";// Request["v_rcvaddr"];
                //v_rcvtel = "";// Request["v_rcvtel"];
                //v_rcvpost = "";// Request["v_rcvpost"];
                //v_rcvemail = "";// Request["v_rcvemail"];
                //v_rcvmobile = "";// Request["v_rcvmobile"];

                ////订货人信息
                //v_ordername = Request["v_ordername"];
                //v_orderaddr = Request["v_orderaddr"];
                //v_ordertel = Request["v_ordertel"];
                //v_orderpost = Request["v_orderpost"];
                //v_orderemail = Request["v_orderemail"];
                //v_ordermobile = Request["v_ordermobile"];

                remark1 = cate;  // Request["remark1"];
                remark2 = M_UID; //Request["remark2"];

                StringBuilder sHtmlText = new StringBuilder();

                sHtmlText.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
                sHtmlText.AppendLine("  <html xmlns=\"http://www.w3.org/1999/xhtml\" >");
                sHtmlText.AppendLine("  <head runat=\"server\">");
                sHtmlText.AppendLine("      <title>订单提交</title>");
                sHtmlText.AppendLine("  </head>");
                sHtmlText.AppendLine("  <body >");
                sHtmlText.AppendLine("  <body onLoad=\"javascript:document.E_FORM.submit()\" >");
                sHtmlText.AppendLine("       <form    action=\"https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8\" accept-charset=\"utf-8\"  method=\"post\" name=\"E_FORM\">");

                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_md5info\"    value=\"" + v_md5info + "\" size=\"100\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_mid\"        value=\"" + v_mid + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_oid\"        value=\"" + v_oid + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_amount\"     value=\"" + v_amount + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_moneytype\"  value=\"" + v_moneytype + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_url\"        value=\"" + v_url + "\" />");


                sHtmlText.AppendLine("  <!--以下几项项为网上支付完成后,随支付反馈信息一同传给信息接收页-->");

                sHtmlText.AppendLine("   <input type=\"hidden\"  name=\"remark1\" value=\"" + remark1 + "\" />");
                sHtmlText.AppendLine("    <input type=\"hidden\"  name=\"remark2\" value=\"" + remark2 + "\" />");

                //sHtmlText.AppendLine("    <!--以下几项只是用来记录客户信息,可以不用,不影响支付 -->");

                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvname\"      value=\"<%=v_rcvname%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvaddr\"      value=\"<%=v_rcvaddr%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvtel\"       value=\"<%=v_rcvtel%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvpost\"      value=\"<%=v_rcvpost%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvemail\"     value=\"<%=v_rcvemail%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvmobile\"    value=\"<%=v_rcvmobile%>\" />");

                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_ordername\"    value=\"<%=v_ordername%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_orderaddr\"    value=\"<%=v_orderaddr%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_ordertel\"     value=\"<%=v_ordertel%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_orderpost\"    value=\"<%=v_orderpost%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_orderemail\"   value=\"<%=v_orderemail%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_ordermobile\"  value=\"<%=v_ordermobile%>\" />");
                sHtmlText.AppendLine("      </form>");
                sHtmlText.AppendLine("  </body>");
                sHtmlText.AppendLine("  </html>");

                return(Content(sHtmlText.ToString()));
            }
            #endregion

            return(Content("该交易流水号不存在!"));
        }
コード例 #3
0
        /// <summary>
        /// 跳转支付函数
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public ActionResult Checkout(string Order_UID, string Retaion_UID)
        {
            string     HomeUrl  = SiteInfo.GetModel(t => t.id != 0).WebAddress;
            SitePayAPI m_entity = SitePayAPI.GetModel(t => t.ApiType == "财付通");


            v_mid = m_entity.AppIdentity.ToString2();               // 商户号,这里为测试商户号20000400,替换为自己的商户号即可
            v_url = HomeUrl + "/CBPayMenForOrder/CBPayMen_Return";; // 商户自定义返回接收支付结果的页面
            // MD5密钥要跟订单提交页相同,如Send.asp里的 key = "test" ,修改""号内 test 为您的密钥
            string key = m_entity.AppKey.ToString2();               // 如果您还没有设置MD5密钥请登陆我们为您提供商户后台,地址:https://merchant3.chinabank.com.cn/
            // 登陆后在上面的导航栏里可能找到“资料管理”,在资料管理的二级导航栏里有“MD5密钥设置”
            // 建议您设置一个16位以上的密钥或更高,密钥最多64位,但设置16位已经足够了

            //应付金额
            double?PayMoney = 0;
            //会员编号
            string Member_UID = string.Empty;
            //订单编号集合
            string OrderUIDLIST = string.Empty;

            //if (!string.IsNullOrEmpty(Retaion_UID))
            //{
            //    List<Orders> order_list = Orders.GetModelList(t => t.O_Relation_UID == Retaion_UID).List;
            //    foreach (var item in order_list)
            //    {
            //        PayMoney += item.O_PayMoney;
            //        Member_UID = item.Member_UID;
            //        OrderUIDLIST += item.O_UID + ",";
            //    }
            //}
            //else
            //{
            //    Orders m_order = Orders.GetModel(t => t.O_UID == Order_UID);
            //    PayMoney = m_order.O_PayMoney;
            //    Member_UID = m_order.Member_UID;
            //    OrderUIDLIST += m_order.O_UID + ",";
            //}

            //网站这边订单号
            v_oid    = OrderUIDLIST; //Request["v_oid"];
            v_amount = PayMoney.ToString2();
            if (v_oid == null || v_oid.Equals(""))
            {
                DateTime dt      = DateTime.Now;
                string   v_ymd   = dt.ToString("yyyyMMdd"); // yyyyMMdd
                string   timeStr = dt.ToString("HHmmss");   // HHmmss
                v_oid = v_ymd + v_mid + timeStr;
            }

            #region 支付

            v_moneytype = "CNY";
            if (PayMoney > 0 && !string.IsNullOrEmpty(OrderUIDLIST))
            {
                string text = v_amount + v_moneytype + v_oid + v_mid + v_url + key; // 拼凑加密串
                v_md5info = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();
                remark1   = "支付订单:" + v_oid;                                        // Request["remark1"];
                remark2   = "";                                                     //Request["remark2"];

                StringBuilder sHtmlText = new StringBuilder();

                sHtmlText.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
                sHtmlText.AppendLine("  <html xmlns=\"http://www.w3.org/1999/xhtml\" >");
                sHtmlText.AppendLine("  <head runat=\"server\">");
                sHtmlText.AppendLine("      <title>订单提交</title>");
                sHtmlText.AppendLine("  </head>");
                sHtmlText.AppendLine("  <body >");
                sHtmlText.AppendLine("  <body  onLoad=\"javascript:document.E_FORM.submit()\">");
                sHtmlText.AppendLine("       <form    action=\"https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8\" accept-charset=\"utf-8\"  method=\"post\" name=\"E_FORM\">");

                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_md5info\"    value=\"" + v_md5info + "\" size=\"100\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_mid\"        value=\"" + v_mid + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_oid\"        value=\"" + v_oid + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_amount\"     value=\"" + v_amount + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_moneytype\"  value=\"" + v_moneytype + "\" />");
                sHtmlText.AppendLine("        <input type=\"hidden\" name=\"v_url\"        value=\"" + v_url + "\" />");


                sHtmlText.AppendLine("  <!--以下几项项为网上支付完成后,随支付反馈信息一同传给信息接收页-->");
                sHtmlText.AppendLine("   <input type=\"hidden\"  name=\"remark1\" value=\"" + remark1 + "\" />");
                sHtmlText.AppendLine("    <input type=\"hidden\"  name=\"remark2\" value=\"" + remark2 + "\" />");

                //sHtmlText.AppendLine("    <!--以下几项只是用来记录客户信息,可以不用,不影响支付 -->");

                sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvname\"      value=\"" + v_rcvname + "\" />");
                sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvaddr\"      value=\"" + v_rcvaddr + "\" />");
                sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvtel\"       value=\"" + v_rcvtel + "\" />");
                sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvpost\"      value=\"" + v_rcvpost + "\" />");
                sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvemail\"     value=\"" + v_rcvemail + "\" />");
                sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_rcvmobile\"    value=\"" + v_rcvmobile + "\" />");

                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_ordername\"    value=\"<%=v_ordername%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_orderaddr\"    value=\"<%=v_orderaddr%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_ordertel\"     value=\"<%=v_ordertel%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_orderpost\"    value=\"<%=v_orderpost%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_orderemail\"   value=\"<%=v_orderemail%>\" />");
                //sHtmlText.AppendLine("      <input type=\"hidden\"  name=\"v_ordermobile\"  value=\"<%=v_ordermobile%>\" />");
                sHtmlText.AppendLine("      </form>");
                sHtmlText.AppendLine("  </body>");
                sHtmlText.AppendLine("  </html>");

                return(Content(sHtmlText.ToString()));
            }
            #endregion

            return(Content("该订单流水号不存在!"));
        }