diff --git a/models/common/CommonGoodsEditForm.php b/models/common/CommonGoodsEditForm.php index f55cab0..834e5cf 100644 --- a/models/common/CommonGoodsEditForm.php +++ b/models/common/CommonGoodsEditForm.php @@ -67,12 +67,15 @@ class CommonGoodsEditForm extends Model public $date; public $signing_foot_img; public $signing_head_img; + public $video_url_data_title; + public $video_url_data_url; + public $video_url_data_img; public function rules() { return [ [['name', 'subtitle', 'detail', 'cover_pic', 'video_url', 'unit', 'plugin_sign', 'goods_no',], 'trim'], - [['name', 'subtitle', 'detail', 'price', 'cover_pic', 'video_url', 'video_banner_urls', 'banner_urls', 'unit', 'plugin_sign', 'goods_no', 'date', 'signing_head_img', 'signing_foot_img'], 'string'], + [['name', 'subtitle','video_url_data_url','video_url_data_title','video_url_data_img', 'detail', 'price', 'cover_pic', 'video_url', 'video_banner_urls', 'banner_urls', 'unit', 'plugin_sign', 'goods_no', 'date', 'signing_head_img', 'signing_foot_img'], 'string'], [['original_price', 'cost_price', 'goods_weight'], 'number'], [['type', 'use_attr', 'goods_stock', 'virtual_sales', 'confine_count', 'freight_id', 'sort', 'cx_mch_id'], 'integer'], @@ -185,6 +188,18 @@ class CommonGoodsEditForm extends Model $goods_hub = new GoodsHub(); $goods_hub->cx_mch_id = $this->cx_mch_id; } + $video_url_data_arr = []; + if(!empty($this->video_url_data_url)){ + $video_url_data_arr[0]['url'] = $this->video_url_data_url; + } + if(!empty($this->video_url_data_title)){ + $video_url_data_arr[0]['title'] = $this->video_url_data_title; + } + if(!empty($this->video_url_data_img)){ + $video_url_data_arr[0]['img'] = $this->video_url_data_img; + } + + $goods_hub->video_url_data = json_encode($video_url_data_arr,JSON_UNESCAPED_UNICODE); $goods_hub->name = $this->name; $goods_hub->subtitle = $this->subtitle; // $goods_hub->original_price = $this->original_price ? $this->original_price : $this->price; @@ -333,6 +348,9 @@ class CommonGoodsEditForm extends Model private function addAttrGroupsId($list, &$id = 1) { + if(!is_array($list)){ + return []; + } $newId = 1; foreach ($list as $key => $item) { if (isset($item['attr_list'])) { @@ -401,7 +419,7 @@ class CommonGoodsEditForm extends Model ]; // 未使用规格情况下,要把上一次的规格ID 存回去,不然规格记录会重复添加 - if (count($this->attr) === 1 && isset($this->attr[0]['id'])) { + if (!empty($this->attr) && count($this->attr) === 1 && isset($this->attr[0]['id'])) { $newAttrs[0]['id'] = $this->attr[0]['id']; } diff --git a/modules/admin/controllers/mall/GoodsController.php b/modules/admin/controllers/mall/GoodsController.php index 85b05a8..7d21a92 100644 --- a/modules/admin/controllers/mall/GoodsController.php +++ b/modules/admin/controllers/mall/GoodsController.php @@ -219,8 +219,16 @@ class GoodsController extends Controller $attr[$index] = $item; } } + $video_url_data_url = ""; + $video_url_data_title = ""; + $video_url_data_img = ""; + if(!empty($model->goodsHub->video_url_data)){ + $json_decode = json_decode($model->goodsHub->video_url_data,true); + $video_url_data_url = $json_decode[0]['url']; + $video_url_data_title = $json_decode[0]['title']; + $video_url_data_img = $json_decode[0]['img']; - + } return $this->render('edit', [ 'cat_list' => $cat_list, @@ -232,6 +240,9 @@ class GoodsController extends Controller 'attr_groups' => $attr_groups, 'model' => $model, 'return_url' => $return_url, + 'video_url_data_url' => $video_url_data_url, + 'video_url_data_title' => $video_url_data_title, + 'video_url_data_img' => $video_url_data_img, ]); } diff --git a/modules/admin/views/mall/goods/edit.php b/modules/admin/views/mall/goods/edit.php index 0adcb84..8f12662 100644 --- a/modules/admin/views/mall/goods/edit.php +++ b/modules/admin/views/mall/goods/edit.php @@ -198,7 +198,7 @@ $this->params['breadcrumbs'][] = $this->title; foreach ($json_de as $key => $val) { $explode = explode('/', $val); $end = end($explode); - // + //12G $temp_arr[] = [ 'name' => $end, 'url' => $val, @@ -208,13 +208,44 @@ $this->params['breadcrumbs'][] = $this->title; } ?> + 'video', + 'multiple' => false, + 'id' => 'video_url_data_url', + 'name' => 'video_url_data_url', + 'label' => '冠军视频', + 'value' => $video_url_data_url ? $video_url_data_url : '', + 'tip' => '视频最大50M', + 'required' => false + ]) ?> +
+ +
+ +
+
+
+ + 'images', + 'id' => 'video_url_data_img', + 'name' => 'video_url_data_img', + 'label' => '冠军视频图片', + 'value' => $video_url_data_img, +// 'tip' => '图片大小750×750', + + 'imageCompressEnable' => 1, + 'imageCompressBorder' => 750, + ]) ?> 'file', 'multiple' => true, 'id' => 'video_url', 'name' => 'video_url', - 'label' => '冠军视频', + 'label' => '冠军视频列表', 'value' => $model->goodsHub ? $model->goodsHub->video_url : '', 'tip' => '视频最大50M', 'required' => false diff --git a/modules/api/controllers/mall/integral/GoodsController.php b/modules/api/controllers/mall/integral/GoodsController.php index ed1b096..b392b59 100644 --- a/modules/api/controllers/mall/integral/GoodsController.php +++ b/modules/api/controllers/mall/integral/GoodsController.php @@ -144,7 +144,7 @@ class GoodsController extends Controller $form->cx_mch_id = $this->cx_mch_id; $form->status = Goods::STATUS_ONLINE; $form->plugin_sign = SysConst::$cxPluginSceneIntegralMall; - $form->setFields('g.id,g.price,g.date,g.sort,gh.subtitle,gh.banner_urls,g.created_at,gh.name,gh.cover_pic,gh.video_url,gh.pic_urls,gh.video_banner_urls'); + $form->setFields('g.id,g.price,g.date,g.sort,gh.subtitle,gh.banner_urls,g.created_at,gh.name,gh.cover_pic,gh.video_url,gh.pic_urls,gh.video_banner_urls,gh.video_url_data'); $data = $form->search(); foreach ($data['data'] as $key => $value) { @@ -160,15 +160,25 @@ class GoodsController extends Controller $data['data'][$key]['pic_arr'] = $pic_arr; } } + $video = []; + $i = 0; + $video[$i] = []; + if(!empty($value['video_url_data'])){ + $json_de = json_decode($value['video_url_data'],true); + if(!empty($json_de[0]['url'])){ + $video[$i]['img'] = $json_de[0]['img']??''; + $video[$i]['video_url'] = $json_de[0]['url']??''; + $video[$i]['title'] = $json_de[0]['title']??''; + } + } $data['data'][$key]['video_arr'] = []; if ($value['video_url'] != null) { $video_arr = json_decode($value['video_url'], true); $video_banner_urls = json_decode($value['video_banner_urls'], true); - - $video = []; foreach ($video_arr as $key1 => $value1) { - $video[$key1]['img'] = $video_banner_urls[$key1] ?? ''; - $video[$key1]['video_url'] = $value1 ?? ''; + $i++; + $video[$i]['img'] = $video_banner_urls[$key1] ?? ''; + $video[$i]['video_url'] = $value1 ?? ''; } $data['data'][$key]['video_arr'] = $video; } diff --git a/web/uploads/file/588e8d87b845713e8ac5df30269a908bmp4 b/web/uploads/file/588e8d87b845713e8ac5df30269a908bmp4 deleted file mode 100644 index 5b0332b..0000000 Binary files a/web/uploads/file/588e8d87b845713e8ac5df30269a908bmp4 and /dev/null differ diff --git a/widgets/views/goods-sku.php b/widgets/views/goods-sku.php index d92bcc2..6eed6a1 100644 --- a/widgets/views/goods-sku.php +++ b/widgets/views/goods-sku.php @@ -5,12 +5,12 @@ * @description KISS * @date 2021年10月7日 * @version 1.0.0 - * + * * _____LOG_____ - * + * */ ?> -
- +
- +
- +
添加
@@ -55,65 +55,120 @@
-
+
- +
添加
-
+
- +
+ + + - + + + + - - - - - + + + + + + + + + + +
{{attr_group['attr_group_name']}} +
价格
+
+ +
+
+ +
+
+
库存
+
+ +
+
+ +
+
-
价格
+
积分
- +
- -
+ +
+
货号
+
+
重量
+
+
图片
+
{{attr_val.attr_name}}
{{attr_val.attr_name}} +
+ +
+
+ +
+
+ +
+
-
+
- + registerJs($this->blocks['js_script_wrap'], \yii\web\View::POS_END); ?>