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-03-22 12:10:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cf774f04c1b781587fed4bb9247abcd3b80d3aae
cf774f04
1 parent
b6de1751
1.重构模板和临境上传功能
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
128 additions
and
22 deletions
app/Admin/Controllers/AdminMakeVideoController.php
app/Console/Commands/DevFFmpeg.php
app/Jobs/MakeVideo.php
app/Models/Immerse.php
app/Providers/HorizonServiceProvider.php
database/migrations/2022_01_24_163547_create_immerse_table.php
database/migrations/2022_03_22_105031_alter_immerse_table.php
app/Admin/Controllers/AdminMakeVideoController.php
View file @
cf774f0
...
...
@@ -6,6 +6,7 @@ use App\Admin\Renderable\PoemTable;
use
App\Admin\Renderable\TemplateTable
;
use
App\Jobs\MakeVideo
;
use
App\Models\AdminMakeVideo
;
use
App\Models\Immerse
;
use
App\Models\Order
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
...
...
@@ -22,18 +23,20 @@ class AdminMakeVideoController extends AdminController
*/
protected
function
grid
()
{
return
Grid
::
make
(
new
AdminMakeVideo
(),
function
(
Grid
$grid
)
{
return
Grid
::
make
(
new
Immerse
(),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
where
(
'user_id'
,
'='
,
1
);
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'poem_id'
);
$grid
->
column
(
'title'
);
$grid
->
column
(
'content'
);
$grid
->
column
(
'url'
)
->
image
();
$grid
->
column
(
'type'
);
$grid
->
column
(
'video_url'
);
$grid
->
column
(
'images_url'
);
$grid
->
column
(
'bg_music'
);
$grid
->
column
(
'bgm_url'
);
$grid
->
column
(
'feel'
);
$grid
->
column
(
'duration'
);
$grid
->
column
(
'size'
);
$grid
->
column
(
'poem_id'
);
$grid
->
column
(
'temp_id'
);
$grid
->
column
(
'thumbnail'
);
$grid
->
column
(
'
thumbnail_url
'
);
$grid
->
column
(
'
bgm
'
);
$grid
->
column
(
'created_at'
);
$grid
->
column
(
'updated_at'
)
->
sortable
();
...
...
app/Console/Commands/DevFFmpeg.php
View file @
cf774f0
...
...
@@ -3,6 +3,7 @@
namespace
App\Console\Commands
;
use
App\Models\AdminMakeVideo
;
use
App\Models\Immerse
;
use
Illuminate\Console\Command
;
use
Illuminate\Support\Facades\Storage
;
...
...
@@ -50,7 +51,7 @@ class DevFFmpeg extends Command
// $adminMakeVideo->thumbnail_url = Storage::disk('public')->path($adminMakeVideo->thumbnail_url);
$adminMakeVideo
->
poem
;
$adminMakeVideo
->
temp
->
components
;
dd
(
$adminMakeVideo
->
toArray
());
$file
=
$adminMakeVideo
->
video_url
;
// $watermark = Storage::disk('public')->path('image/logo.jpg');
...
...
@@ -127,7 +128,17 @@ class DevFFmpeg extends Command
if
(
$this
->
execmd
(
$cmd
))
{
// todo create insert
// 全部合成以后创建 临境
$video_info
=
$this
->
mediainfo
(
$video2
);
Immerse
::
query
()
->
create
([
'user_id'
=>
1
,
'title'
=>
''
,
'content'
=>
$adminMakeVideo
->
feel
,
'url'
=>
$video2
,
'type'
=>
$adminMakeVideo
->
type
==
1
?
2
:
1
,
'duration'
=>
$video_info
[
'format'
][
'duration'
],
'size'
=>
$video_info
[
'format'
][
'size'
],
]);
}
else
{
return
false
;
}
...
...
app/Jobs/MakeVideo.php
View file @
cf774f0
...
...
@@ -3,6 +3,7 @@
namespace
App\Jobs
;
use
App\Models\AdminMakeVideo
;
use
App\Models\Immerse
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Contracts\Queue\ShouldBeUnique
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
...
...
@@ -106,9 +107,23 @@ class MakeVideo implements ShouldQueue
if
(
$this
->
execmd
(
$cmd
))
{
// 全部合成以后创建 临境
$video_info
=
$this
->
mediainfo
(
$video2
);
Immerse
::
query
()
->
create
([
'user_id'
=>
1
,
'title'
=>
''
,
'content'
=>
$this
->
adminMakeVideo
->
feel
,
'url'
=>
$video2
,
'type'
=>
$this
->
adminMakeVideo
->
type
==
1
?
2
:
1
,
'duration'
=>
$video_info
[
'format'
][
'duration'
],
'size'
=>
$video_info
[
'format'
][
'size'
],
'poem_id'
=>
$this
->
adminMakeVideo
->
poem_id
,
'temp_id'
=>
$this
->
adminMakeVideo
->
temp_id
,
'thumbnail'
=>
$this
->
adminMakeVideo
->
thumbnail_url
,
'bgm'
=>
$this
->
adminMakeVideo
->
bgm_url
,
]);
}
else
{
return
false
;
return
;
}
}
...
...
app/Models/Immerse.php
View file @
cf774f0
...
...
@@ -11,6 +11,7 @@ class Immerse extends Model
use
HasDateTimeFormatter
;
protected
$table
=
'immerse'
;
protected
$guarded
=
[
''
];
public
function
send
(
$user_id
,
$type
,
$audio
=
''
,
$video
=
''
)
{
...
...
app/Providers/HorizonServiceProvider.php
0 → 100644
View file @
cf774f0
<?php
namespace
App\Providers
;
use
Illuminate\Support\Facades\Gate
;
use
Laravel\Horizon\Horizon
;
use
Laravel\Horizon\HorizonApplicationServiceProvider
;
class
HorizonServiceProvider
extends
HorizonApplicationServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public
function
boot
()
{
parent
::
boot
();
// Horizon::routeSmsNotificationsTo('15556667777');
// Horizon::routeMailNotificationsTo('example@example.com');
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
// Horizon::night();
}
/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected
function
gate
()
{
Gate
::
define
(
'viewHorizon'
,
function
(
$user
)
{
return
in_array
(
$user
->
email
,
[
//
]);
});
}
}
database/migrations/2022_01_24_163547_create_immerse_table.php
View file @
cf774f0
...
...
@@ -18,17 +18,18 @@ class CreateImmerseTable extends Migration
$table
->
unsignedBigInteger
(
'user_id'
)
->
index
()
->
comment
(
'用户id'
);
$table
->
string
(
'title'
)
->
default
(
''
)
->
comment
(
'标题'
);
$table
->
text
(
'content'
)
->
comment
(
'内容'
);
$table
->
string
(
'url'
)
->
comment
(
'最终合成视频地址'
);
$table
->
unsignedTinyInteger
(
'type'
)
->
comment
(
'音频图文=1,视频=2'
);
$table
->
unsignedBigInteger
(
'duration'
)
->
comment
(
'时长'
);
$table
->
unsigned
Big
Integer
(
'size'
)
->
comment
(
'大小'
);
$table
->
integer
(
'praise'
)
->
comment
(
'点赞量'
);
$table
->
integer
(
'view'
)
->
comment
(
'播放量'
);
$table
->
integer
(
'collect'
)
->
comment
(
'收藏量'
);
$table
->
integer
(
'share'
)
->
comment
(
'分享量'
);
$table
->
integer
(
'comment'
)
->
comment
(
'评论数'
);
$table
->
unsignedTinyInteger
(
'is_self'
)
->
index
()
->
default
(
'1'
)
->
comment
(
'自制=1,搬运=2'
);
$table
->
unsignedTinyInteger
(
'is_publish'
)
->
index
()
->
default
(
'1'
)
->
comment
(
'草稿=0,发布=1'
);
$table
->
unsignedTinyInteger
(
'is_check'
)
->
index
()
->
default
(
'0'
)
->
comment
(
'审核通过=1,未通过=0'
);
$table
->
double
(
'duration'
)
->
comment
(
'时长'
);
$table
->
unsignedInteger
(
'size'
)
->
comment
(
'大小'
);
$table
->
integer
(
'praise'
)
->
default
(
0
)
->
comment
(
'点赞量'
);
$table
->
integer
(
'view'
)
->
default
(
0
)
->
comment
(
'播放量'
);
$table
->
integer
(
'collect'
)
->
default
(
0
)
->
comment
(
'收藏量'
);
$table
->
integer
(
'share'
)
->
default
(
0
)
->
comment
(
'分享量'
);
$table
->
integer
(
'comment'
)
->
default
(
0
)
->
comment
(
'评论数'
);
$table
->
unsignedTinyInteger
(
'is_self'
)
->
index
()
->
default
(
1
)
->
comment
(
'自制=1,搬运=2'
);
$table
->
unsignedTinyInteger
(
'is_publish'
)
->
index
()
->
default
(
1
)
->
comment
(
'草稿=0,发布=1'
);
$table
->
unsignedTinyInteger
(
'is_check'
)
->
index
()
->
default
(
0
)
->
comment
(
'审核通过=1,未通过=0'
);
$table
->
timestamps
();
});
}
...
...
database/migrations/2022_03_22_105031_alter_immerse_table.php
0 → 100644
View file @
cf774f0
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
AlterImmerseTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
table
(
'immerse'
,
function
(
Blueprint
$table
)
{
$table
->
string
(
'poem_id'
)
->
after
(
'size'
)
->
comment
(
'一言id'
);
$table
->
string
(
'temp_id'
)
->
after
(
'poem_id'
)
->
comment
(
'模板id'
);
$table
->
string
(
'thumbnail'
)
->
after
(
'temp_id'
)
->
nullable
()
->
comment
(
'封面图'
);
$table
->
string
(
'bgm'
)
->
after
(
'thumbnail'
)
->
nullable
()
->
comment
(
'背景音乐'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropColumns
(
'immerse'
,
[
'poem_id'
,
'temp_id'
,
'thumbnail'
,
'bgm'
]);
}
}
Please
register
or
login
to post a comment