Пример #1
0
 /**
  * 获取购物车中某个商品的数量
  * 
  * @param string $goodsId
  * @return integer
  */
 public function getCartGoodsQuantity($goodsId)
 {
     $quantity = (int) CartGoods::find()->select('count')->where(['goods_id' => $goodsId, 'user_id' => $this->id])->scalar();
     return $quantity;
 }