diff --git a/app/Exports/CommonExport.php b/app/Exports/CommonExport.php index 979c332..dfb7c41 100755 --- a/app/Exports/CommonExport.php +++ b/app/Exports/CommonExport.php @@ -56,9 +56,20 @@ class CommonExport implements FromCollection $temp = []; foreach ($fields as $field) { if (str_contains($field, 'idcard')) { + // 身份证 $temp[$field] = ' ' . $this->getDotValue($info, $field); } elseif (str_contains($field, 'all_course')) { + // 所有课程 $temp[$field] = $this->allCourse($info); + } elseif (str_contains($field, 'partners')) { + // 股东信息 + $temp[$field] = $this->partners($info); + } elseif (str_contains($field, 'partners')) { + // 项目经理 + $temp[$field] = $this->projectManager($info); + } elseif (str_contains($field, 'users')) { + // 学员信息 + $temp[$field] = $this->getUsers($info); } else { $temp[$field] = $this->getDotValue($info, $field); } @@ -124,4 +135,43 @@ class CommonExport implements FromCollection return implode("、\r\n", $list); } + /** + * 获取所有股东信息 + * @param $data + */ + function partners($data) + { + $list = []; + foreach ($data['partners'] as $item) { + $list[] = $item['stockName'] . '-' . $item['stockPercent'] ?? ''; + } + return implode("、\r\n", $list); + } + + /** + * 获取所有项目经理 + * @param $data + */ + function projectManager($data) + { + $list = []; + foreach ($data['project_users'] as $item) { + $list[] = $item['groupName'] . '-' . $item['userName'] ?? ''; + } + return implode("、\r\n", $list); + } + + /** + * 获取手机号 + * @param $data + */ + function getUsers($data) + { + $list = []; + foreach ($data['users'] as $item) { + $list[] = $item['username'] . '-' . $item['company_position'] . '-' . $item['mobile'] ?? ''; + } + return implode("、\r\n", $list); + } + }