diff --git a/Server/application/plan/config/route.php b/Server/application/plan/config/route.php new file mode 100644 index 00000000..f315dded --- /dev/null +++ b/Server/application/plan/config/route.php @@ -0,0 +1,15 @@ +middleware(['jwt']); \ No newline at end of file diff --git a/Server/application/plan/controller/Scene.php b/Server/application/plan/controller/Scene.php new file mode 100644 index 00000000..e9897986 --- /dev/null +++ b/Server/application/plan/controller/Scene.php @@ -0,0 +1,67 @@ + 200, + 'msg' => '获取成功', + 'data' => $result + ]); + } + + /** + * 获取单个场景详情 + * + * @param int $id 场景ID + * @return \think\response\Json + */ + public function read($id) + { + // 查询场景信息 + $scene = PlanScene::getSceneInfo($id); + + if (!$scene) { + return json([ + 'code' => 404, + 'msg' => '场景不存在' + ]); + } + + return json([ + 'code' => 200, + 'msg' => '获取成功', + 'data' => $scene + ]); + } +} \ No newline at end of file diff --git a/Server/application/plan/model/PlanScene.php b/Server/application/plan/model/PlanScene.php new file mode 100644 index 00000000..de84e9e0 --- /dev/null +++ b/Server/application/plan/model/PlanScene.php @@ -0,0 +1,75 @@ + 'integer', + 'status' => 'integer', + 'createTime' => 'integer', + 'updateTime' => 'integer', + 'deleteTime' => 'integer' + ]; + + /** + * 获取场景列表 + * + * @param array $where 查询条件 + * @param string $order 排序 + * @param int $page 页码 + * @param int $limit 每页数量 + * @return array 场景列表和总数 + */ + public static function getSceneList($where = [], $order = 'id desc', $page = 1, $limit = 10) + { + // 构建查询 + $query = self::where($where); + + // 计算总数 + $total = $query->count(); + + // 分页查询数据 + $list = $query->page($page, $limit) + ->order($order) + ->select(); + + return [ + 'list' => $list, + 'total' => $total, + 'page' => $page, + 'limit' => $limit + ]; + } + + /** + * 获取单个场景信息 + * + * @param int $id 场景ID + * @return array|null 场景信息 + */ + public static function getSceneInfo($id) + { + return self::where('id', $id)->find(); + } +} \ No newline at end of file diff --git a/Server/route/route.php b/Server/route/route.php index 2d9bc7a3..9589acf2 100755 --- a/Server/route/route.php +++ b/Server/route/route.php @@ -27,4 +27,7 @@ include __DIR__ . '/../application/store/config/route.php'; // 加载CozeAI模块路由配置 include __DIR__ . '/../application/cozeai/config/route.php'; +// 加载Plan模块路由配置 +include __DIR__ . '/../application/plan/config/route.php'; + return [];