post()->goCheck('add',['worker_id'=>$this->userId]); $result = ShopCartLogic::add($params); if(false === $result ){ return $this->fail(ShopCartLogic::getError() ?: '系统错误'); } return $this->success('加入购物车成功', [], 1, 0); } public function cartList() { return $this->dataLists(new ShopCartLists()); } public function delCart() { $params = (new ShopCartValidate())->post()->goCheck('delete',['worker_id'=>$this->userId]); $result = ShopCartLogic::delete($params); if(false === $result ){ return $this->fail(ShopCartLogic::getError() ?: '系统错误'); } return $this->success('删除购物车成功', [], 1, 0); } public function editCart() { $params = (new ShopCartValidate())->post()->goCheck('edit',['worker_id'=>$this->userId]); $result = ShopCartLogic::edit($params); if(false === $result ){ return $this->fail(ShopCartLogic::getError() ?: '系统错误'); } return $this->success('修改购物车成功', [], 1, 0); } }