Showing
7 changed files
with
128 additions
and
22 deletions
... | @@ -6,6 +6,7 @@ use App\Admin\Renderable\PoemTable; | ... | @@ -6,6 +6,7 @@ use App\Admin\Renderable\PoemTable; |
6 | use App\Admin\Renderable\TemplateTable; | 6 | use App\Admin\Renderable\TemplateTable; |
7 | use App\Jobs\MakeVideo; | 7 | use App\Jobs\MakeVideo; |
8 | use App\Models\AdminMakeVideo; | 8 | use App\Models\AdminMakeVideo; |
9 | +use App\Models\Immerse; | ||
9 | use App\Models\Order; | 10 | use App\Models\Order; |
10 | use Dcat\Admin\Form; | 11 | use Dcat\Admin\Form; |
11 | use Dcat\Admin\Grid; | 12 | use Dcat\Admin\Grid; |
... | @@ -22,18 +23,20 @@ class AdminMakeVideoController extends AdminController | ... | @@ -22,18 +23,20 @@ class AdminMakeVideoController extends AdminController |
22 | */ | 23 | */ |
23 | protected function grid() | 24 | protected function grid() |
24 | { | 25 | { |
25 | - return Grid::make(new AdminMakeVideo(), function (Grid $grid) { | 26 | + return Grid::make(new Immerse(), function (Grid $grid) { |
27 | + $grid->model()->where('user_id','=',1); | ||
28 | + | ||
26 | $grid->column('id')->sortable(); | 29 | $grid->column('id')->sortable(); |
27 | - $grid->column('poem_id'); | 30 | + $grid->column('title'); |
31 | + $grid->column('content'); | ||
32 | + $grid->column('url')->image(); | ||
28 | $grid->column('type'); | 33 | $grid->column('type'); |
29 | - $grid->column('video_url'); | 34 | + $grid->column('duration'); |
30 | - $grid->column('images_url'); | 35 | + $grid->column('size'); |
31 | - $grid->column('bg_music'); | 36 | + $grid->column('poem_id'); |
32 | - $grid->column('bgm_url'); | ||
33 | - $grid->column('feel'); | ||
34 | $grid->column('temp_id'); | 37 | $grid->column('temp_id'); |
35 | $grid->column('thumbnail'); | 38 | $grid->column('thumbnail'); |
36 | - $grid->column('thumbnail_url'); | 39 | + $grid->column('bgm'); |
37 | $grid->column('created_at'); | 40 | $grid->column('created_at'); |
38 | $grid->column('updated_at')->sortable(); | 41 | $grid->column('updated_at')->sortable(); |
39 | 42 | ... | ... |
... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
3 | namespace App\Console\Commands; | 3 | namespace App\Console\Commands; |
4 | 4 | ||
5 | use App\Models\AdminMakeVideo; | 5 | use App\Models\AdminMakeVideo; |
6 | +use App\Models\Immerse; | ||
6 | use Illuminate\Console\Command; | 7 | use Illuminate\Console\Command; |
7 | use Illuminate\Support\Facades\Storage; | 8 | use Illuminate\Support\Facades\Storage; |
8 | 9 | ||
... | @@ -50,7 +51,7 @@ class DevFFmpeg extends Command | ... | @@ -50,7 +51,7 @@ class DevFFmpeg extends Command |
50 | // $adminMakeVideo->thumbnail_url = Storage::disk('public')->path($adminMakeVideo->thumbnail_url); | 51 | // $adminMakeVideo->thumbnail_url = Storage::disk('public')->path($adminMakeVideo->thumbnail_url); |
51 | $adminMakeVideo->poem; | 52 | $adminMakeVideo->poem; |
52 | $adminMakeVideo->temp->components; | 53 | $adminMakeVideo->temp->components; |
53 | - dd($adminMakeVideo->toArray()); | 54 | + |
54 | 55 | ||
55 | $file = $adminMakeVideo->video_url; | 56 | $file = $adminMakeVideo->video_url; |
56 | // $watermark = Storage::disk('public')->path('image/logo.jpg'); | 57 | // $watermark = Storage::disk('public')->path('image/logo.jpg'); |
... | @@ -127,7 +128,17 @@ class DevFFmpeg extends Command | ... | @@ -127,7 +128,17 @@ class DevFFmpeg extends Command |
127 | 128 | ||
128 | 129 | ||
129 | if ($this->execmd($cmd)) { | 130 | if ($this->execmd($cmd)) { |
130 | - // todo create insert | 131 | + // 全部合成以后创建 临境 |
132 | + $video_info = $this->mediainfo($video2); | ||
133 | + Immerse::query()->create([ | ||
134 | + 'user_id' => 1, | ||
135 | + 'title' => '', | ||
136 | + 'content' => $adminMakeVideo->feel, | ||
137 | + 'url' => $video2, | ||
138 | + 'type' => $adminMakeVideo->type == 1 ? 2 : 1, | ||
139 | + 'duration' => $video_info['format']['duration'], | ||
140 | + 'size' => $video_info['format']['size'], | ||
141 | + ]); | ||
131 | } else { | 142 | } else { |
132 | return false; | 143 | return false; |
133 | } | 144 | } | ... | ... |
... | @@ -3,6 +3,7 @@ | ... | @@ -3,6 +3,7 @@ |
3 | namespace App\Jobs; | 3 | namespace App\Jobs; |
4 | 4 | ||
5 | use App\Models\AdminMakeVideo; | 5 | use App\Models\AdminMakeVideo; |
6 | +use App\Models\Immerse; | ||
6 | use Illuminate\Bus\Queueable; | 7 | use Illuminate\Bus\Queueable; |
7 | use Illuminate\Contracts\Queue\ShouldBeUnique; | 8 | use Illuminate\Contracts\Queue\ShouldBeUnique; |
8 | use Illuminate\Contracts\Queue\ShouldQueue; | 9 | use Illuminate\Contracts\Queue\ShouldQueue; |
... | @@ -106,9 +107,23 @@ class MakeVideo implements ShouldQueue | ... | @@ -106,9 +107,23 @@ class MakeVideo implements ShouldQueue |
106 | 107 | ||
107 | if ($this->execmd($cmd)) { | 108 | if ($this->execmd($cmd)) { |
108 | // 全部合成以后创建 临境 | 109 | // 全部合成以后创建 临境 |
109 | - | 110 | + $video_info = $this->mediainfo($video2); |
111 | + | ||
112 | + Immerse::query()->create([ | ||
113 | + 'user_id' => 1, | ||
114 | + 'title' => '', | ||
115 | + 'content' => $this->adminMakeVideo->feel, | ||
116 | + 'url' => $video2, | ||
117 | + 'type' => $this->adminMakeVideo->type == 1 ? 2 : 1, | ||
118 | + 'duration' => $video_info['format']['duration'], | ||
119 | + 'size' => $video_info['format']['size'], | ||
120 | + 'poem_id' => $this->adminMakeVideo->poem_id, | ||
121 | + 'temp_id' => $this->adminMakeVideo->temp_id, | ||
122 | + 'thumbnail' => $this->adminMakeVideo->thumbnail_url, | ||
123 | + 'bgm' => $this->adminMakeVideo->bgm_url, | ||
124 | + ]); | ||
110 | } else { | 125 | } else { |
111 | - return false; | 126 | + return; |
112 | } | 127 | } |
113 | 128 | ||
114 | } | 129 | } | ... | ... |
... | @@ -11,6 +11,7 @@ class Immerse extends Model | ... | @@ -11,6 +11,7 @@ class Immerse extends Model |
11 | use HasDateTimeFormatter; | 11 | use HasDateTimeFormatter; |
12 | protected $table = 'immerse'; | 12 | protected $table = 'immerse'; |
13 | 13 | ||
14 | + protected $guarded = ['']; | ||
14 | 15 | ||
15 | public function send($user_id, $type, $audio = '', $video = '') | 16 | public function send($user_id, $type, $audio = '', $video = '') |
16 | { | 17 | { | ... | ... |
app/Providers/HorizonServiceProvider.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace App\Providers; | ||
4 | + | ||
5 | +use Illuminate\Support\Facades\Gate; | ||
6 | +use Laravel\Horizon\Horizon; | ||
7 | +use Laravel\Horizon\HorizonApplicationServiceProvider; | ||
8 | + | ||
9 | +class HorizonServiceProvider extends HorizonApplicationServiceProvider | ||
10 | +{ | ||
11 | + /** | ||
12 | + * Bootstrap any application services. | ||
13 | + * | ||
14 | + * @return void | ||
15 | + */ | ||
16 | + public function boot() | ||
17 | + { | ||
18 | + parent::boot(); | ||
19 | + | ||
20 | + // Horizon::routeSmsNotificationsTo('15556667777'); | ||
21 | + // Horizon::routeMailNotificationsTo('example@example.com'); | ||
22 | + // Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel'); | ||
23 | + | ||
24 | + // Horizon::night(); | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * Register the Horizon gate. | ||
29 | + * | ||
30 | + * This gate determines who can access Horizon in non-local environments. | ||
31 | + * | ||
32 | + * @return void | ||
33 | + */ | ||
34 | + protected function gate() | ||
35 | + { | ||
36 | + Gate::define('viewHorizon', function ($user) { | ||
37 | + return in_array($user->email, [ | ||
38 | + // | ||
39 | + ]); | ||
40 | + }); | ||
41 | + } | ||
42 | +} |
... | @@ -18,17 +18,18 @@ class CreateImmerseTable extends Migration | ... | @@ -18,17 +18,18 @@ class CreateImmerseTable extends Migration |
18 | $table->unsignedBigInteger('user_id')->index()->comment('用户id'); | 18 | $table->unsignedBigInteger('user_id')->index()->comment('用户id'); |
19 | $table->string('title')->default('')->comment('标题'); | 19 | $table->string('title')->default('')->comment('标题'); |
20 | $table->text('content')->comment('内容'); | 20 | $table->text('content')->comment('内容'); |
21 | + $table->string('url')->comment('最终合成视频地址'); | ||
21 | $table->unsignedTinyInteger('type')->comment('音频图文=1,视频=2'); | 22 | $table->unsignedTinyInteger('type')->comment('音频图文=1,视频=2'); |
22 | - $table->unsignedBigInteger('duration')->comment('时长'); | 23 | + $table->double('duration')->comment('时长'); |
23 | - $table->unsignedBigInteger('size')->comment('大小'); | 24 | + $table->unsignedInteger('size')->comment('大小'); |
24 | - $table->integer('praise')->comment('点赞量'); | 25 | + $table->integer('praise')->default(0)->comment('点赞量'); |
25 | - $table->integer('view')->comment('播放量'); | 26 | + $table->integer('view')->default(0)->comment('播放量'); |
26 | - $table->integer('collect')->comment('收藏量'); | 27 | + $table->integer('collect')->default(0)->comment('收藏量'); |
27 | - $table->integer('share')->comment('分享量'); | 28 | + $table->integer('share')->default(0)->comment('分享量'); |
28 | - $table->integer('comment')->comment('评论数'); | 29 | + $table->integer('comment')->default(0)->comment('评论数'); |
29 | - $table->unsignedTinyInteger('is_self')->index()->default('1')->comment('自制=1,搬运=2'); | 30 | + $table->unsignedTinyInteger('is_self')->index()->default(1)->comment('自制=1,搬运=2'); |
30 | - $table->unsignedTinyInteger('is_publish')->index()->default('1')->comment('草稿=0,发布=1'); | 31 | + $table->unsignedTinyInteger('is_publish')->index()->default(1)->comment('草稿=0,发布=1'); |
31 | - $table->unsignedTinyInteger('is_check')->index()->default('0')->comment('审核通过=1,未通过=0'); | 32 | + $table->unsignedTinyInteger('is_check')->index()->default(0)->comment('审核通过=1,未通过=0'); |
32 | $table->timestamps(); | 33 | $table->timestamps(); |
33 | }); | 34 | }); |
34 | } | 35 | } | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +use Illuminate\Database\Migrations\Migration; | ||
4 | +use Illuminate\Database\Schema\Blueprint; | ||
5 | +use Illuminate\Support\Facades\Schema; | ||
6 | + | ||
7 | +class AlterImmerseTable extends Migration | ||
8 | +{ | ||
9 | + /** | ||
10 | + * Run the migrations. | ||
11 | + * | ||
12 | + * @return void | ||
13 | + */ | ||
14 | + public function up() | ||
15 | + { | ||
16 | + Schema::table('immerse', function (Blueprint $table) { | ||
17 | + $table->string('poem_id')->after('size')->comment('一言id'); | ||
18 | + $table->string('temp_id')->after('poem_id')->comment('模板id'); | ||
19 | + $table->string('thumbnail')->after('temp_id')->nullable()->comment('封面图'); | ||
20 | + $table->string('bgm')->after('thumbnail')->nullable()->comment('背景音乐'); | ||
21 | + }); | ||
22 | + } | ||
23 | + | ||
24 | + /** | ||
25 | + * Reverse the migrations. | ||
26 | + * | ||
27 | + * @return void | ||
28 | + */ | ||
29 | + public function down() | ||
30 | + { | ||
31 | + Schema::dropColumns('immerse', ['poem_id', 'temp_id', 'thumbnail', 'bgm']); | ||
32 | + } | ||
33 | +} |
-
Please register or login to post a comment