getList(); $robotSence = RobotSence::data(); return $this->fetch('index', compact('list', 'robotSence')); } /** * [delete] * 删除 * * @Author: Yeshihao * @DateTime: 2024/8/9 18:24 * @param $id * @return array|bool * @throws \think\exception\DbException */ public function delete($id) { $model = DtalkRobotModel::detail($id); if (!$model->setDelete()) { return $this->renderError($model->getError() ?: '删除失败'); } return $this->renderSuccess('删除成功'); } /** * 添加配送模板 * * @return array|mixed * @throws \think\Exception * @throws \think\exception\PDOException */ public function add() { if (!$this->request->isAjax()) { $robotSence = RobotSence::data(); return $this->fetch('add', compact('robotSence')); } // 新增记录 $model = new DtalkRobotModel; if ($model->add($this->postData())) { return $this->renderSuccess('添加成功', url('setting.dtalk_robot/index')); } return $this->renderError($model->getError() ?: '添加失败'); } /** * 编辑配送模板 * * @param $delivery_id * @return array|mixed * @throws \think\Exception * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function edit($id) { // 模板详情 $model = DtalkRobotModel::detail($id); if (!$this->request->isAjax()) { $robotSence = RobotSence::data(); return $this->fetch('edit', compact('model', 'robotSence')); } // 更新记录 if ($model->edit($this->postData())) { return $this->renderSuccess('更新成功'); } return $this->renderError($model->getError() ?: '更新失败'); } }