Browse Source

商城,视频截贞,配置工作流

lizhen_gitee 10 months ago
parent
commit
398fa96e81
2 changed files with 14 additions and 1 deletions
  1. 1 1
      addons/unishop/controller/Product.php
  2. 13 0
      addons/unishop/model/Product.php

+ 1 - 1
addons/unishop/controller/Product.php

@@ -107,7 +107,7 @@ class Product extends Base
             if ($evaluate) {
             if ($evaluate) {
                 $data->evaluate_list = collection($evaluate)->append(['createtime_text'])->toArray();
                 $data->evaluate_list = collection($evaluate)->append(['createtime_text'])->toArray();
             }
             }
-            $data = $data->append(['images_text', 'spec_list', 'spec_table_list'])->toArray();
+            $data = $data->append(['images_text','videothumb', 'spec_list', 'spec_table_list'])->toArray();
         } catch (Exception $e) {
         } catch (Exception $e) {
             $this->error($e->getMessage());
             $this->error($e->getMessage());
         }
         }

+ 13 - 0
addons/unishop/model/Product.php

@@ -57,6 +57,7 @@ class Product extends Model
         'real_look',
         'real_look',
         'real_sales',
         'real_sales',
         'images',
         'images',
+        'videothumb',
         'specList',
         'specList',
         'specTableList',
         'specTableList',
     ];
     ];
@@ -69,6 +70,18 @@ class Product extends Model
     public function getImageAttr($value) {
     public function getImageAttr($value) {
         return Config::getImagesFullUrl($value);
         return Config::getImagesFullUrl($value);
     }
     }
+    public function getVideoFileAttr($value) {
+        return Config::getImagesFullUrl($value);
+    }
+    public function getVideothumbAttr($value, $data) {
+        $rs = '';
+        if($data['video_file']){
+            $images_url = explode('.', $data['video_file']);
+            unset($images_url[count($images_url) - 1]);
+            $rs = join('.', $images_url) . '_0.jpg';
+        }
+        return Config::getImagesFullUrl($rs);
+    }
 
 
     /**
     /**
      * 加密商品id
      * 加密商品id