be58aac7e7
- Introduced `buildUserQuery` method in `DysVideoLog` model to create a base query for user-specific video logs. - Added `getVideoFilterAccountsByUserId` method in `DyVideoUser` model to retrieve active accounts for a specified user. - Updated routing to include new video work API endpoints under `v1/video-work`, requiring user authentication.
48 lines
1.7 KiB
PHP
48 lines
1.7 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;
|
|
|
|
/**
|
|
* 全局路由入口。
|
|
*
|
|
* 当前项目使用 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);
|