Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
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
chenchuanwen
my-yaf-project
Commits
da5a1009
Commit
da5a1009
authored
Nov 09, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试
parent
382c6bbb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
TencentPay.php
application/library/Payment/TencentPay.php
+6
-12
No files found.
application/library/Payment/TencentPay.php
View file @
da5a1009
...
...
@@ -21,8 +21,6 @@ class TencentPay {
protected
$s_appid
=
''
;
protected
$s_key
=
''
;
protected
$s_mch_id
=
''
;
protected
$s_sslcert_path
=
'application/library/Payment/cert/wxservice/1517411161_20181102_cert.pem'
;
protected
$s_sslkey_path
=
'application/library/Payment/cert/wxservice/1517411161_20181102_key.pem'
;
protected
$prepay_id
=
''
;
protected
$tradeType
=
''
;
public
$data
;
//接收到的数据,类型为关联数组
...
...
@@ -205,14 +203,8 @@ class TencentPay {
/**
* 作用:使用证书,以post方式提交xml到对应的接口url
*/
function
postXmlSSLCurl
(
$xml
,
$url
,
$second
=
30
,
$serviceFlag
=
false
)
function
postXmlSSLCurl
(
$xml
,
$url
,
$second
=
30
)
{
$certPath
=
APPLICATION_PATH
.
$this
->
sslcert_path
;
$keyPath
=
APPLICATION_PATH
.
$this
->
sslkey_path
;
if
(
$serviceFlag
){
$certPath
=
APPLICATION_PATH
.
$this
->
s_sslcert_path
;
$keyPath
=
APPLICATION_PATH
.
$this
->
s_sslkey_path
;
}
$ch
=
curl_init
();
//超时时间
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
$second
);
...
...
@@ -230,10 +222,10 @@ class TencentPay {
//使用证书:cert 与 key 分别属于两个.pem文件
//默认格式为PEM,可以注释
curl_setopt
(
$ch
,
CURLOPT_SSLCERTTYPE
,
'PEM'
);
curl_setopt
(
$ch
,
CURLOPT_SSLCERT
,
$certP
ath
);
curl_setopt
(
$ch
,
CURLOPT_SSLCERT
,
APPLICATION_PATH
.
$this
->
sslcert_p
ath
);
//默认格式为PEM,可以注释
curl_setopt
(
$ch
,
CURLOPT_SSLKEYTYPE
,
'PEM'
);
curl_setopt
(
$ch
,
CURLOPT_SSLKEY
,
$keyP
ath
);
curl_setopt
(
$ch
,
CURLOPT_SSLKEY
,
APPLICATION_PATH
.
$this
->
sslkey_p
ath
);
//post提交方式
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$xml
);
...
...
@@ -347,11 +339,13 @@ class TencentPay {
}
$returnXml
=
$this
->
returnXml
();;
if
(
$verify
)
{
return
array
(
$returnXml
=
array
(
'out_trade_no'
=>
$this
->
data
[
'out_trade_no'
],
'trade_no'
=>
$this
->
data
[
'transaction_id'
],
'returnXml'
=>
$returnXml
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$returnXml
,
true
),
'/data/log/applog'
);
return
$returnXml
;
}
return
false
;
}
...
...
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