DTcms.API/DTcms.API.Payment.alipaypc/Core.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Web;

namespace DTcms.API.Payment.alipaypc
{
	public class Core
	{
		public static string BuildMysign(System.Collections.Generic.Dictionary<string, string> dicArray, string key, string sign_type, string _input_charset)
		{
			string prestr = Core.CreateLinkString(dicArray);
			prestr += key;
			return Core.Sign(prestr, sign_type, _input_charset);
		}

		public static System.Collections.Generic.Dictionary<string, string> FilterPara(System.Collections.Generic.SortedDictionary<string, string> dicArrayPre)
		{
			System.Collections.Generic.Dictionary<string, string> dicArray = new System.Collections.Generic.Dictionary<string, string>();
			foreach (System.Collections.Generic.KeyValuePair<string, string> temp in dicArrayPre)
			{
				if (temp.Key.ToLower() != "sign" && temp.Key.ToLower() != "sign_type" && temp.Value != "" && temp.Value != null)
				{
					dicArray.Add(temp.Key.ToLower(), temp.Value);
				}
			}
			return dicArray;
		}

		public static string CreateLinkString(System.Collections.Generic.Dictionary<string, string> dicArray)
		{
			System.Text.StringBuilder prestr = new System.Text.StringBuilder();
			foreach (System.Collections.Generic.KeyValuePair<string, string> temp in dicArray)
			{
				prestr.Append(temp.Key + "=" + temp.Value + "&");
			}
			int nLen = prestr.Length;
			prestr.Remove(nLen - 1, 1);
			return prestr.ToString();
		}

		public static string CreateLinkStringUrlencode(System.Collections.Generic.Dictionary<string, string> dicArray, System.Text.Encoding code)
		{
			System.Text.StringBuilder prestr = new System.Text.StringBuilder();
			foreach (System.Collections.Generic.KeyValuePair<string, string> temp in dicArray)
			{
				prestr.Append(temp.Key + "=" + HttpUtility.UrlEncode(temp.Value, code) + "&");
			}
			int nLen = prestr.Length;
			prestr.Remove(nLen - 1, 1);
			return prestr.ToString();
		}

		public static string Sign(string prestr, string sign_type, string _input_charset)
		{
			System.Text.StringBuilder sb = new System.Text.StringBuilder(32);
			if (sign_type.ToUpper() == "MD5")
			{
后面还有 20 行代码,购买后查看完整代码

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

AI 解读 AI

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

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