From 92689aedcab9d50ab7200eea387f1b5c6c027e66 Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Mon, 14 Jan 2019 01:08:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E8=A7=84?= =?UTF-8?q?=E6=A0=BC=E5=88=97=E4=B9=8B=E9=97=B4=E9=87=8D=E5=A4=8D=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=95=B0=E6=8D=AE=E6=B7=B7=E4=B9=B1=EF=BC=8CPC?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E6=95=B4=E6=95=B0=E7=B1=BB=E5=9E=8Bbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/GoodsService.php | 13 +++++++++++-- public/static/index/default/js/goods.js | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index e98b845f6..f1d6f0e75 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -1141,11 +1141,12 @@ class GoodsService } if(!empty($temp_column)) { - return DataReturn('规格值列直接不能重复['.implode(',', array_unique($temp_column)).']', -1); + return DataReturn('规格值列之间不能重复['.implode(',', array_unique($temp_column)).']', -1); } } // 规格名称 + $names_value = []; $names = array_slice($data[0], 0, $count); foreach($names as $v) { @@ -1162,12 +1163,20 @@ class GoodsService 'name' => $params['specifications_name_'.$key], 'value' => array_unique($vs), ]; + $names_value[] = $params['specifications_name_'.$key]; } } } - } } + + // 规格名称列直接是否存在重复 + $unique_all = array_unique($names_value); + $repeat_names_all = array_diff_assoc($names_value, $unique_all); + if(!empty($repeat_names_all)) + { + return DataReturn('规格名称列之间不能重复['.implode(',', $repeat_names_all).']', -1); + } } else { if(empty($data[0][0]) || $data[0][0] <= 0) { diff --git a/public/static/index/default/js/goods.js b/public/static/index/default/js/goods.js index 3dfe97960..4a430ca59 100755 --- a/public/static/index/default/js/goods.js +++ b/public/static/index/default/js/goods.js @@ -241,7 +241,7 @@ function GoodsSpecType() $('.theme-signin-left .sku-items').eq(index).find('li').each(function(k, v) { $(this).removeClass('sku-dont-choose'); - var value = $(this).data('value'); + var value = $(this).data('value').toString(); if(result.data.indexOf(value) == -1) { $(this).addClass('sku-items-disabled'); -- GitLab