dataLists(new TodoLists()); } /** * @desc 添加待办 */ public function add() { try { $params = (new TodoValidate())->post()->goCheck('add'); $result = TodoLogic::addTodo($params); if ($result) { return $this->success(data: TodoLogic::getReturnData()); } return $this->fail(TodoLogic::getError()); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } /** * @desc 删除 */ public function delete() { try { $params = (new TodoValidate())->post()->goCheck('delete'); $result = TodoLogic::deleteTodo($params); if ($result) { return $this->success(); } return $this->fail(TodoLogic::getError()); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } /** * @desc 推送消息 */ public function push() { try { TodoLogic::pushMessageCron(); return $this->success(); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } }