|
@@ -7,6 +7,8 @@ defined('InShopNC') or exit('Access Invalid!');
|
|
|
|
|
|
require_once (BASE_ROOT_PATH . '/helper/goods_helper.php');
|
|
|
require_once (BASE_ROOT_PATH . '/helper/activity_helper.php');
|
|
|
+require_once(BASE_ROOT_PATH . '/helper/algorithm.php');
|
|
|
+
|
|
|
|
|
|
class cart_item
|
|
|
{
|
|
@@ -105,6 +107,15 @@ class cartControl extends mobileControl
|
|
|
$summary_list = array_merge($summary_list,$related_summary['summary']);
|
|
|
}
|
|
|
|
|
|
+ //有可能购物车中的商品被删除....
|
|
|
+ $avables_goods = [];
|
|
|
+ foreach ($summary_list as $summay) {
|
|
|
+ $avables_goods[] = $summay['goods_id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $err_goods = algorithm::not_in($goods_ids,$avables_goods);
|
|
|
+ $cart_infos = $this->remove_err($cart_infos,$err_goods);
|
|
|
+
|
|
|
if($minest_cartid == 0) {
|
|
|
$ret['free_info'] = $this->full_send();
|
|
|
}
|
|
@@ -120,6 +131,27 @@ class cartControl extends mobileControl
|
|
|
return self::outsuccess($ret);
|
|
|
}
|
|
|
|
|
|
+ private function remove_err($cart_infos,$err_goods)
|
|
|
+ {
|
|
|
+ if(empty($err_goods)) return $cart_infos;
|
|
|
+
|
|
|
+ $result = [];
|
|
|
+ foreach ($cart_infos as $cart)
|
|
|
+ {
|
|
|
+ if($cart['bl_id'] > 0) {
|
|
|
+ $result[] = $cart;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(algorithm::binary_search($cart['goods_id'],$err_goods) == false) {
|
|
|
+ $result[] = $cart;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
private function full_send()
|
|
|
{
|
|
|
$result = [];
|