|
|
|
|
@ -37,10 +37,19 @@ class TrainingController extends CommonController
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$page_size = request()->page_size ? (int)request()->page_size : 3;
|
|
|
|
|
$data = $data->with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video as video_stopped", "published_at")->orderBy("published_at","desc")->paginate($page_size);
|
|
|
|
|
return response()->json($data->toArray());
|
|
|
|
|
|
|
|
|
|
//todo:配置视频开启用户
|
|
|
|
|
if ($this->manager->username == "liuyu") {
|
|
|
|
|
$data = $data->with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video", "published_at")->orderBy("published_at","desc")->paginate($page_size);
|
|
|
|
|
} else {
|
|
|
|
|
$data = $data->with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video as video_stopped", "published_at")->orderBy("published_at","desc")->paginate($page_size);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return response()->json($data->toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -58,9 +67,16 @@ class TrainingController extends CommonController
|
|
|
|
|
|
|
|
|
|
public function getVideo($id)
|
|
|
|
|
{
|
|
|
|
|
$video = Training::with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video as video_stopped", "published_at")->find($id);
|
|
|
|
|
//todo:配置视频开启用户
|
|
|
|
|
if ($this->manager->username == "liuyu") {
|
|
|
|
|
$video = Training::with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video as video", "published_at")->find($id);
|
|
|
|
|
} else {
|
|
|
|
|
$video = Training::with(["type" => function ($query) {
|
|
|
|
|
$query->select("id", "name");
|
|
|
|
|
}])->select("id", "type_id", "title", "poster", "video as video_stopped", "published_at")->find($id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response()->json($video->toArray());
|
|
|
|
|
}
|
|
|
|
|
|