From 0ce7aa8f0ff223a9d0010a5f6e150448838d1d29 Mon Sep 17 00:00:00 2001 From: qianhy Date: Sun, 12 Mar 2023 10:40:14 +0800 Subject: [PATCH] customer defeat only select one --- api/controllers/wxapp/licheb/Customers.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 46c2eb1e..ab6c18cf 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -403,18 +403,23 @@ class Customers extends Wxapp } $tag_str = ''; $tag_arr_all = array(); + $tag_checked = 0; # 20230312 只要有一个选中即可 foreach ($invalid_tag as $key => $val){ - $tag_name = $val['name']; $tag_arr = []; foreach ($val['list'] as $kt => $vt){ $vt['checked'] && $tag_arr[] = $vt['name']; + $vt['checked'] && $tag_checked = 1; } + /*# 20230101 提示没选中的标签 if (!$tag_arr){ - throw new Exception("请选择标签[{$tag_name}]!", ERR_PARAMS_ERROR); - } + throw new Exception("请选择标签[{$val['name']}]!", ERR_PARAMS_ERROR); + }*/ $tag_arr_all = array_merge($tag_arr_all, $tag_arr); $tag_str .= $val['name'].': '.implode(', ', $tag_arr).'; '; } + if (!$tag_checked){ + throw new Exception("请选择至少一个标签!", ERR_PARAMS_ERROR); + } $tag_str = implode(', ', $tag_arr_all); $jsondata = $row['jsondata'] ? json_decode($row['jsondata'], true) : array(); $jsondata['defeat']['time'] = date("Y-m-d H:i:s");