where(['user_id' => Yii::$app->user->getId()]) ->all(); } /** * @return bool * 更新购物车(增/删商品) */ public function actionUpdate() { $type = Yii::$app->request->post('type'); return Yii::$app->cartLogic->addOrSubGoods($type); } /** * @return ActiveRecord * 创建商品 */ public function actionCreate() { $goodsId = Yii::$app->request->getBodyParam('goodsId'); $count = Yii::$app->request->getBodyParam('count'); $skuId = Yii::$app->request->getBodyParam('skuId'); return Yii::$app->cartLogic->create($goodsId, $count, $skuId); } }