0806
This commit is contained in:
@@ -33,9 +33,9 @@ $whereSql = implode(' AND ', $where);
|
||||
$pdo = DB::getInstance()->getPdo();
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT p.id, p.union_id, p.full_name, p.gender, p.nationality, p.id_type, p.id_number,
|
||||
p.education, p.graduated_from, p.hometown, p.work_location, p.created_at,
|
||||
(SELECT sa.account_id FROM social_accounts sa WHERE sa.owner_type='person' AND sa.owner_id=p.id AND sa.platform='phone' AND sa.is_active=1 LIMIT 1) AS phone,
|
||||
(SELECT sa.account_id FROM social_accounts sa WHERE sa.owner_type='person' AND sa.owner_id=p.id AND sa.platform='email' AND sa.is_active=1 LIMIT 1) AS email
|
||||
p.education, p.graduated_from, p.hometown, p.work_location, p.source_channel, p.source_detail, p.created_at,
|
||||
(SELECT sa.account_id FROM social_accounts sa WHERE sa.owner_type='person' AND sa.owner_id=p.id AND sa.platform='phone' AND sa.is_active=1 ORDER BY sa.is_defult DESC, sa.is_primary DESC LIMIT 1) AS phone,
|
||||
(SELECT sa.account_id FROM social_accounts sa WHERE sa.owner_type='person' AND sa.owner_id=p.id AND sa.platform='email' AND sa.is_active=1 ORDER BY sa.is_defult DESC, sa.is_primary DESC LIMIT 1) AS email
|
||||
FROM persons p WHERE $whereSql ORDER BY p.id DESC"
|
||||
);
|
||||
$stmt->execute($params);
|
||||
@@ -47,12 +47,12 @@ header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="persons_' . date('Ymd_His') . '.csv"');
|
||||
echo "\xEF\xBB\xBF";
|
||||
$out = fopen('php://output', 'w');
|
||||
fputcsv($out, ['ID', 'union_id', '姓名', '性别', '国籍', '证件类型', '证件号', '学历', '毕业院校', '家乡', '工作所在地', '手机', '邮箱', '创建时间']);
|
||||
fputcsv($out, ['ID', 'union_id', '姓名', '性别', '国籍', '证件类型', '证件号', '学历', '毕业院校', '家乡', '工作所在地', '来源渠道', '来源详情', '手机', '邮箱', '创建时间']);
|
||||
foreach ($list as $r) {
|
||||
fputcsv($out, [
|
||||
$r['id'], $r['union_id'], $r['full_name'], $r['gender'], $r['nationality'],
|
||||
$r['id_type'], $r['id_number'], $r['education'], $r['graduated_from'],
|
||||
$r['hometown'], $r['work_location'], $r['phone'], $r['email'], $r['created_at'],
|
||||
$r['hometown'], $r['work_location'], $r['source_channel'], $r['source_detail'], $r['phone'], $r['email'], $r['created_at'],
|
||||
]);
|
||||
}
|
||||
fclose($out);
|
||||
|
||||
Reference in New Issue
Block a user