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
25444040
Commit
25444040
authored
Oct 20, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加支付宝支付的return url
parent
8ed28c17
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
90 deletions
+7
-90
WxPay.JsApiPay.php
src/common/libs/weixin/WxPay.JsApiPay.php
+1
-1
HomeController.php
src/frontend/controllers/HomeController.php
+0
-38
PayController.php
src/frontend/controllers/PayController.php
+1
-1
index.php
src/frontend/views/weixin-js-pay/index.php
+4
-49
video-play.vue
src/frontend/web/js/home/components/video-play.vue
+1
-1
No files found.
src/common/libs/weixin/WxPay.JsApiPay.php
View file @
25444040
...
...
@@ -99,7 +99,7 @@ class JsApiPay
//初始化curl
$ch
=
curl_init
();
//设置超时
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
$this
->
curl_timeout
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
20
);
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYPEER
,
FALSE
);
curl_setopt
(
$ch
,
CURLOPT_SSL_VERIFYHOST
,
FALSE
);
...
...
src/frontend/controllers/HomeController.php
View file @
25444040
...
...
@@ -477,44 +477,6 @@ class HomeController extends \yii\web\Controller
return
QrCode
::
jpg
(
urldecode
(
$url
));
}
/**
* 移动端微信支付
*/
public
function
actionMobilePay
()
{
$weixinpay
=
\Yii
::
$app
->
params
[
'weixinpay'
];
$client
=
new
Client
(
[
'timeout'
=>
8
,
'verify'
=>
FALSE
,
'connect_timeout'
=>
8
]
);
$order_id
=
'12312312323'
;
$uri
=
WeixinPay
::
UNIFIEDORDER
;
$xml
=
[
'appid'
=>
$weixinpay
[
'appid'
],
'mch_id'
=>
$weixinpay
[
'mchid'
],
'device_info'
=>
"WEB"
,
'nonce_str'
=>
Yii
::
$app
->
security
->
generateRandomString
(
16
),
'sign'
=>
''
,
'body'
=>
'最课堂 - 课程购买'
,
'out_trade_no'
=>
$order_id
,
'total_fee'
=>
1
,
'spbill_create_ip'
=>
$_SERVER
[
'SERVER_ADDR'
],
'notify_url'
=>
WeixinPay
::
NOTIFY_URL
,
'trade_type'
=>
'MWEB'
,
];
$xml
[
'sign'
]
=
WeixinPay
::
makeWeixinPaySign
(
$xml
,
$weixinpay
[
'key'
]);
$xml
=
Utils
::
assocArrayToXML
(
'xml'
,
$xml
);
$reponse
=
$client
->
request
(
'POST'
,
$uri
,
[
'Content - Type'
=>
'text / xml; charset = UTF8'
,
'body'
=>
$xml
]);
$reponse
=
$reponse
->
getBody
();
$result
=
((
string
)
$reponse
);
$result
=
Utils
::
xmlToArray
(
$result
);
var_dump
(
$result
);
}
/**
* 生成订单号
...
...
src/frontend/controllers/PayController.php
View file @
25444040
...
...
@@ -188,7 +188,7 @@ class PayController extends Controller
'sign'
=>
''
,
'body'
=>
'最课堂-课程购买'
,
'out_trade_no'
=>
$order_id
,
'total_fee'
=>
$order
->
price
,
'total_fee'
=>
$order
->
credit
*
100
,
'spbill_create_ip'
=>
$_SERVER
[
'SERVER_ADDR'
],
'notify_url'
=>
WeixinPay
::
NOTIFY_URL
,
'trade_type'
=>
'NATIVE'
,
...
...
src/frontend/views/weixin-js-pay/index.php
View file @
25444040
...
...
@@ -2,39 +2,26 @@
//error_reporting(E_ERROR);
use
common\libs\WeixinPay
;
require_once
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
"/common/libs/weixin/libs/WxPay.Api.php"
;
require_once
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
"/common/libs/weixin/WxPay.JsApiPay.php"
;
require_once
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
"/common/libs/weixin/libs/WxPay.Api.php"
;
require_once
dirname
(
dirname
(
dirname
(
dirname
(
__FILE__
))))
.
"/common/libs/weixin/WxPay.JsApiPay.php"
;
//打印输出数组信息
function
printf_info
(
$data
)
{
foreach
(
$data
as
$key
=>
$value
)
{
echo
"<font color='#00ff55;'>
$key
</font> :
$value
<br/>"
;
}
}
//①、获取用户openid
$tools
=
new
JsApiPay
();
$openId
=
$tools
->
GetOpenid
();
//②、统一下单
$input
=
new
WxPayUnifiedOrder
();
$input
->
SetBody
(
"最课堂-课程购买"
);
$input
->
SetOut_trade_no
(
$number
);
$input
->
SetTotal_fee
(
$price
);
$input
->
SetTotal_fee
(
$price
*
100
);
$input
->
SetTime_start
(
date
(
"YmdHis"
));
$input
->
SetTime_expire
(
date
(
"YmdHis"
,
time
()
+
600
));
$input
->
SetNotify_url
(
WeixinPay
::
NOTIFY_URL
);
$input
->
SetTrade_type
(
"JSAPI"
);
$input
->
SetOpenid
(
$openId
);
$order
=
WxPayApi
::
unifiedOrder
(
$input
);
echo
'<font color="#f00"><b>统一下单支付单信息</b></font><br/>'
;
printf_info
(
$order
);
$jsApiParameters
=
$tools
->
GetJsApiParameters
(
$order
);
//获取共享收货地址js函数参数
$editAddress
=
$tools
->
GetEditAddressParameters
();
//③、在支持成功回调通知中处理成功之后的事宜,见 notify.php
/**
...
...
@@ -76,42 +63,10 @@ $editAddress = $tools->GetEditAddressParameters();
}
}
</script>
<script
type=
"text/javascript"
>
//获取共享地址
function
editAddress
()
{
WeixinJSBridge
.
invoke
(
'editAddress'
,
<?php
echo
$editAddress
;
?>
,
function
(
res
)
{
var
value1
=
res
.
proviceFirstStageName
;
var
value2
=
res
.
addressCitySecondStageName
;
var
value3
=
res
.
addressCountiesThirdStageName
;
var
value4
=
res
.
addressDetailInfo
;
var
tel
=
res
.
telNumber
;
alert
(
value1
+
value2
+
value3
+
value4
+
":"
+
tel
);
}
);
}
window
.
onload
=
function
()
{
if
(
typeof
WeixinJSBridge
==
"undefined"
)
{
if
(
document
.
addEventListener
)
{
document
.
addEventListener
(
'WeixinJSBridgeReady'
,
editAddress
,
false
);
}
else
if
(
document
.
attachEvent
)
{
document
.
attachEvent
(
'WeixinJSBridgeReady'
,
editAddress
);
document
.
attachEvent
(
'onWeixinJSBridgeReady'
,
editAddress
);
}
}
else
{
editAddress
();
}
};
</script>
</head>
<body>
<br/>
<font
color=
"#9ACD32"
><b>
该笔订单支付金额为
<span
style=
"color:#f00;font-size:50px"
>
<?=
$price
?>
</span
</b
></font><br/><br/>
<font
color=
"#9ACD32"
><b>
该笔订单支付金额为
<span
style=
"color:#f00;font-size:50px"
>
<?=
$price
?>
</span
</b
></font><br/><br/>
<div
align=
"center"
>
<button
style=
"width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;"
...
...
src/frontend/web/js/home/components/video-play.vue
View file @
25444040
...
...
@@ -184,7 +184,7 @@
window.location.href = url;
}
,
weixinJsPay(courseId){
var url = __BASE_URL__ + '
/
weixin-js-pay/index?courseId=' + courseId;
var url = __BASE_URL__ + 'weixin-js-pay/index?courseId=' + courseId;
window.location.href = url;
}
,
login(){
...
...
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