From 25fce4e042f40b1d967da1d340e2bbda761a817f Mon Sep 17 00:00:00 2001 From: "ZLW-PC\\Administrator" <374861669@qq.com> Date: Tue, 10 Oct 2017 17:43:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E8=AE=B0=E5=BD=95=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Weixin/CollectGoodsController.php | 37 +++++++++++ .../Controllers/Weixin/UserController.php | 31 +++++++++- resources/views/weixin/user/index.blade.php | 2 +- .../weixin/user/userGoodsHistory.blade.php | 61 +++++++++++++++++++ routes/web.php | 4 ++ 5 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 app/Http/Controllers/Weixin/CollectGoodsController.php diff --git a/app/Http/Controllers/Weixin/CollectGoodsController.php b/app/Http/Controllers/Weixin/CollectGoodsController.php new file mode 100644 index 0000000..8858034 --- /dev/null +++ b/app/Http/Controllers/Weixin/CollectGoodsController.php @@ -0,0 +1,37 @@ +input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');} + if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');} + if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');} + if($request->input('status', '') != ''){$data['status'] = $request->input('status');} + if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');} + if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');} + if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;} + if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;} + + //商品列表 + $postdata = array( + 'limit' => 10, + 'offset' => 0 + ); + $url = env('APP_API_URL')."/goods_list"; + $goods_list = curl_request($url,$postdata,'GET'); + $data['goods_list'] = $goods_list['data']['list']; + + return view('weixin.goods.goodslist', $data); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Weixin/UserController.php b/app/Http/Controllers/Weixin/UserController.php index 803f0fd..9dacf6f 100644 --- a/app/Http/Controllers/Weixin/UserController.php +++ b/app/Http/Controllers/Weixin/UserController.php @@ -40,16 +40,41 @@ class UserController extends CommonController public function userGoodsHistory(Request $request) { //商品列表 + $pagesize = 10; + $offset = 0; + if(isset($_REQUEST['page'])){$offset = ($_REQUEST['page']-1)*$pagesize;} + $postdata = array( - 'limit' => 10, - 'offset' => 0, + 'limit' => $pagesize, + 'offset' => $offset, 'access_token' => $_SESSION['weixin_user_info']['access_token'] ); $url = env('APP_API_URL')."/user_goods_history_list"; $res = curl_request($url,$postdata,'GET'); $data['user_goods_history'] = $res['data']['list']; - return view('weixin.user.userGoodsHistory', $data); + $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 .= '
'.$v['goods']['title'].'
'; + $html .= '¥'.$v['goods']['price'].'
'; + $html .= '删除
'; + $html .= '我的收藏
diff --git a/resources/views/weixin/user/userGoodsHistory.blade.php b/resources/views/weixin/user/userGoodsHistory.blade.php index 3a285aa..fe88526 100644 --- a/resources/views/weixin/user/userGoodsHistory.blade.php +++ b/resources/views/weixin/user/userGoodsHistory.blade.php @@ -21,6 +21,67 @@