Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
90e1acfa
Commit
90e1acfa
authored
Aug 21, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
5adcb40f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
4 deletions
+55
-4
RequestHandler.cs
Mall.Common/Pay/WeChatPat/RequestHandler.cs
+42
-0
AppletUserController.cs
Mall.WebApi/Controllers/User/AppletUserController.cs
+10
-1
PayUtil.cs
Mall.WindowsService/Helper/PayUtil.cs
+3
-3
No files found.
Mall.Common/Pay/WeChatPat/RequestHandler.cs
View file @
90e1acfa
...
...
@@ -192,6 +192,29 @@ namespace Mall.Common.Pay.WeChatPat
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>
...
...
@@ -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>
...
...
Mall.WebApi/Controllers/User/AppletUserController.cs
View file @
90e1acfa
...
...
@@ -2105,7 +2105,16 @@ namespace Mall.WebApi.Controllers.User
{
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
);
}
...
...
Mall.WindowsService/Helper/PayUtil.cs
View file @
90e1acfa
...
...
@@ -24,7 +24,7 @@ namespace Mall.WindowsService.Helper
/// <param name="CustomerId"></param>
/// <param name="openid"></param>
/// <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
)))
...
...
@@ -41,13 +41,13 @@ namespace Mall.WindowsService.Helper
req
.
SetParameter
(
"check_name"
,
"NO_CHECK"
);
req
.
SetParameter
(
"amount"
,
(
dPrice
*
100
).
ToString
(
"f0"
));
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
result
=
Common
.
Pay
.
WeChatPat
.
HttpHelper
.
Post
(
new
Common
.
Pay
.
WeChatPat
.
Model
.
HttpParam
()
{
Url
=
"https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"
,
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,
CertPwd
=
model
.
WeChatPayMerchants
//证书密码默认为您的商户ID
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment