/** * 购物车列表 * * @param string $member_id * @return array */ public static function Cart($member_id = '') { $Product = new ModelProduct(); if ($member_id) { $Cart = new ModelCart(); //判断临时数据库信息 $num = $Cart->CartProductSum($member_id); $cart_list = $Cart->Rows($member_id); $cart_list_new = $Product->CartGoods($cart_list); $item = isset($cart_list_new['item']) ? $cart_list_new['item'] : array(); $amount = $Cart->CartProductAmount($member_id); } else { $CartCache = new ModelCartCache(); $product_list = $CartCache->Product(); $cart_list_new = $Product->CartGoodsCache($product_list); $item = isset($cart_list_new['item']) ? $cart_list_new['item'] : array(); $total = $CartCache->Total(); $num = isset($total['total_num']) ? $total['total_num'] : 0; $amount = isset($total['total_price']) ? $total['total_price'] : 0.0; } return array('item' => $item, 'num' => $num, 'amount' => $amount); }
private function _deletecache($product_id) { $CartCache = new ModelCartCache(); $result = $CartCache->Del($product_id); echo json_encode($result); }