Example #1
0
 public function del()
 {
     $cartId = (int) $this->getParam('cartId', 0);
     if ($cartId <= 0) {
         $this->ajaxReturn(ERR_PARAMS_ERROR, '参数错误');
         return;
     }
     UserCartModel::delCart($this->userId(), $cartId);
     $this->ajaxReturn(0, '');
 }
Example #2
0
 public static function getCartList($userId)
 {
     if ($userId <= 0) {
         return array();
     }
     $cartList = UserCartModel::getCartList($userId);
     if (empty($cartList)) {
         return array();
     }
     $cartResult = array();
     foreach ($cartList as $cartGoods) {
         $data = self::fillCartGoodsInfo($cartGoods);
         $cartResult[] = $data;
     }
     return $cartResult;
 }