Showing
7 changed files
with
120 additions
and
99 deletions
... | @@ -47,6 +47,7 @@ class AdminMakeVideoController extends AdminController | ... | @@ -47,6 +47,7 @@ class AdminMakeVideoController extends AdminController |
47 | $grid->column('feel','有感'); | 47 | $grid->column('feel','有感'); |
48 | $grid->column('weather','天气'); | 48 | $grid->column('weather','天气'); |
49 | $grid->column('huangli','黄历'); | 49 | $grid->column('huangli','黄历'); |
50 | + $grid->column('location','此地'); | ||
50 | $grid->column('poem_id'); | 51 | $grid->column('poem_id'); |
51 | $grid->column('temp_id'); | 52 | $grid->column('temp_id'); |
52 | $grid->column('thumbnail'); | 53 | $grid->column('thumbnail'); |
... | @@ -136,7 +137,9 @@ class AdminMakeVideoController extends AdminController | ... | @@ -136,7 +137,9 @@ class AdminMakeVideoController extends AdminController |
136 | ->when(2,function (Form $form){ | 137 | ->when(2,function (Form $form){ |
137 | $form->html(''); | 138 | $form->html(''); |
138 | }) | 139 | }) |
139 | - ->default(1); | 140 | + ->default(2); |
141 | + | ||
142 | + $form->text('location','此地')->placeholder('暂时先手动输入此地'); | ||
140 | 143 | ||
141 | $form->display('created_at'); | 144 | $form->display('created_at'); |
142 | $form->display('updated_at'); | 145 | $form->display('updated_at'); | ... | ... |
... | @@ -35,6 +35,9 @@ class ImmerseController extends AdminController | ... | @@ -35,6 +35,9 @@ class ImmerseController extends AdminController |
35 | 35 | ||
36 | $grid->column('id')->sortable(); | 36 | $grid->column('id')->sortable(); |
37 | $grid->column('content','有感'); | 37 | $grid->column('content','有感'); |
38 | + $grid->column('weather','天气'); | ||
39 | + $grid->column('huangli','黄历'); | ||
40 | + $grid->column('location','此地'); | ||
38 | $grid->column('url')->display(function ($url){ | 41 | $grid->column('url')->display(function ($url){ |
39 | return "<a target='_blank' href='". $url ."'>查看</a>"; | 42 | return "<a target='_blank' href='". $url ."'>查看</a>"; |
40 | }); | 43 | }); | ... | ... |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Dcat\Admin\Admin; | 3 | use Dcat\Admin\Admin; |
4 | +use Dcat\Admin\Form\Field\Map; | ||
4 | use Dcat\Admin\Grid; | 5 | use Dcat\Admin\Grid; |
5 | use Dcat\Admin\Form; | 6 | use Dcat\Admin\Form; |
6 | use Dcat\Admin\Grid\Filter; | 7 | use Dcat\Admin\Grid\Filter; |
... | @@ -29,4 +30,6 @@ use App\Admin\Extensions\Gallery; | ... | @@ -29,4 +30,6 @@ use App\Admin\Extensions\Gallery; |
29 | Admin::asset()->alias('@js', '/asset/js'); | 30 | Admin::asset()->alias('@js', '/asset/js'); |
30 | Admin::asset()->alias('@css', '/asset/css'); | 31 | Admin::asset()->alias('@css', '/asset/css'); |
31 | 32 | ||
32 | -Column::extend('gallery', Gallery::class); //grid列扩展 - 多图浏览 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
33 | +Column::extend('gallery', Gallery::class); //grid列扩展 - 多图浏览 | ||
34 | + | ||
35 | +Map::requireAssets(); // 引入地图资源 | ... | ... |
... | @@ -39,7 +39,10 @@ class ImmerseController extends Controller | ... | @@ -39,7 +39,10 @@ class ImmerseController extends Controller |
39 | 'type' => 'required', | 39 | 'type' => 'required', |
40 | 'content' => 'sometimes', | 40 | 'content' => 'sometimes', |
41 | 'weather' => 'sometimes', | 41 | 'weather' => 'sometimes', |
42 | - 'thumbnail' => 'sometimes', | 42 | + 'haungli' => 'sometimes', |
43 | + 'longitude' => 'sometimes', | ||
44 | + 'latitude' => 'sometimes', | ||
45 | + 'location' => 'sometimes', | ||
43 | ]); | 46 | ]); |
44 | 47 | ||
45 | if ($validator->fails()){ | 48 | if ($validator->fails()){ |
... | @@ -51,65 +54,32 @@ class ImmerseController extends Controller | ... | @@ -51,65 +54,32 @@ class ImmerseController extends Controller |
51 | $user_id = $request->user()->id; | 54 | $user_id = $request->user()->id; |
52 | 55 | ||
53 | $immerse = Immerse::query()->find($request->item_id); | 56 | $immerse = Immerse::query()->find($request->item_id); |
54 | -// if ($validated['type'] == 1){ | 57 | + |
55 | -// $create = Immerse::query()->create([ | 58 | + $create = Immerse::query()->create([ |
56 | -// 'user_id' => $user_id, | 59 | + 'user_id' => $user_id, |
57 | -// 'title' => '', | 60 | + 'title' => '', |
58 | -// 'content' => $validated['content'], | 61 | + 'content' => $validated['content'], |
59 | -// 'url' => '', | 62 | + 'weather' => $validated['weather'], |
60 | -// 'type' => $validated['type'], | 63 | + 'haungli' => $validated['haungli'], |
61 | -// 'duration' => 0, | 64 | + 'longitude' => $validated['longitude'], |
62 | -// 'size' => 0, | 65 | + 'latitude' => $validated['latitude'], |
63 | -// 'poem_id' => $immerse->poem_id, | 66 | + 'location' => $validated['location'], |
64 | -// 'temp_id' => $immerse->temp_id, | 67 | + 'url' => '', |
65 | -// 'thumbnail' => $immerse->thumbnail, | 68 | + 'type' => $validated['type'], |
66 | -// 'bgm' => $validated['item_url'], | 69 | + 'upload_file' => $validated['item_url'], |
67 | -// 'state' => 0 | 70 | + 'duration' => 0, |
68 | -// ]); | 71 | + 'size' => 0, |
69 | -// | 72 | + 'origin_video_url' => $immerse->origin_video_url, |
70 | -// // 添加至队列 | 73 | + 'origin_image_url' => $immerse->origin_image_url, |
71 | -// MakeImages::dispatch($create); | 74 | + 'poem_id' => $immerse->poem_id, |
72 | -// }else{ | 75 | + 'temp_id' => $immerse->temp_id, |
73 | -// // 视频 | 76 | + 'thumbnail' => '', |
74 | -// $create = Immerse::query()->create([ | 77 | + 'bgm' => $immerse->bgm, |
75 | -// 'user_id' => $user_id, | 78 | + 'state' => 0 |
76 | -// 'title' => '', | 79 | + ]); |
77 | -// 'content' => $validated['content'], | 80 | + |
78 | -// 'url' => '', | 81 | + // 添加至队列 |
79 | -// 'type' => $validated['type'], | 82 | + UserMakeImmerse::dispatch($create); |
80 | -// 'duration' => 0, | ||
81 | -// 'size' => 0, | ||
82 | -// 'poem_id' => $immerse->poem_id, | ||
83 | -// 'temp_id' => $immerse->temp_id, | ||
84 | -// 'thumbnail' => '', | ||
85 | -// 'bgm' => $immerse->bgm, | ||
86 | -// 'state' => 0 | ||
87 | -// ]); | ||
88 | -// | ||
89 | -// // 添加至队列 | ||
90 | -// MakeVideo::dispatch($create, $validated['item_url']); | ||
91 | -// } | ||
92 | - | ||
93 | - $create = Immerse::query()->create([ | ||
94 | - 'user_id' => $user_id, | ||
95 | - 'title' => '', | ||
96 | - 'content' => $validated['content'], | ||
97 | - 'url' => '', | ||
98 | - 'type' => $validated['type'], | ||
99 | - 'upload_file' => $validated['item_url'], | ||
100 | - 'duration' => 0, | ||
101 | - 'size' => 0, | ||
102 | - 'origin_video_url' => $immerse->origin_video_url, | ||
103 | - 'origin_image_url' => $immerse->origin_image_url, | ||
104 | - 'poem_id' => $immerse->poem_id, | ||
105 | - 'temp_id' => $immerse->temp_id, | ||
106 | - 'thumbnail' => '', | ||
107 | - 'bgm' => $immerse->bgm, | ||
108 | - 'state' => 0 | ||
109 | - ]); | ||
110 | - | ||
111 | - // 添加至队列 | ||
112 | - UserMakeImmerse::dispatch($create); | ||
113 | 83 | ||
114 | return Response::success($create); | 84 | return Response::success($create); |
115 | } | 85 | } | ... | ... |
... | @@ -486,13 +486,20 @@ class UserMakeImmerse implements ShouldQueue | ... | @@ -486,13 +486,20 @@ class UserMakeImmerse implements ShouldQueue |
486 | } | 486 | } |
487 | 487 | ||
488 | 488 | ||
489 | - public function getTextContentString($font) | 489 | + public function getTextContentString() |
490 | { | 490 | { |
491 | $components = $this->immerse->temp()->first()->components()->get(); | 491 | $components = $this->immerse->temp()->first()->components()->get(); |
492 | 492 | ||
493 | $drawtext = ''; | 493 | $drawtext = ''; |
494 | 494 | ||
495 | foreach ($components as $component) { | 495 | foreach ($components as $component) { |
496 | + $text_color = $component->text_color ?? 'white'; | ||
497 | + $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; | ||
498 | + $opacity = $component->opacity ? $component->opacity / 100 : 0.5; | ||
499 | + $font_file = Storage::disk('public')->path($component->font_file ?? 'ffmpeg/arialuni.ttf'); | ||
500 | + $text_bg_box = $component->text_bg_box ?? 0; | ||
501 | + $fix_bounds = $component->fix_bounds == 1; | ||
502 | + | ||
496 | switch ($component->name){ | 503 | switch ($component->name){ |
497 | case 'every_poem': | 504 | case 'every_poem': |
498 | case 'one_poem': | 505 | case 'one_poem': |
... | @@ -505,63 +512,54 @@ class UserMakeImmerse implements ShouldQueue | ... | @@ -505,63 +512,54 @@ class UserMakeImmerse implements ShouldQueue |
505 | $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; | 512 | $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; |
506 | 513 | ||
507 | $drawtext .= 'drawtext="'. | 514 | $drawtext .= 'drawtext="'. |
508 | - 'fontfile=' . escapeshellarg($font) . ':' . | 515 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
509 | 'textfile=' . escapeshellarg($text_file) . ':' . | 516 | 'textfile=' . escapeshellarg($text_file) . ':' . |
510 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . | 517 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . |
511 | - 'fontcolor=' . $text_color . '@1.0:' . | 518 | + 'fontcolor=' . $text_color . '@' . $opacity . ':' . |
512 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 519 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
513 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . | 520 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . |
514 | - 'box=1:boxborderw='. $this->calcBorderSize($component->font_size) . ':' . | 521 | + 'fix_bounds='. $fix_bounds . ':' . |
522 | + 'box=1:boxborderw='. $text_bg_box . ':' . | ||
515 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; | 523 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; |
516 | - | ||
517 | break; | 524 | break; |
518 | case 'weather': | 525 | case 'weather': |
519 | $content = '多云'; | 526 | $content = '多云'; |
520 | - $text_color = $component->text_color ?? 'white'; | ||
521 | - $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; | ||
522 | - $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; | ||
523 | - | ||
524 | $drawtext .= 'drawtext="'. | 527 | $drawtext .= 'drawtext="'. |
525 | - 'fontfile=' . escapeshellarg($font) . ':' . | 528 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
526 | 'text=' . escapeshellarg($content) . ':' . | 529 | 'text=' . escapeshellarg($content) . ':' . |
527 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . | 530 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . |
528 | - 'fontcolor=' . $text_color . '@1.0:' . | 531 | + 'fontcolor=' . $text_color . '@' . $opacity . ':' . |
529 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 532 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
530 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . | 533 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . |
531 | - 'box=1:boxborderw='. $this->calcBorderSize($component->font_size) . ':' . | 534 | + 'fix_bounds='. $fix_bounds . ':' . |
535 | + 'box=1:boxborderw='. $text_bg_box . ':' . | ||
532 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; | 536 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; |
533 | 537 | ||
534 | break; | 538 | break; |
535 | case 'date': | 539 | case 'date': |
536 | $content = Carbon::now()->format('Y年m月d日H时'); | 540 | $content = Carbon::now()->format('Y年m月d日H时'); |
537 | - $text_color = $component->text_color ?? 'white'; | ||
538 | - $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; | ||
539 | - $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; | ||
540 | - | ||
541 | $drawtext .= 'drawtext="'. | 541 | $drawtext .= 'drawtext="'. |
542 | - 'fontfile=' . escapeshellarg($font) . ':' . | 542 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
543 | 'text=' . escapeshellarg($content) . ':' . | 543 | 'text=' . escapeshellarg($content) . ':' . |
544 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . | 544 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . |
545 | - 'fontcolor=' . $text_color . '@1.0:' . | 545 | + 'fontcolor=' . $text_color . '@' . $opacity . ':' . |
546 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 546 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
547 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . | 547 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . |
548 | - 'box=1:boxborderw='. $this->calcBorderSize($component->font_size) . ':' . | 548 | + 'fix_bounds='. $fix_bounds . ':' . |
549 | + 'box=1:boxborderw='. $text_bg_box . ':' . | ||
549 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; | 550 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; |
550 | break; | 551 | break; |
551 | case 'feel': | 552 | case 'feel': |
552 | - $content = $this->immerse->content ?: '这里是发表临境有感'; | 553 | + $content = $this->immerse->content ?: '读此一言,仿佛身临其境。'; |
553 | - $text_color = $component->text_color ?? 'white'; | ||
554 | - $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; | ||
555 | - $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; | ||
556 | - | ||
557 | $drawtext .= 'drawtext="'. | 554 | $drawtext .= 'drawtext="'. |
558 | - 'fontfile=' . escapeshellarg($font) . ':' . | 555 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
559 | 'text=' . escapeshellarg($content) . ':' . | 556 | 'text=' . escapeshellarg($content) . ':' . |
560 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . | 557 | 'fontsize=' . $this->calcFontSize($component->font_size) . ':' . |
561 | - 'fontcolor=' . $text_color . '@1.0:' . | 558 | + 'fontcolor=' . $text_color . '@' . $opacity . ':' . |
562 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 559 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
563 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . | 560 | 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . |
564 | - 'box=1:boxborderw='. $this->calcBorderSize($component->font_size) . ':' . | 561 | + 'fix_bounds='. $fix_bounds . ':' . |
562 | + 'box=1:boxborderw='. $text_bg_box . ':' . | ||
565 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; | 563 | 'boxcolor=' . $text_bg_color . '@' . $opacity . '", '; |
566 | break; | 564 | break; |
567 | } | 565 | } |
... | @@ -579,14 +577,4 @@ class UserMakeImmerse implements ShouldQueue | ... | @@ -579,14 +577,4 @@ class UserMakeImmerse implements ShouldQueue |
579 | { | 577 | { |
580 | return ceil($this->output_width / 360 * $width); | 578 | return ceil($this->output_width / 360 * $width); |
581 | } | 579 | } |
582 | - | ||
583 | - /** | ||
584 | - * @param $width | ||
585 | - * @param $content | ||
586 | - * @return float | ||
587 | - */ | ||
588 | - public function calcBorderSize($width) | ||
589 | - { | ||
590 | - return ceil($width / 12 * 10); | ||
591 | - } | ||
592 | } | 580 | } | ... | ... |
... | @@ -364,4 +364,17 @@ return [ | ... | @@ -364,4 +364,17 @@ return [ |
364 | // the extension files will be generated in this directory. | 364 | // the extension files will be generated in this directory. |
365 | 'dir' => base_path('dcat-admin-extensions'), | 365 | 'dir' => base_path('dcat-admin-extensions'), |
366 | ], | 366 | ], |
367 | + | ||
368 | + 'map' => [ | ||
369 | + 'provider' => env('MAP_PROVIDER'), | ||
370 | + | ||
371 | + 'keys' => [ | ||
372 | + 'tencent' => env('TENCENT_MAP_API_KEY'), | ||
373 | + 'google' => env('GOOGLE_API_KEY'), | ||
374 | + 'baidu' => env('BAIDU_MAP_API_KEY'), | ||
375 | + 'amap' => env('AMAP_API_KEY'), //高德地图密钥 | ||
376 | + ], | ||
377 | + ], | ||
378 | + | ||
379 | + | ||
367 | ]; | 380 | ]; | ... | ... |
1 | +<?php | ||
2 | + | ||
3 | +use Illuminate\Database\Migrations\Migration; | ||
4 | +use Illuminate\Database\Schema\Blueprint; | ||
5 | +use Illuminate\Support\Facades\Schema; | ||
6 | + | ||
7 | +class AlterImmerse3 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('weather')->after('content')->default('')->comment('天气'); | ||
18 | + $table->string('huangli')->after('weather')->default('')->comment('黄历'); | ||
19 | + $table->string('longitude')->after('huangli')->default('')->comment('经度'); | ||
20 | + $table->string('latitude')->after('longitude')->default('')->comment('纬度'); | ||
21 | + $table->string('location')->after('latitude')->default('')->comment('所在地'); | ||
22 | + }); | ||
23 | + | ||
24 | + Schema::table('admin_make_video', function (Blueprint $table) { | ||
25 | + $table->string('longitude')->after('huangli')->default('')->comment('经度'); | ||
26 | + $table->string('latitude')->after('longitude')->default('')->comment('纬度'); | ||
27 | + $table->string('location')->after('latitude')->default('')->comment('所在地'); | ||
28 | + }); | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * Reverse the migrations. | ||
33 | + * | ||
34 | + * @return void | ||
35 | + */ | ||
36 | + public function down() | ||
37 | + { | ||
38 | + Schema::dropColumns('immerse', ['longitude', 'latitude', 'location']); | ||
39 | + Schema::dropColumns('admin_make_video', ['longitude', 'latitude', 'location']); | ||
40 | + } | ||
41 | +} |
-
Please register or login to post a comment