'delete'] ]; } public function delete() { if(!$this->validate()){ return $this->getModelError(); } try { Cart::cacheStatusSet(true); $this->cart_ids = json_decode($this->cart_ids, true); Cart::updateAll(['is_delete' => 1, 'deleted_at' => time()], [ 'id' => $this->cart_ids, 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id, 'user_id' => $this->user_id, 'plugin_sign' => $this->plugin_sign, ]); return $this->apiReturnSuccess("操作成功"); } catch (\Exception $e) { return $this->apiReturnError($e->getMessage()); } } public function clear() { if(!$this->validate()){ return $this->getModelError(); } try { Cart::cacheStatusSet(true); $this->cart_ids = json_decode($this->cart_ids, true); Cart::updateAll(['is_delete' => 1, 'deleted_at' => time()], [ 'is_delete' => 0, 'cx_mch_id' => $this->cx_mch_id, 'user_id' => $this->user_id, 'plugin_sign' => $this->plugin_sign, ]); return $this->apiReturnSuccess("操作成功"); } catch (\Exception $e) { return $this->apiReturnError($e->getMessage()); } } public function __destruct() { Cart::cacheStatusSet(false); } }