dataLists(new RobotLists()); } /** * @desc 添加机器人 */ public function add() { try { $params = (new RobotValidate())->post()->goCheck('add'); $result = RobotLogic::addRobot($params); if ($result) { return $this->success(data: RobotLogic::getReturnData()); } return $this->fail(RobotLogic::getError()); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } /** * @desc 更新机器人 */ public function update() { try { $params = (new RobotValidate())->post()->goCheck('update'); $result = RobotLogic::updateRobot($params); if ($result) { return $this->success(data: RobotLogic::getReturnData()); } return $this->fail(RobotLogic::getError()); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } /** * @desc 删除机器人 */ public function delete() { try { $params = (new RobotValidate())->post()->goCheck('delete'); $result = RobotLogic::deleteRobot($params); if ($result) { return $this->success(); } return $this->fail(RobotLogic::getError()); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } /** * @desc 删除机器人 */ public function detail() { try { $params = (new RobotValidate())->get()->goCheck('detail'); $result = RobotLogic::detailRobot($params); if ($result) { return $this->data(RobotLogic::getReturnData()); } return $this->fail(RobotLogic::getError()); } catch (HttpResponseException $e) { return $this->fail($e->getResponse()->getData()['msg'] ?? ''); } } }