Commit 90e1acfa authored by 吴春's avatar 吴春

提交代码

parent 5adcb40f
...@@ -192,6 +192,29 @@ namespace Mall.Common.Pay.WeChatPat ...@@ -192,6 +192,29 @@ namespace Mall.Common.Pay.WeChatPat
return sign; return sign;
} }
/// <summary>
/// 创建package签名,按参数名称a-z排序,遇到空值的参数不参加签名。
/// </summary>
/// <returns></returns>
public string CreateMd5Sign_V2( string WeChatApiSecret)
{
var sb = new StringBuilder();
var akeys = new ArrayList(Parameters.Keys);
akeys.Sort();
foreach (string k in akeys)
{
var v = (string)Parameters[k];
if (null != v && String.Compare("", v, StringComparison.Ordinal) != 0
&& String.Compare("sign", k, StringComparison.Ordinal) != 0 && String.Compare("key", k, StringComparison.Ordinal) != 0)
{
sb.Append(k + "=" + v + "&");
}
}
// sb.Append("key=" + GetKey());
sb.Append("key=" + WeChatApiSecret);
var sign = Plugin.SecurityHelper.MD5EncryptWeChat(sb.ToString(), GetCharset_V2()).ToUpper();
return sign;
}
/// <summary> /// <summary>
...@@ -307,6 +330,25 @@ namespace Mall.Common.Pay.WeChatPat ...@@ -307,6 +330,25 @@ namespace Mall.Common.Pay.WeChatPat
} }
/// <summary>
/// 获取编号
/// </summary>
/// <returns></returns>
protected virtual string GetCharset_V2()
{
try
{
return "UTF-8";
//return HttpHelper.GetRequestEncoding(accessor.HttpContext.Request).BodyName; // HttpContext.Current.Request.ContentEncoding.BodyName;
}
catch (Exception)
{
return "UTF-8";
}
}
/// <summary> /// <summary>
/// 获取编号 /// 获取编号
/// </summary> /// </summary>
......
...@@ -2105,7 +2105,16 @@ namespace Mall.WebApi.Controllers.User ...@@ -2105,7 +2105,16 @@ namespace Mall.WebApi.Controllers.User
{ {
model = new RB_SmallShops_Info_Extend(); model = new RB_SmallShops_Info_Extend();
} }
return ApiResult.Success("", model); var result = new
{
model.Id,
model.Logo,
model.Name,
model.Notice,
PriceType = (model.PriceType ?? 0),
UpPrice = (model.UpPrice ?? 0)
};
return ApiResult.Success("", result);
} }
......
...@@ -24,7 +24,7 @@ namespace Mall.WindowsService.Helper ...@@ -24,7 +24,7 @@ namespace Mall.WindowsService.Helper
/// <param name="CustomerId"></param> /// <param name="CustomerId"></param>
/// <param name="openid"></param> /// <param name="openid"></param>
/// <returns></returns> /// <returns></returns>
public static bool GetTransfersOrder(string sOrderNo, decimal dPrice, string CustomerId, string openid, RB_MiniProgram_Extend model, IHttpContextAccessor _accessor, string Remark = "") public static bool GetTransfersOrder(string sOrderNo, decimal dPrice, string CustomerId, string openid, RB_MiniProgram_Extend model, string Remark = "")
{ {
if (!System.IO.File.Exists(Path.Combine(Config.PayCertificateUrl, "App_Data/Certs/WeChatApp/" + model.WeChatPayCertificateUrl))) if (!System.IO.File.Exists(Path.Combine(Config.PayCertificateUrl, "App_Data/Certs/WeChatApp/" + model.WeChatPayCertificateUrl)))
...@@ -41,13 +41,13 @@ namespace Mall.WindowsService.Helper ...@@ -41,13 +41,13 @@ namespace Mall.WindowsService.Helper
req.SetParameter("check_name", "NO_CHECK"); req.SetParameter("check_name", "NO_CHECK");
req.SetParameter("amount", (dPrice * 100).ToString("f0")); req.SetParameter("amount", (dPrice * 100).ToString("f0"));
req.SetParameter("desc", Remark == "" ? "赞羊商城佣金提现" : Remark); req.SetParameter("desc", Remark == "" ? "赞羊商城佣金提现" : Remark);
req.SetParameter("sign", req.CreateMd5Sign(_accessor, model.WeChatApiSecret)); req.SetParameter("sign", req.CreateMd5Sign_V2( model.WeChatApiSecret));
var reqXml = req.ParseXml(); var reqXml = req.ParseXml();
var result = Common.Pay.WeChatPat.HttpHelper.Post(new Common.Pay.WeChatPat.Model.HttpParam() var result = Common.Pay.WeChatPat.HttpHelper.Post(new Common.Pay.WeChatPat.Model.HttpParam()
{ {
Url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers", Url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers",
PostParam = reqXml, PostParam = reqXml,
Encoding = Common.Pay.WeChatPat.HttpHelper.GetRequestEncoding(_accessor.HttpContext.Request), Encoding = Encoding.UTF8, //Common.Pay.WeChatPat.HttpHelper.GetRequestEncoding(_accessor.HttpContext.Request),
CertPath = Path.Combine(Config.PayCertificateUrl, "App_Data/Certs/WeChatApp/" + model.WeChatPayCertificateUrl),//"App_Data/Certs/WeChatApp/apiclient_cert.p12"),// model.WeChatPayCertificateUrl, CertPath = Path.Combine(Config.PayCertificateUrl, "App_Data/Certs/WeChatApp/" + model.WeChatPayCertificateUrl),//"App_Data/Certs/WeChatApp/apiclient_cert.p12"),// model.WeChatPayCertificateUrl,
CertPwd = model.WeChatPayMerchants//证书密码默认为您的商户ID CertPwd = model.WeChatPayMerchants//证书密码默认为您的商户ID
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment