Skip to content

Commit d185bcf

Browse files
committed
modified template files
1 parent 5af36f6 commit d185bcf

4 files changed

Lines changed: 37 additions & 3 deletions

File tree

app/Http/Controllers/PaymentController.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,27 @@
3535
class PaymentController extends Controller
3636
{
3737
protected static $config;
38-
39-
function __construct()
38+
/**
39+
* 构造函数
40+
*/
41+
public function __construct()
4042
{
4143
self::$config = $this->systemConfig();
4244
}
45+
46+
/**
47+
* 查询订单状态(ajax)
48+
* @param Request $request [description]
49+
* @return Payment 订单 JSON
50+
*/
4351
public function query(Request $request){
4452
return Payment::find($request->pid)->toarray();
4553
}
54+
/**
55+
* 发起订单创建请求
56+
* @param Request $request 请求
57+
* @return JSON 订单信息
58+
*/
4659
public function new(Request $request){
4760
$type = $request->type;
4861
$price = $request->price;
@@ -87,6 +100,12 @@ public function new(Request $request){
87100
}
88101
return $result;
89102
}
103+
/**
104+
* 支付宝接口返回
105+
* @param Request $req [description]
106+
* @param [type] $type [description]
107+
* @return [type] [description]
108+
*/
90109
public function return(Request $req, $type){
91110
$money = $_GET['money'];
92111
echo "您已经成功支付 $money 元,正在跳转..";
@@ -97,6 +116,12 @@ public function return(Request $req, $type){
97116
HTML;
98117
return;
99118
}
119+
/**
120+
* 回调处理 标记订单状态
121+
* @param Request $request [description]
122+
* @param [type] $type [description]
123+
* @return function [description]
124+
*/
100125
public function callback(Request $request, $type){
101126
$order_data = $_POST;
102127
$status = $order_data['status']; //获取传递过来的交易状态

app/Http/Controllers/UserController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function index(Request $request)
5555
$view['articleList'] = Article::query()->where('type', 1)->where('is_del', 0)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate(5);
5656
$view['wechat_qrcode'] = self::$config['wechat_qrcode'];
5757
$view['alipay_qrcode'] = self::$config['alipay_qrcode'];
58+
$view['payment_enabled'] = (self::$config['qqpay_enabled'] or self::$config['wepay_enabled']or self::$config['alipay_enabled']);
5859

5960
// 推广返利是否可见
6061
if (!$request->session()->has('referral_status')) {

resources/views/user/index.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@
9191
<p class="text-muted">
9292
余额:{{$info['balance']}}
9393
<span class="badge badge-danger">
94-
<a href="javascript:;" data-toggle="modal" data-target="#charge_modal" style="color:#FFF;">充值</a>
94+
@if (!$payment_enabled)
95+
<a href="javascript:;" data-toggle="modal" data-target="#charge_modal" style="color:#FFF;">充值</a>
96+
@else
97+
<a href="/user/payment" style="color:#FFF;">充值</a>
98+
@endif
9599
</span>
96100
&ensp;&ensp;积分:{{$info['score']}}
97101
<span class="badge badge-danger">

resources/views/user/payment.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
'type':"POST",
130130
'dataType':"json",
131131
success:function(data){
132+
$("#submit").button("reset");
132133
console.log(data);
133134
if(data.errcode==0){
134135
pid = data.pid;
@@ -143,6 +144,9 @@
143144
}
144145
}
145146
},
147+
error:function(data){
148+
$("#submit").button("reset");
149+
},
146150
});
147151
});
148152
function f(){

0 commit comments

Comments
 (0)