diff --git a/app/index/controller/Buy.php b/app/index/controller/Buy.php index 236faa8b9..ea0a672cd 100755 --- a/app/index/controller/Buy.php +++ b/app/index/controller/Buy.php @@ -81,14 +81,14 @@ class Buy extends Common // 参数 $params = array_merge($this->data_request, $data); $params['user'] = $this->user; - $buy_ret = BuyService::BuyTypeGoodsList($params); + $ret = BuyService::BuyTypeGoodsList($params); // 商品校验 - if(isset($buy_ret['code']) && $buy_ret['code'] == 0) + if(isset($ret['code']) && $ret['code'] == 0) { // 基础信息 - $buy_base = $buy_ret['data']['base']; - $buy_goods = $buy_ret['data']['goods']; + $buy_base = $ret['data']['base']; + $buy_goods = $ret['data']['goods']; // 用户地址 $address = UserAddressService::UserAddressList(['user'=>$this->user]); @@ -112,7 +112,7 @@ class Buy extends Common MyViewAssign('is_load_baidu_map_api', 1); // 钩子 - $this->PluginsHook($buy_ret['data'], $params); + $this->PluginsHook($ret['data'], $params); // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('订单确认', 1)); diff --git a/app/service/BuyService.php b/app/service/BuyService.php index fd9a1aa96..c67720775 100755 --- a/app/service/BuyService.php +++ b/app/service/BuyService.php @@ -1687,8 +1687,22 @@ class BuyService return 0; } - // 获取购物车总数 - $total = self::CartTotal(['user_id'=>$params['user']['id']]); + // 条件 + $where = [ + ['user_id', '=', $params['user']['id']] + ]; + + // 购物车总数读取前钩子 + $hook_name = 'plugins_service_user_cart_total_begin'; + MyEventTrigger($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'params' => $params, + 'where' => &$where, + ]); + + + $total = self::CartTotal($where); return ($total > 99) ? '99+' : $total; }