Files
mini_tp/route/app.php
T
nepiedg 69eb3e5019 feat(note): add image upload functionality for notes
- Implemented a new endpoint in the Note controller to handle image uploads associated with notes.
- Added the `uploadImage` method in NoteService to manage image storage and return public URLs.
- Updated API routes to include the new image upload endpoint, enhancing note management capabilities.
2026-04-20 10:27:54 +00:00

78 lines
3.1 KiB
PHP

<?php
declare(strict_types=1);
use think\facade\Route;
use app\api\controller\v1\Auth;
use app\api\controller\v1\Platform;
use app\api\controller\v1\PublishPlan;
use app\api\controller\v1\VideoWork;
use app\note\controller\v1\Ai as NoteAi;
use app\note\controller\v1\Auth as NoteAuth;
use app\note\controller\v1\Meta as NoteMeta;
use app\note\controller\v1\Note as NoteItem;
use app\note\controller\v1\Share as NoteShare;
/**
* 全局路由入口。
*
* 当前项目使用 ThinkPHP 8 的根级 `route/app.php` 自动加载机制。
* 之前把 API 路由写在 `app/api/route/app.php`,框架不会自动扫描该位置,
* 因此会导致 `api/v1/platform/accounts` 等接口返回 404。
*
* 这里统一把 API 路由注册到真正生效的位置。
*/
// v1 认证接口(公开)
Route::post('api/v1/auth/login', [Auth::class, 'login']);
Route::post('api/v1/auth/register', [Auth::class, 'register']);
Route::post('api/v1/auth/refresh', [Auth::class, 'refresh']);
// v1 认证接口(需登录)
Route::group('api/v1/auth', function () {
Route::get('me', [Auth::class, 'me']);
Route::post('logout', [Auth::class, 'logout']);
Route::post('password', [Auth::class, 'password']);
})->middleware(\app\api\middleware\Auth::class);
// v1 平台账号管理接口(需登录)
Route::group('api/v1/platform', function () {
Route::get('accounts', [Platform::class, 'accounts']);
})->middleware(\app\api\middleware\Auth::class);
// v1 发布计划接口(需登录)
Route::group('api/v1/publish-plan', function () {
Route::get('list', [PublishPlan::class, 'index']);
Route::post('start/:id', [PublishPlan::class, 'start']);
Route::post('stop/:id', [PublishPlan::class, 'stop']);
})->middleware(\app\api\middleware\Auth::class);
// v1 视频作品接口(需登录)
Route::group('api/v1/video-work', function () {
Route::get('list', [VideoWork::class, 'index']);
})->middleware(\app\api\middleware\Auth::class);
// note v1 笔记小程序模块接口规划(公开)
Route::group('note/v1', function () {
Route::get('meta/interfaces', [NoteMeta::class, 'interfaces']);
Route::post('auth/wechat-login', [NoteAuth::class, 'wechatLogin']);
Route::get('share/read/:token', [NoteShare::class, 'read']);
});
// note v1 笔记小程序模块接口(需登录)
Route::group('note/v1', function () {
Route::get('auth/me', [NoteAuth::class, 'me']);
Route::post('item/create', [NoteItem::class, 'create']);
Route::get('item/list', [NoteItem::class, 'index']);
Route::get('item/:id', [NoteItem::class, 'read']);
Route::post('item/update/:id', [NoteItem::class, 'update']);
Route::post('item/delete/:id', [NoteItem::class, 'delete']);
Route::post('item/transcript/:id', [NoteItem::class, 'transcript']);
Route::post('item/audio/:id', [NoteItem::class, 'audio']);
Route::post('item/image/:id', [NoteItem::class, 'image']);
Route::post('ai/summary/:id', [NoteAi::class, 'summary']);
Route::get('ai/summary/:id', [NoteAi::class, 'readSummary']);
Route::post('share/create/:id', [NoteShare::class, 'create']);
})->middleware(\app\api\middleware\Auth::class);