Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
8ed28c17
Commit
8ed28c17
authored
Oct 20, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加支付宝支付的return url
parent
b80a2293
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
+44
-3
Member.php
src/common/models/Member.php
+2
-0
HomeController.php
src/frontend/controllers/HomeController.php
+4
-3
PayController.php
src/frontend/controllers/PayController.php
+38
-0
No files found.
src/common/models/Member.php
View file @
8ed28c17
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
namespace
common\models
;
namespace
common\models
;
use
Yii
;
use
Yii
;
use
yii\behaviors\TimestampBehavior
;
use
yii\data\Pagination
;
use
yii\data\Pagination
;
use
yii\db\ActiveRecord
;
/**
/**
* This is the model class for table "member".
* This is the model class for table "member".
...
...
src/frontend/controllers/HomeController.php
View file @
8ed28c17
...
@@ -403,12 +403,13 @@ class HomeController extends \yii\web\Controller
...
@@ -403,12 +403,13 @@ class HomeController extends \yii\web\Controller
"subject"
=>
"购买课程-
{
$courseBaseInfo
[
'name'
]
}
"
,
//订单名称
"subject"
=>
"购买课程-
{
$courseBaseInfo
[
'name'
]
}
"
,
//订单名称
"total_fee"
=>
$price
,
//付款金额
"total_fee"
=>
$price
,
//付款金额
"body"
=>
'云崖购买'
,
//商品描述
"body"
=>
'云崖购买'
,
//商品描述
'return_url'
=>
Yii
::
$app
->
request
->
hostInfo
.
'/pay/alipay-return-url'
);
);
if
(
Yii
::
$app
->
deviceDetect
->
isMobile
())
{
if
(
Yii
::
$app
->
deviceDetect
->
isMobile
())
{
$parameter
[
'service'
]
=
\Yii
::
$app
->
params
[
'alipay'
][
'wap_service'
];
$parameter
[
'service'
]
=
\Yii
::
$app
->
params
[
'alipay'
][
'wap_service'
];
$parameter
[
'app_pay'
]
=
'Y'
;
$parameter
[
'app_pay'
]
=
'Y'
;
$parameter
[
'return_rul'
]
=
Url
::
base
()
.
'home/video?courseId='
.
$courseId
;
}
}
$html_text
=
$alipay
->
buildRequestForm
(
$parameter
,
"get"
,
"确认"
);
$html_text
=
$alipay
->
buildRequestForm
(
$parameter
,
"get"
,
"确认"
);
echo
$html_text
;
echo
$html_text
;
...
@@ -499,7 +500,7 @@ class HomeController extends \yii\web\Controller
...
@@ -499,7 +500,7 @@ class HomeController extends \yii\web\Controller
'device_info'
=>
"WEB"
,
'device_info'
=>
"WEB"
,
'nonce_str'
=>
Yii
::
$app
->
security
->
generateRandomString
(
16
),
'nonce_str'
=>
Yii
::
$app
->
security
->
generateRandomString
(
16
),
'sign'
=>
''
,
'sign'
=>
''
,
'body'
=>
'最课堂
-
课程购买'
,
'body'
=>
'最课堂
-
课程购买'
,
'out_trade_no'
=>
$order_id
,
'out_trade_no'
=>
$order_id
,
'total_fee'
=>
1
,
'total_fee'
=>
1
,
'spbill_create_ip'
=>
$_SERVER
[
'SERVER_ADDR'
],
'spbill_create_ip'
=>
$_SERVER
[
'SERVER_ADDR'
],
...
@@ -508,7 +509,7 @@ class HomeController extends \yii\web\Controller
...
@@ -508,7 +509,7 @@ class HomeController extends \yii\web\Controller
];
];
$xml
[
'sign'
]
=
WeixinPay
::
makeWeixinPaySign
(
$xml
,
$weixinpay
[
'key'
]);
$xml
[
'sign'
]
=
WeixinPay
::
makeWeixinPaySign
(
$xml
,
$weixinpay
[
'key'
]);
$xml
=
Utils
::
assocArrayToXML
(
'xml'
,
$xml
);
$xml
=
Utils
::
assocArrayToXML
(
'xml'
,
$xml
);
$reponse
=
$client
->
request
(
'POST'
,
$uri
,
[
'Content
-Type'
=>
'text/xml; charset=
UTF8'
,
'body'
=>
$xml
]);
$reponse
=
$client
->
request
(
'POST'
,
$uri
,
[
'Content
- Type'
=>
'text / xml; charset =
UTF8'
,
'body'
=>
$xml
]);
$reponse
=
$reponse
->
getBody
();
$reponse
=
$reponse
->
getBody
();
$result
=
((
string
)
$reponse
);
$result
=
((
string
)
$reponse
);
$result
=
Utils
::
xmlToArray
(
$result
);
$result
=
Utils
::
xmlToArray
(
$result
);
...
...
src/frontend/controllers/PayController.php
View file @
8ed28c17
...
@@ -27,6 +27,44 @@ class PayController extends Controller
...
@@ -27,6 +27,44 @@ class PayController extends Controller
public
$enableCsrfValidation
=
FALSE
;
public
$enableCsrfValidation
=
FALSE
;
/**
* return Url
*/
public
function
actionAlipayReturnUrl
()
{
//计算得出通知验证结果
$alipayNotify
=
new
AlipayNotify
();
$verify_result
=
$alipayNotify
->
verifyReturn
();
if
(
$verify_result
)
{
//验证成功
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//请在这里加上商户的业务逻辑程序代
//——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
//获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
//商户订单号
$out_trade_no
=
$_GET
[
'out_trade_no'
];
$order
=
Orders
::
findOne
([
'number'
=>
$out_trade_no
]);
if
(
$order
!==
NULL
)
{
//交易状态
$this
->
redirect
(
\Yii
::
$app
->
request
->
hostInfo
.
'/home/video?courseId='
.
$order
->
course_id
);
}
//——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
else
{
//验证失败
$this
->
redirect
(
\Yii
::
$app
->
request
->
hostInfo
);
//调试用,写文本函数记录程序运行情况是否正常
//logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
}
}
public
function
actionAlipayNotify
()
public
function
actionAlipayNotify
()
{
{
//计算得出通知验证结果
//计算得出通知验证结果
...
...
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