From 077b4dbcc03096e5e16c3b888553db60742326d9 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Wed, 26 Sep 2018 18:41:25 +0800 Subject: [PATCH] buy order --- .../Home/Controller/BuyController.class.php | 21 +- .../Home/View/Default/Buy/Index.html | 3 +- .../Service/BannerService.class.php | 1 + .../Service/BrandService.class.php | 3 +- .../Application/Service/BuyService.class.php | 289 +++++++++++++++++- .../Service/GoodsService.class.php | 3 + .../Service/OrderService.class.php | 66 ++++ .../Service/ResourcesService.class.php | 2 + .../Application/Service/UserService.class.php | 2 +- service/Public/Home/Default/Js/Buy.js | 6 +- 10 files changed, 366 insertions(+), 30 deletions(-) create mode 100644 service/Application/Service/OrderService.class.php diff --git a/service/Application/Home/Controller/BuyController.class.php b/service/Application/Home/Controller/BuyController.class.php index e2e3ea63e..436f19b2e 100644 --- a/service/Application/Home/Controller/BuyController.class.php +++ b/service/Application/Home/Controller/BuyController.class.php @@ -43,23 +43,13 @@ class BuyController extends CommonController { if(IS_POST) { + // 获取商品列表 $params = $_POST; $params['user'] = $this->user; - switch(I('buy_type')) - { - // 正常购买 - case 'goods' : - $ret = BuyService::BuyGoods($params); - break; - - // 购物车 - case 'cart' : - $ret = BuyService::BuyCart($params); - break; - } + $ret = BuyService::BuyTypeGoodsList($params); // 商品校验 - if(isset($ret['code']) && $ret['code'] == 0 && !empty($ret['data'])) + if(isset($ret['code']) && $ret['code'] == 0) { // 用户地址 $this->assign('user_address_list', UserService::UserAddressList(['user'=>$this->user])['data']); @@ -103,7 +93,10 @@ class BuyController extends CommonController { if(IS_POST) { - print_r($_POST); + $params = $_POST; + $params['user'] = $this->user; + $ret = BuyService::OrderAdd($params); + $this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']); } else { $this->assign('msg', L('common_unauthorized_access')); $this->display('/Public/TipsError'); diff --git a/service/Application/Home/View/Default/Buy/Index.html b/service/Application/Home/View/Default/Buy/Index.html index f3d9cc0ab..08517a60c 100644 --- a/service/Application/Home/View/Default/Buy/Index.html +++ b/service/Application/Home/View/Default/Buy/Index.html @@ -179,7 +179,7 @@