From 901da36493f715852c511cb335b1afc72206d45c Mon Sep 17 00:00:00 2001
From: "ZLW-PC\\Administrator" <374861669@qq.com>
Date: Thu, 9 Nov 2017 17:31:44 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=85=E5=80=BC=E6=98=8E=E7=BB=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/Api/UserMoneyController.php | 1 +
.../Controllers/Weixin/UserController.php | 50 +++++++++-
app/Http/Model/UserRecharge.php | 6 +-
.../views/weixin/user/userRecharge.blade.php | 3 +-
.../weixin/user/userRechargeOrder.blade.php | 96 +++++++++++++++++++
.../user/userRechargeOrderDetail.blade.php | 2 +-
routes/web.php | 4 +-
7 files changed, 150 insertions(+), 12 deletions(-)
create mode 100644 resources/views/weixin/user/userRechargeOrder.blade.php
diff --git a/app/Http/Controllers/Api/UserMoneyController.php b/app/Http/Controllers/Api/UserMoneyController.php
index f02aa96..8f30958 100644
--- a/app/Http/Controllers/Api/UserMoneyController.php
+++ b/app/Http/Controllers/Api/UserMoneyController.php
@@ -14,6 +14,7 @@ class UserMoneyController extends CommonController
parent::__construct();
}
+ //余额明细列表
public function userMoneyList(Request $request)
{
//参数
diff --git a/app/Http/Controllers/Weixin/UserController.php b/app/Http/Controllers/Weixin/UserController.php
index bc111ce..2c423a9 100644
--- a/app/Http/Controllers/Weixin/UserController.php
+++ b/app/Http/Controllers/Weixin/UserController.php
@@ -62,9 +62,53 @@ class UserController extends CommonController
return view('weixin.user.userRecharge');
}
+ //充值明细
+ public function userRechargeOrder(Request $request)
+ {
+ $pagesize = 10;
+ $offset = 0;
+ if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;}
+
+ $postdata = array(
+ 'limit' => $pagesize,
+ 'offset' => $offset,
+ 'status' => 1,
+ 'access_token' => $_SESSION['weixin_user_info']['access_token']
+ );
+ $url = env('APP_API_URL')."/user_recharge_list";
+ $res = curl_request($url,$postdata,'GET');
+ $data['list'] = $res['data']['list'];
+
+ $data['totalpage'] = ceil($res['data']['count']/$pagesize);
+
+ if(isset($_REQUEST['page_ajax']) && $_REQUEST['page_ajax']==1)
+ {
+ $html = '';
+
+ if($res['data']['list'])
+ {
+ foreach($res['data']['list'] as $k => $v)
+ {
+ $html .= '
';
+ $html .= '+ '.$v['money'].'';
+ $html .= '充值
';
+ $html .= '
'.$v['created_at'].'
';
+ $html .= '';
+ }
+ }
+
+ exit(json_encode($html));
+ }
+
+ return view('weixin.user.userRechargeOrder', $data);
+ }
+
//用户充值第二步,支付
- public function userRechargeOrderDetail($id)
+ public function userRechargeOrderDetail(Request $request)
{
+ $id = $request->input('id','');
+ if($id == ''){$this->error_jump(ReturnData::PARAMS_ERROR);}
+
//获取充值记录详情
$postdata = array(
'id' => $id,
@@ -102,7 +146,7 @@ class UserController extends CommonController
$unifiedOrder->setParameter("body","$body");//商品描述
$unifiedOrder->setParameter("out_trade_no","$out_trade_no");//商户订单号
$unifiedOrder->setParameter("total_fee","$total_fee");//总金额
- //$unifiedOrder->setParameter("attach","$attach"); //附加数据,选填,在查询API和支付通知中原样返回,可作为自定义参数使用,示例:a=1&b=2
+ $unifiedOrder->setParameter("attach","$attach"); //附加数据,选填,在查询API和支付通知中原样返回,可作为自定义参数使用,示例:a=1&b=2
$unifiedOrder->setParameter("notify_url","$notify_url");//通知地址
$unifiedOrder->setParameter("trade_type","JSAPI");//交易类型
$prepay_id = $unifiedOrder->getPrepayId();
@@ -111,7 +155,7 @@ class UserController extends CommonController
$jsApiParameters = $jsApi->getParameters();
$data['jsApiParameters'] = $jsApiParameters;
- $data['returnUrl'] = route('weixin_user'); //支付完成要跳转的url
+ $data['returnUrl'] = route('weixin_user_recharge_order'); //支付完成要跳转的url
return view('weixin.user.userRechargeOrderDetail', $data);
}
diff --git a/app/Http/Model/UserRecharge.php b/app/Http/Model/UserRecharge.php
index 3337033..8d5af6e 100644
--- a/app/Http/Model/UserRecharge.php
+++ b/app/Http/Model/UserRecharge.php
@@ -28,7 +28,7 @@ class UserRecharge extends BaseModel
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
- $model = new UserRecharge;
+ $model = new self();
if(isset($status) && $status!=-1){$where['status'] = $status;} //-1表示获取所有
@@ -41,10 +41,6 @@ class UserRecharge extends BaseModel
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get();
}
- else
- {
- return false;
- }
return $res;
}
diff --git a/resources/views/weixin/user/userRecharge.blade.php b/resources/views/weixin/user/userRecharge.blade.php
index 3348a8a..8e590ce 100644
--- a/resources/views/weixin/user/userRecharge.blade.php
+++ b/resources/views/weixin/user/userRecharge.blade.php
@@ -7,6 +7,7 @@
+
+
+
+@include('weixin.common.footer')
+