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.

78 lines
2.4 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <?php
  2. namespace App\Http\Controllers\Weixin;
  3. use App\Http\Controllers\Weixin\CommonController;
  4. use Illuminate\Http\Request;
  5. class CartController extends CommonController
  6. {
  7. public function __construct()
  8. {
  9. parent::__construct();
  10. }
  11. //商品列表
  12. public function index(Request $request)
  13. {
  14. //购物车列表
  15. $postdata = array(
  16. 'access_token' => $_SESSION['weixin_user_info']['access_token']
  17. );
  18. $url = env('APP_API_URL')."/cart_list";
  19. $res = curl_request($url,$postdata,'GET');
  20. $data['list'] = $res['data']['list'];
  21. //猜你喜欢商品列表
  22. $postdata = array(
  23. 'limit' => 4,
  24. 'orderby'=> 1,
  25. 'offset' => 0
  26. );
  27. $url = env('APP_API_URL')."/goods_list";
  28. $res = curl_request($url,$postdata,'GET');
  29. $data['like_goods_list'] = $res['data']['list'];
  30. return view('weixin.cart.index', $data);
  31. }
  32. //购物车结算
  33. public function cartCheckout($ids)
  34. {
  35. //购物车结算商品列表
  36. $postdata = array(
  37. 'ids' => $ids,
  38. 'access_token' => $_SESSION['weixin_user_info']['access_token']
  39. );
  40. $url = env('APP_API_URL')."/cart_checkout_goods_list";
  41. $res = curl_request($url,$postdata,'GET');
  42. $data['list'] = $res['data']['list'];
  43. //支付方式列表
  44. $postdata = array(
  45. 'status' => 1,
  46. 'access_token' => $_SESSION['weixin_user_info']['access_token']
  47. );
  48. $url = env('APP_API_URL')."/payment_list";
  49. $res = curl_request($url,$postdata,'GET');
  50. $data['payment_list'] = $res['data']['list'];
  51. //用户默认收货地址
  52. $postdata = array(
  53. 'access_token' => $_SESSION['weixin_user_info']['access_token']
  54. );
  55. $url = env('APP_API_URL')."/user_default_address";
  56. $res = curl_request($url,$postdata,'GET');
  57. $data['user_default_address'] = $res['data'];
  58. //用户收货地址列表
  59. //收货地址列表
  60. $postdata = array(
  61. 'limit' => 100,
  62. 'access_token' => $_SESSION['weixin_user_info']['access_token']
  63. );
  64. $url = env('APP_API_URL')."/user_address_list";
  65. $res = curl_request($url,$postdata,'GET');
  66. $data['address_list'] = $res['data']['list'];
  67. return view('weixin.cart.cartCheckout', $data);
  68. }
  69. }