search(['uid' => $uids])->where('type', $type)->where('relation_id', $relation_id)->with('label')->select()->toArray(); } /** * 根据标签查询标签用户数 * @param array $label_ids 标签ID数组 * @return array */ public function getLabelUserCount(array $label_ids) { $list = $this->search([])->whereIn('label_id', $label_ids)->group('label_id')->field('label_id,count(label_id) as count')->select()->toArray(); return array_column($list, 'count', 'label_id'); } }