From 59b8281011543a538e79f6e00b1d1bf6723b856c Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 6 Nov 2023 10:50:53 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=A8=8B=E5=BA=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E3=80=91=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/adminapi/controller/v1/user/User.php | 1 + crmeb/app/common.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/crmeb/app/adminapi/controller/v1/user/User.php b/crmeb/app/adminapi/controller/v1/user/User.php index ef60567ac..c3cc35d7c 100644 --- a/crmeb/app/adminapi/controller/v1/user/User.php +++ b/crmeb/app/adminapi/controller/v1/user/User.php @@ -57,6 +57,7 @@ class User extends AuthController ['field_key', ''], ['isMember', ''] ]); + $where['label_id'] = stringToIntArray($where['label_id']); return app('json')->success($this->services->index($where)); } diff --git a/crmeb/app/common.php b/crmeb/app/common.php index e367e72fe..583048650 100644 --- a/crmeb/app/common.php +++ b/crmeb/app/common.php @@ -1110,3 +1110,17 @@ if (!function_exists('dump_sql')) { }); } } + +if (!function_exists('stringToIntArray')) { + + /** + * 处理ids等并过滤参数 + * @param string $string + * @param string $separator + * @return array + */ + function stringToIntArray(string $string, string $separator = ',') + { + return !empty($string) ? array_unique(array_diff(array_map('intval', explode($separator, $string)), [0])) : []; + } +}