69eb3e5019
- 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.
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
use think\facade\Route;
|
||
use app\note\controller\v1\Ai;
|
||
use app\note\controller\v1\Auth;
|
||
use app\note\controller\v1\Meta;
|
||
use app\note\controller\v1\Note;
|
||
use app\note\controller\v1\Share;
|
||
|
||
/**
|
||
* note 应用路由
|
||
*
|
||
* 由于项目启用了 think-multi-app,
|
||
* `/note/...` 会优先进入 note 应用,
|
||
* 因此 note 模块自己的接口必须定义在 `app/note/route/app.php` 下,
|
||
* 路由前缀应从 `v1/...` 开始,而不是再重复写 `note/...`。
|
||
*/
|
||
|
||
// v1 笔记模块接口规划(公开)
|
||
Route::get('v1/meta/interfaces', [Meta::class, 'interfaces']);
|
||
Route::post('v1/auth/wechat-login', [Auth::class, 'wechatLogin']);
|
||
Route::get('v1/share/read/:token', [Share::class, 'read']);
|
||
|
||
// v1 笔记模块接口(需登录)
|
||
Route::group('v1', function () {
|
||
Route::get('auth/me', [Auth::class, 'me']);
|
||
|
||
Route::post('item/create', [Note::class, 'create']);
|
||
Route::get('item/list', [Note::class, 'index']);
|
||
Route::get('item/:id', [Note::class, 'read']);
|
||
Route::post('item/update/:id', [Note::class, 'update']);
|
||
Route::post('item/delete/:id', [Note::class, 'delete']);
|
||
Route::post('item/transcript/:id', [Note::class, 'transcript']);
|
||
Route::post('item/audio/:id', [Note::class, 'audio']);
|
||
Route::post('item/image/:id', [Note::class, 'image']);
|
||
|
||
Route::post('ai/summary/:id', [Ai::class, 'summary']);
|
||
Route::get('ai/summary/:id', [Ai::class, 'readSummary']);
|
||
Route::post('share/create/:id', [Share::class, 'create']);
|
||
})->middleware(\app\api\middleware\Auth::class);
|