|
@@ -21,9 +21,11 @@ namespace MySystem
|
|
|
private WeChatFunction()
|
|
|
{ }
|
|
|
|
|
|
- public string AppId = "wx5417e0770bb19c4e";
|
|
|
- public string MchId = "1611167423";
|
|
|
- public string serialNo = "534165421BE2814DEC08F8D00BDAB9944B13646C";
|
|
|
+ public string AppId = "wx6e074b8e07b6577e";
|
|
|
+ public string AppSecret = "883f9ef7831d8ca82168c3fd6dcfb750";
|
|
|
+ public string MchId = "1613112281";
|
|
|
+ public string serialNo = "14E9FD7F0981BEA23F94137607521CB51C4F76EF";
|
|
|
+ public string platSerialNo = "";
|
|
|
|
|
|
#region 服务商平台商户进件提交申请单API
|
|
|
|
|
@@ -386,8 +388,8 @@ namespace MySystem
|
|
|
|
|
|
#region 敏感信息加密
|
|
|
|
|
|
- string pubkey = "MIID3DCCAsSgAwIBAgIUU0FlQhvigU3sCPjQC9q5lEsTZGwwDQYJKoZIhvcNAQELBQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsTFFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3QgQ0EwHhcNMjEwNjMwMDMwOTA5WhcNMjYwNjI5MDMwOTA5WjBuMRgwFgYDVQQDDA9UZW5wYXkuY29tIHNpZ24xEzARBgNVBAoMClRlbnBheS5jb20xHTAbBgNVBAsMFFRlbnBheS5jb20gQ0EgQ2VudGVyMQswCQYDVQQGDAJDTjERMA8GA1UEBwwIU2hlblpoZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC64SIwN1afgge2pjFeNZAlKz5ZdJw8W/hisaIJnkzbE/1oG5n+SgtbMLfBLBFp0zMyT5SP5ve5aJAvUjwnRwQoDG+4z3jE8vLyjFLxoy5sWGex8+FBC5hs81oAUHuazigi5NcSH9Ji/8Lq3zFh8Az4+ZchQ14SFhSGTifSZfdTX5wYDEv3DKDYgQvvAgDgjBF1Uj91NpVD7ruQj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XeGes9HPeUn7yGmvz4QC+sFO32haYr1SaAzZvMhf3RQVuAiFOnw"; //私钥
|
|
|
public string RSAEncrypt(string text)
|
|
|
{
|
|
|
byte[] publicKey = Convert.FromBase64String(pubkey);
|
|
@@ -453,9 +455,9 @@ namespace MySystem
|
|
|
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3100.0 Safari/537.36";
|
|
|
request.Accept = "application/json";
|
|
|
|
|
|
- string Authorization = GetAuthorization(url, method, postData, privateKey, merchantId, "62B64854B768D344249FDB9E6EF4A1232C000E84");
|
|
|
+ string Authorization = GetAuthorization(url, method, postData, privateKey, merchantId, serialNo);
|
|
|
request.Headers.Add("Authorization", Authorization);
|
|
|
- request.Headers.Add("Wechatpay-Serial", serialNo);
|
|
|
+ request.Headers.Add("Wechatpay-Serial", platSerialNo);
|
|
|
if (!string.IsNullOrEmpty(postData))
|
|
|
{
|
|
|
byte[] paramJsonBytes;
|
|
@@ -537,8 +539,7 @@ namespace MySystem
|
|
|
{
|
|
|
string url = "https://api.mch.weixin.qq.com/v3/merchant/media/upload";
|
|
|
|
|
|
- string merchantId = "1611167423"; //商户号
|
|
|
- string serialNo = "62B64854B768D344249FDB9E6EF4A1232C000E84"; //证书编号
|
|
|
+ string merchantId = MchId; //商户号
|
|
|
string privateKey = prikey;
|
|
|
#region 定义请求体中的内容 并转成二进制
|
|
|
|
|
@@ -572,7 +573,7 @@ namespace MySystem
|
|
|
var byteData3 = System.Text.Encoding.UTF8.GetBytes(campaignIDStr3);
|
|
|
#endregion
|
|
|
|
|
|
- string transactionsResponse = UploadImg_postJson(url, byteData1, byteData2, byteData3, metaStr, privateKey, merchantId, serialNo, boundary, "POST");
|
|
|
+ string transactionsResponse = UploadImg_postJson(url, byteData1, byteData2, byteData3, metaStr, privateKey, merchantId, platSerialNo, boundary, "POST");
|
|
|
var result=JsonMapper.ToObject(transactionsResponse);
|
|
|
return result["media_id"].ToString();
|
|
|
}
|