|
|
|
@ -1713,29 +1713,6 @@ function getOffspringByPromoteId($promote_id) {
|
|
|
|
|
->find();
|
|
|
|
|
return $promote_ids['promote_ids'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//导出csv 2019/12/20
|
|
|
|
|
function db2csv(&$data,$title,$header=false){
|
|
|
|
|
set_time_limit(0);
|
|
|
|
|
$filename = $title .'.csv';
|
|
|
|
|
$fp = fopen($filename, 'w'); //生成临时文件
|
|
|
|
|
fwrite($fp, chr(0xEF).chr(0xBB).chr(0xBF));//转码,防止乱码
|
|
|
|
|
if($header) fputcsv($fp, $header);
|
|
|
|
|
|
|
|
|
|
foreach ($data as $a) {
|
|
|
|
|
fputcsv($fp, $a);
|
|
|
|
|
}
|
|
|
|
|
fclose($fp); //每生成一个文件关闭
|
|
|
|
|
//下载
|
|
|
|
|
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
|
|
|
|
|
header('Content-Disposition: attachment;filename="' . $title . '.csv"');
|
|
|
|
|
header('Cache-Control: max-age=0');
|
|
|
|
|
header('Content-Length: ' . filesize($filename));
|
|
|
|
|
readfile($filename);
|
|
|
|
|
unlink($filename);
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
//导出csv 新增字段排序功能
|
|
|
|
|
function data2csv(&$data,$title,$fields){
|
|
|
|
|
set_time_limit(0);
|
|
|
|
|