make(StoreServiceRecordServices::class); if (!$kefuService->count(['to_uid' => $uid])) { throw new ValidateException('不存在此用户'); } $userInfo = $this->dao->get($uid, ['nickname', 'avatar', 'spread_uid', 'is_promoter', 'birthday', 'now_money', 'user_type', 'level', 'group_id', 'phone', 'is_money_level'], ['userGroup']); if (!$userInfo) { throw new ValidateException('用户不存在'); } /** @var BaseUserServices $userServices */ $userServices = app()->make(BaseUserServices::class); $userInfo['is_promoter'] = $userServices->checkUserPromoter($uid); /** @var UserLabelRelationServices $labalServices */ $labalServices = app()->make(UserLabelRelationServices::class); if ($store_id) { $where = ['uid' => $uid, 'type' => 1, 'relation_id' => $store_id]; } else { $where = ['uid' => $uid, 'type' => 0]; } $labalId = $labalServices->getColumn($where, 'label_id', 'label_id'); /** @var UserLabelServices $services */ $services = app()->make(UserLabelServices::class); $labelNames = $services->getColumn([['id', 'in', $labalId]], 'label_name'); $userInfo->labelNames = $labelNames; $userInfo->spread_name = $userInfo->level_name = ''; if ($userInfo->spread_uid) { $userInfo->spread_name = $this->dao->value(['uid' => $userInfo->spread_uid], 'nickname'); } if ($userInfo->level) { /** @var SystemUserLevelServices $levelService */ $levelService = app()->make(SystemUserLevelServices::class); $userInfo->level_name = $levelService->value(['id' => $userInfo->level], 'name'); } if ($userInfo->userGroup) { $userInfo->group_name = $userInfo->userGroup->group_name; unset($userInfo->userGroup); } return $userInfo->toArray(); } }