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
a96c3377
Commit
a96c3377
authored
Dec 10, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支付
parent
54e60e51
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
4 deletions
+29
-4
PayConst.php
application/library/Our/PayConst.php
+1
-0
TencentPay.php
application/library/Payment/TencentPay.php
+6
-2
WxPay.php
application/library/Payment/WxPay.php
+1
-0
PaymentService.php
application/models/Business/Order/PaymentService.php
+2
-2
wxAppNotifyService.php
public/pay/wxAppNotifyService.php
+19
-0
No files found.
application/library/Our/PayConst.php
View file @
a96c3377
...
@@ -45,6 +45,7 @@ class PayConst {
...
@@ -45,6 +45,7 @@ class PayConst {
const
wxAppNotifyUrl
=
'/pay/wxAppNotify.php'
;
const
wxAppNotifyUrl
=
'/pay/wxAppNotify.php'
;
const
wxAppNotifyUrlService
=
'/pay/wxAppNotifyService.php'
;
const
aliAppNotifyUrl
=
'/pay/aliAppNotify.php'
;
const
aliAppNotifyUrl
=
'/pay/aliAppNotify.php'
;
const
wxLiteNotifyUrl
=
'/pay/wxLiteNotify.php'
;
const
wxLiteNotifyUrl
=
'/pay/wxLiteNotify.php'
;
const
qPayNotifyUrl
=
'/pay/qPayNotify.php'
;
const
qPayNotifyUrl
=
'/pay/qPayNotify.php'
;
...
...
application/library/Payment/TencentPay.php
View file @
a96c3377
...
@@ -21,6 +21,7 @@ class TencentPay {
...
@@ -21,6 +21,7 @@ class TencentPay {
protected
$s_appid
=
''
;
protected
$s_appid
=
''
;
protected
$s_key
=
''
;
protected
$s_key
=
''
;
protected
$s_mch_id
=
''
;
protected
$s_mch_id
=
''
;
protected
$s_notify_url
=
''
;
protected
$prepay_id
=
''
;
protected
$prepay_id
=
''
;
protected
$tradeType
=
''
;
protected
$tradeType
=
''
;
public
$data
;
//接收到的数据,类型为关联数组
public
$data
;
//接收到的数据,类型为关联数组
...
@@ -79,7 +80,7 @@ class TencentPay {
...
@@ -79,7 +80,7 @@ class TencentPay {
$this
->
parameters
[
'sub_openid'
]
=
$orderInfo
[
'openid'
];
$this
->
parameters
[
'sub_openid'
]
=
$orderInfo
[
'openid'
];
}
}
$this
->
parameters
[
'spbill_create_ip'
]
=
\Our\Common
::
getClientIp
();
$this
->
parameters
[
'spbill_create_ip'
]
=
\Our\Common
::
getClientIp
();
$this
->
parameters
[
'notify_url'
]
=
$this
->
notify_url
;
$this
->
parameters
[
'notify_url'
]
=
$this
->
s_
notify_url
;
$this
->
parameters
[
'trade_type'
]
=
$this
->
tradeType
;
$this
->
parameters
[
'trade_type'
]
=
$this
->
tradeType
;
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$this
->
parameters
),
'/data/log/apptest'
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$this
->
parameters
),
'/data/log/apptest'
);
//$this->parameters['openid']=$_SESSION['openid'];
//$this->parameters['openid']=$_SESSION['openid'];
...
@@ -337,10 +338,13 @@ class TencentPay {
...
@@ -337,10 +338,13 @@ class TencentPay {
/**
/**
* 获取notify信息
* 获取notify信息
*/
*/
public
function
getNotifyInfo
()
{
public
function
getNotifyInfo
(
$serviceFlag
=
false
)
{
$xml
=
file_get_contents
(
"php://input"
);
$xml
=
file_get_contents
(
"php://input"
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$xml
),
'/data/log/apptest'
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$xml
),
'/data/log/apptest'
);
$this
->
saveData
(
$xml
);
$this
->
saveData
(
$xml
);
if
(
$serviceFlag
){
$this
->
key
=
$this
->
s_key
;
}
$verify
=
false
;
$verify
=
false
;
if
(
$this
->
checkSign
()
==
FALSE
){
if
(
$this
->
checkSign
()
==
FALSE
){
$this
->
setReturnParameter
(
"return_msg"
,
"签名失败"
);
//返回信息
$this
->
setReturnParameter
(
"return_msg"
,
"签名失败"
);
//返回信息
...
...
application/library/Payment/WxPay.php
View file @
a96c3377
...
@@ -25,6 +25,7 @@ class WxPay extends \Payment\TencentPay
...
@@ -25,6 +25,7 @@ class WxPay extends \Payment\TencentPay
$this
->
s_mch_id
=
\Our\PayConst
::
wxSPayMchId
;
$this
->
s_mch_id
=
\Our\PayConst
::
wxSPayMchId
;
$this
->
s_key
=
\Our\PayConst
::
wxSPayKey
;
$this
->
s_key
=
\Our\PayConst
::
wxSPayKey
;
$this
->
s_appid
=
\Our\PayConst
::
wxSPayAppId
;
$this
->
s_appid
=
\Our\PayConst
::
wxSPayAppId
;
$this
->
s_notify_url
=
\Our\Common
::
getBaseUrl
()
.
\Our\PayConst
::
wxAppNotifyUrlService
;
}
}
public
function
doPay
(
$orderInfo
)
public
function
doPay
(
$orderInfo
)
...
...
application/models/Business/Order/PaymentService.php
View file @
a96c3377
...
@@ -40,7 +40,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
...
@@ -40,7 +40,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
/**
/**
* app微信支付回调
* app微信支付回调
*/
*/
public
function
updateOrderToPayed
(
$channel
=
\Our\NameConst
::
wxAppChannel
){
public
function
updateOrderToPayed
(
$channel
=
\Our\NameConst
::
wxAppChannel
,
$serviceFlag
=
false
){
if
(
$channel
==
\Our\NameConst
::
wxLiteChannel
){
if
(
$channel
==
\Our\NameConst
::
wxLiteChannel
){
$wxpay
=
\Payment\WxLitePay
::
getInstance
();
$wxpay
=
\Payment\WxLitePay
::
getInstance
();
$param
[
'pay_type'
]
=
\Our\ApiConst
::
wxLitePayType
;
$param
[
'pay_type'
]
=
\Our\ApiConst
::
wxLitePayType
;
...
@@ -51,7 +51,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
...
@@ -51,7 +51,7 @@ class PaymentServiceModel extends \Business\AbstractModel{
$wxpay
=
\Payment\WxPay
::
getInstance
();
$wxpay
=
\Payment\WxPay
::
getInstance
();
$param
[
'pay_type'
]
=
\Our\ApiConst
::
wxAppPayType
;
$param
[
'pay_type'
]
=
\Our\ApiConst
::
wxAppPayType
;
}
}
$callbackInfo
=
$wxpay
->
getNotifyInfo
();
$callbackInfo
=
$wxpay
->
getNotifyInfo
(
$serviceFlag
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$callbackInfo
),
'/data/log/apptest'
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$callbackInfo
),
'/data/log/apptest'
);
if
(
$callbackInfo
)
{
if
(
$callbackInfo
)
{
//验证成功
//验证成功
...
...
public/pay/wxAppNotifyService.php
0 → 100644
View file @
a96c3377
<?php
/**
* APP微信支付回调
* User: liuyuzhen
* Date: 2018/7/3
* Time: 15:23
* Description:
*/
include
'security.php'
;
date_default_timezone_set
(
"Asia/Shanghai"
);
mb_internal_encoding
(
"UTF-8"
);
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../'
));
error_reporting
(
E_ALL
);
define
(
"APP_ENV"
,
ini_get
(
'yaf.environ'
));
define
(
"TIMESTAMP"
,
time
());
$app
=
new
\Yaf\Application
(
APPLICATION_PATH
.
"/conf/application.ini"
);
$app
->
bootstrap
();
$paymentService
=
\Business\Order\PaymentServiceModel
::
getInstance
();
$paymentService
->
updateOrderToPayed
(
\Our\NameConst
::
wxAppChannel
,
true
);
\ No newline at end of file
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