作者 lihan
1 个管道 的构建 通过 耗费 1 秒

支付宝

... ... @@ -167,7 +167,7 @@ class OrderController extends HomeBaseController
$this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info));
} //支付宝支付
elseif ($data['payment'] == 2) {
echo json_encode(['msg'=>'支付宝', 'url'=>url('order/Order/alipay',['oid'=>$oid]), 'code'=>20000]);
echo json_encode(['msg'=>'支付宝', 'url'=>url('order/Order/temp',['oid'=>$oid]), 'code'=>20000]);
exit();
} //余额支付
elseif ($data['payment'] == 0) {
... ... @@ -357,15 +357,29 @@ class OrderController extends HomeBaseController
}
}
//微信支付宝中转页面
public function temp() {
if(cmf_is_wechat()) {
echo '点击右上角,使用浏览器打开';
}else {
$this->alipay(1);
}
}
//欢迎支付宝支付
private function alipay($out_trade_no, $subject, $total_amount, $body)
private function alipay($oid)
{
if(1 == 1) {
if(!cmf_is_wechat()) {
header("Content-type: text/html; charset=utf-8");
require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php';
require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';
require EXTEND_PATH . '/alipay/config.php';
$out_trade_no = '2018101210215';
$subject = '购买';
$total_amount = 0.01;
$body = '商品';
//超时时间
$timeout_express = "1m";
... ... @@ -383,11 +397,6 @@ class OrderController extends HomeBaseController
}
}
//微信中转页面
public function alipayDo() {
return $this->fetch(':pay');
}
//支付宝回调
public function alipayNotify() {
... ...
... ... @@ -785,10 +785,12 @@
if(data.code == 20000) {
window.location.href=data.url;
}
}else {
}else if($(".icon-xuanzhong2").attr('data-var') == 2) {
if(data.code == 20000) {
window.location.href=data.url;
}
}else {
;
}
}
})
... ...