From 9a44d705b1b6141d2aac89428702e55af46dfcc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Fri, 26 Aug 2022 09:56:39 +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=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/user/UserWechatUserDao.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crmeb/app/dao/user/UserWechatUserDao.php b/crmeb/app/dao/user/UserWechatUserDao.php index a45db6d60..5e6d98e23 100644 --- a/crmeb/app/dao/user/UserWechatUserDao.php +++ b/crmeb/app/dao/user/UserWechatUserDao.php @@ -171,10 +171,15 @@ class UserWechatUserDao extends BaseDao } //用户标签 if (isset($where['label_id']) && $where['label_id']) { - $model = $model->where(function ($query) use ($where, $userAlias) { - $labelIds = explode(',', $where['label_id']); - foreach ($labelIds as $item) { - $query->whereFindInSet($userAlias . 'label_ids', $item); + $model = $model->whereIn($userAlias . 'uid', function ($query) use ($where) { + if (is_array($where['label_id'])) { + $query->name('user_label_relation')->whereIn('label_id', $where['label_id'])->field('uid')->select(); + } else { + if (strpos($where['label_id'], ',') !== false) { + $query->name('user_label_relation')->whereIn('label_id', explode(',', $where['label_id']))->field('uid')->select(); + } else { + $query->name('user_label_relation')->where('label_id', $where['label_id'])->field('uid')->select(); + } } }); }