DTcms.API/Tenpay/TenpayUtil.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Xml;
using System.Text;
using System.Web;
using DTcms.Common;

namespace DTcms.API.Tenpay
{
	/// <summary>
	/// TenpayUtil 的摘要说明。
	/// </summary>
	public class TenpayUtil
	{
        public static string tenpay         ="1";
        public static string bargainor_id   = "";                   //财付通商户号
        public static string tenpay_key     = "";  					//财付通密钥;
        public static string tenpay_return  = "";//显示支付通知页面;
        public static string tenpay_notify  =""; //支付完成后的回调处理页面;

        static TenpayUtil()
        {
            //读取XML配置信息
            string fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config");
            XmlDocument doc = new XmlDocument();
            doc.Load(fullPath);
            XmlNode _bargainor_id = doc.SelectSingleNode(@"Root/bargainor_id");
            XmlNode _tenpay_key = doc.SelectSingleNode(@"Root/tenpay_key");
            XmlNode _tenpay_return = doc.SelectSingleNode(@"Root/tenpay_return");
            XmlNode _tenpay_notify = doc.SelectSingleNode(@"Root/tenpay_notify");
            //读取站点配置信息
            Model.siteconfig model = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING);

            bargainor_id = _bargainor_id.InnerText;
            tenpay_key = _tenpay_key.InnerText;
            tenpay_return = Utils.DelLastChar(model.weburl, "/") + _tenpay_return.InnerText;
            tenpay_notify = Utils.DelLastChar(model.weburl, "/") + _tenpay_notify.InnerText;
		}
		/** 对字符串进行URL编码 */
		public static string UrlEncode(string instr, string charset)
		{
			//return instr;
			if(instr == null || instr.Trim() == "")
				return "";
			else
			{
				string res;
				
				try
				{
					res = HttpUtility.UrlEncode(instr,Encoding.GetEncoding(charset));

				}
				catch (Exception ex)
				{
					res = HttpUtility.UrlEncode(instr,Encoding.GetEncoding("GB2312"));
				}
				
		
				return res;
			}
后面还有 60 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。