You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.7 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. <?php
  2. namespace App\Http\Controllers\Weixin;
  3. use App\Http\Controllers\Weixin\CommonController;
  4. use Illuminate\Http\Request;
  5. class GoodsController extends CommonController
  6. {
  7. public function __construct()
  8. {
  9. parent::__construct();
  10. }
  11. //商品详情
  12. public function goodsDetail(Request $request)
  13. {
  14. if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
  15. if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
  16. if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');}
  17. if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
  18. if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');}
  19. if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');}
  20. if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;}
  21. if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;}
  22. //商品列表
  23. $postdata = array(
  24. 'limit' => 10,
  25. 'offset' => 0
  26. );
  27. $url = env('APP_API_URL')."/goods_list";
  28. $goods_list = curl_request($url,$postdata,'GET');
  29. $data['goods_list'] = $goods_list['data']['list'];
  30. return view('weixin.goods.goodsDetail', $data);
  31. }
  32. //商品列表
  33. public function goodsList(Request $request)
  34. {
  35. if($request->input('typeid', '') != ''){$data['typeid'] = $request->input('typeid');}
  36. if($request->input('tuijian', '') != ''){$data['tuijian'] = $request->input('tuijian');}
  37. if($request->input('keyword', '') != ''){$data['keyword'] = $request->input('keyword');}
  38. if($request->input('status', '') != ''){$data['status'] = $request->input('status');}
  39. if($request->input('is_promote', '') != ''){$data['is_promote'] = $request->input('is_promote');}
  40. if($request->input('orderby', '') != ''){$data['orderby'] = $request->input('orderby');}
  41. if($request->input('max_price', '') != ''){$data['max_price'] = $request->input('max_price');}else{$data['max_price'] = 99999;}
  42. if($request->input('min_price', '') != ''){$data['min_price'] = $request->input('min_price');}else{$data['min_price'] = 0;}
  43. //商品列表
  44. $postdata = array(
  45. 'limit' => 10,
  46. 'offset' => 0
  47. );
  48. $url = env('APP_API_URL')."/goods_list";
  49. $goods_list = curl_request($url,$postdata,'GET');
  50. $data['goods_list'] = $goods_list['data']['list'];
  51. return view('weixin.goods.goodsList', $data);
  52. }
  53. }