You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.2 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace POSV
{
public class WxPayV3ShortUrlRequestData : AbstractRequestData
{
/// <summary>
/// 公众账号ID
/// </summary>
public string AppId { get; set; }
/// <summary>
/// 商户号
/// </summary>
public string MchId { get; set; }
/// <summary>
/// 随机字符串
/// </summary>
public string NonceStr { get; set; }
/// <summary>
/// 需要转换的URL签名用原串传输需URLencode
/// </summary>
public string LongUrl { get; set; }
/// <summary>
/// 签名类型
/// </summary>
public string SignType { get; set; }
/// <summary>
///
/// </summary>
public string Key { get; set; }
public readonly string Sign;
/// <summary>
/// 转换短链接 请求参数
/// </summary>
/// <param name="appId"></param>
/// <param name="mchId"></param>
/// <param name="signType"></param>
/// <param name="longUrl"></param>
/// <param name="key"></param>
/// <param name="nonceStr"></param>
public WxPayV3ShortUrlRequestData(string appId , string mchId , string nonceStr ,
string longUrl , string key , string signType = "MD5")
{
AppId = appId;
MchId = mchId;
NonceStr = nonceStr;
SignType = signType;
LongUrl = longUrl;
Key = key;
#region 设置Request请求参数
//设置package订单参数
NewParameters.Add("appid" , this.AppId); //公众账号ID
NewParameters.Add("mch_id" , this.MchId); //商户号
NewParameters.Add("long_url" , this.LongUrl); //需要转换的URL
NewParameters.Add("nonce_str" , this.NonceStr); //随机字符串
NewParameters.Add("sign_type" , this.SignType); //签名类型
Sign = CreateMd5Sign("key" , this.Key);
NewParameters.Add("sign" , Sign); //签名
#endregion
}
}
}