[user_id1, user_id2, ...]] */ public function getValidUsersGroupByGroup(): array { try { $rows = $this->getModel()::where('status', 1) ->field('group_id, user_id') ->select() ->toArray(); $grouped = []; foreach ($rows as $row) { $grouped[$row['group_id']][] = $row['user_id']; } return $grouped; } catch (\Exception $e) { return []; } } /** * @param $groupId * @return array * @author 史晨 * @date 2026/2/27 11:31 * 获取团队用户(分页) */ public function getUserByLevel($groupId) { try { return $this->getModel()::where('status', 1) ->where(['group_id' => $groupId]) ->paginate(20) ->toArray(); } catch (DbException $e) { return []; } } /** * @param array $idList * @return SharedProsperityGroupUserEntity[] */ public function getSharedProsperityGroupUserEntityListByIdList(array $idList): array { $entityList = []; try { /** @var SharedProsperityGroupUser $model */ $model = $this->getModel(); $dataRes = $model::getDB() ->whereIn('id', $idList) ->select() ->toArray(); if (!empty($dataRes)) { $entityList = array_map(function ($data) { return SharedProsperityGroupUserEntity::newInstance($data); }, $dataRes); } } catch (\Exception $e) { } return $entityList; } /** * @param array $userIdList * @return SharedProsperityGroupUserEntity[] */ public function getSharedProsperityGroupUserEntityListByUserIdList(array $userIdList): array { $entityList = []; try { /** @var SharedProsperityGroupUser $model */ $model = $this->getModel(); $dataRes = $model::getDB() ->whereIn('user_id', $userIdList) ->select() ->toArray(); if (!empty($dataRes)) { $entityList = array_map(function ($data) { return SharedProsperityGroupUserEntity::newInstance($data); }, $dataRes); } } catch (\Exception $e) { } return $entityList; } }