|
|
|
|
@ -11,12 +11,11 @@ class TrainingController extends CommonController
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/manager/get-videos",
|
|
|
|
|
* summary="获取视频列表",
|
|
|
|
|
* summary="V2-获取视频列表",
|
|
|
|
|
* description="获取视频列表",
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="查询关键词"),
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="integer"), required=false, description="当前页码,默认为1"),
|
|
|
|
|
* @OA\Parameter(name="pageLength", in="query", @OA\Schema(type="integer"), required=false, description="每页数量,默认为5"),
|
|
|
|
|
* @OA\Parameter(name="pageLength", in="query", @OA\Schema(type="integer"), required=false, description="每页数量,默认为3"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="获取视频列表"
|
|
|
|
|
@ -37,9 +36,33 @@ class TrainingController extends CommonController
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$pageLength = request()->pageLength ? (int)request()->pageLength : 5;
|
|
|
|
|
$data = $data->paginate($pageLength);
|
|
|
|
|
$pageLength = request()->pageLength ? (int)request()->pageLength : 3;
|
|
|
|
|
$data = $data->with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video", "published_at")->orderBy("published_at")->paginate($pageLength);
|
|
|
|
|
return response()->json($data->toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/manager/get-video/{id}",
|
|
|
|
|
* summary="V2-获取单条视频数据",
|
|
|
|
|
* description="获取单条视频数据",
|
|
|
|
|
* @OA\Parameter(name="id", in="path", @OA\Schema(type="integer"), required=true, description="视频内容ID"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="获取单条视频数据"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function getVideo($id)
|
|
|
|
|
{
|
|
|
|
|
$video = Training::with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video", "published_at")->find($id);
|
|
|
|
|
|
|
|
|
|
return response()->json($video->toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|