소스 검색

视频预览

moshaorui 2 주 전
부모
커밋
18f2f6f6a0
3개의 변경된 파일22개의 추가작업 그리고 5개의 파일을 삭제
  1. 8 2
      app/Admin/Controllers/SiteAlbumController.php
  2. 3 2
      app/Admin/Repositories/SitePreviewVideo.php
  3. 11 1
      app/Models/SitePreviewVideo.php

+ 8 - 2
app/Admin/Controllers/SiteAlbumController.php

@@ -260,8 +260,14 @@ JS
                     SiteAlbumLog::log($action, $id,$form->input('model'),$oldData);
                 }
                 //更新site_preview_video表
-                $video = json_decode($form->model()->video,true);
-                SitePreviewVideo::updatePreviewVideo($id,$video);
+                $video = $form->input('video');
+                $data = [];
+                foreach ($video as $value) {
+                    if ($value['_remove_'] != 1){
+                        $data[] = ['cover'=>$value['cover'],'video_title'=>$value['video_title'],'video_en_title' => $value['video_en_title'],'video_src'=>$value['video_src']];
+                    }
+                }
+                SitePreviewVideo::updatePreviewVideo($id,$data);
             });
 
             $form->tab(admin_trans_label('basic_info'), function (Form $form) {

+ 3 - 2
app/Admin/Repositories/SitePreviewVideo.php

@@ -4,6 +4,7 @@ namespace App\Admin\Repositories;
 
 use App\Models\SitePreviewVideo as Model;
 use Dcat\Admin\Repositories\EloquentRepository;
+use Illuminate\Support\Carbon;
 use Illuminate\Support\Facades\DB;
 
 class SitePreviewVideo extends EloquentRepository
@@ -40,8 +41,8 @@ class SitePreviewVideo extends EloquentRepository
                     'video_url' => $videoSrc,
                     'preview_url' => '',
                     'status' => 0, // Assuming status 1 means active or available
-                    'created_at' => Corder::now(),
-                    'updated_at' => Corder::now(),
+                    'created_at' => Carbon::now(),
+                    'updated_at' => Carbon::now(),
                     'album_id' => $album_id,
                     'remark' => '', // Optional remark, you can customize this
                 ]);

+ 11 - 1
app/Models/SitePreviewVideo.php

@@ -10,5 +10,15 @@ class SitePreviewVideo extends Model
 {
 	use HasDateTimeFormatter;
     protected $table = 'site_preview_video';
-    
+
+    protected $fillable = [
+        // ... other fillable attributes
+        'video_url', // Add this line
+        'preview_url',
+        'status',
+        'album_id',
+        'remark',
+        // Include other attributes if needed
+    ];
+
 }