Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2022-05-08 23:24:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e3c595db24da1b673ed3bf7682099101b9f256d7
e3c595db
1 parent
c7afd175
1.合成分为视频和图文,思路整理
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
3 deletions
app/Admin/Controllers/AdminMakeVideoController.php
app/Jobs/MakeImages.php
routes/api.php
app/Admin/Controllers/AdminMakeVideoController.php
View file @
e3c595d
...
...
@@ -4,6 +4,7 @@ namespace App\Admin\Controllers;
use
App\Admin\Renderable\PoemTable
;
use
App\Admin\Renderable\TemplateTable
;
use
App\Jobs\MakeImages
;
use
App\Jobs\MakeVideo
;
use
App\Models\AdminMakeVideo
;
use
App\Models\Immerse
;
...
...
@@ -152,9 +153,15 @@ class AdminMakeVideoController extends AdminController
try
{
$video
=
AdminMakeVideo
::
query
()
->
create
(
$all
);
// 添加至队列
MakeVideo
::
dispatch
(
$video
);
if
(
$all
[
'type'
]
==
1
){
// 添加至队列
MakeVideo
::
dispatch
(
$video
);
}
elseif
(
$all
[
'type'
]
==
2
){
// 新增类型,不止视频,还有静态图。
// MakeImages
MakeImages
::
dispatch
(
$video
);
}
else
{
return
$this
->
form
()
->
response
()
->
error
(
'类型选择错误'
);
}
}
catch
(
\Exception
$exception
){
return
$this
->
form
()
->
response
()
->
error
(
$exception
->
getMessage
());
}
...
...
app/Jobs/MakeImages.php
0 → 100644
View file @
e3c595d
<?php
namespace
App\Jobs
;
use
App\Models\AdminMakeVideo
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Contracts\Queue\ShouldBeUnique
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
use
Illuminate\Foundation\Bus\Dispatchable
;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Queue\SerializesModels
;
class
MakeImages
implements
ShouldQueue
{
use
Dispatchable
,
InteractsWithQueue
,
Queueable
,
SerializesModels
;
public
$adminMakeVideo
;
protected
$ffmpeg
;
protected
$ffprobe
;
protected
$ffplay
;
/**
* Create a new job instance.
* @param AdminMakeVideo $adminMakeVideo
* @return void
*/
public
function
__construct
(
AdminMakeVideo
$adminMakeVideo
)
{
$this
->
adminMakeVideo
=
$adminMakeVideo
;
$this
->
ffmpeg
=
env
(
'FFMPEG_CMD'
);
$this
->
ffprobe
=
env
(
'FFPROBE_CMD'
);
$this
->
ffplay
=
env
(
'FFPLAY_CMD'
);
}
/**
* Execute the job.
*
* @return void
*/
public
function
handle
()
{
//思路:
// if 有背景音 多张图合成视频,时长为音频时长,音频加入背景音
// else 没有背景音,单图一张,输出为单图。
}
}
routes/api.php
View file @
e3c595d
...
...
@@ -40,6 +40,9 @@ Route::prefix('v1')->namespace('App\Http\Controllers\V1')->group(function (Route
/** 用户信息*/
$api
->
get
(
'/user'
,
'UserController@user'
)
->
middleware
(
'auth:sanctum'
);
/** 上传作品 */
$api
->
get
(
'/user'
,
'UserController@user'
)
->
middleware
(
'auth:sanctum'
);
/** 临境 */
$api
->
apiResource
(
'/immersive'
,
'ImmerseController'
);
...
...
Please
register
or
login
to post a comment