Browse Source

export_wait_deliver_goods_tids xlsx

pull/3/head
liuyu 3 years ago
parent
commit
4c2fa71f0e
  1. 40
      control/index.php

40
control/index.php

@ -84,24 +84,50 @@ class index extends publicBase {
chown($filedir, 'nobody');
chgrp($filedir, 'nobody');
}
$filepath = $filedir."{$uid}_{$shop_id}_".date("YmdHis").".csv";
$filepath = $filedir."{$uid}_{$shop_id}_".date("YmdHis").".xlsx";
$file = fopen($filepath, 'w');
fwrite($file, "订单号\t\n");
fwrite($file, "order_sn\t\n");
ob_get_clean();
ob_start();
echo "订单号\t\n";
echo "order_sn\t\n";
for ($page=1;;$page++) {
$list = $obj->getOrderList($uid, $shop_id, ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES, $page, 1000);
if (empty($list)) break;
foreach ($list as $info) {
fwrite($file, $info['order_sn']."\t\n");
echo $info['order_sn']."\t\n";
}
}
fclose($file);
header('Content-Disposition: attachment; filename='.$shopinfo['name'].'_待发货订单.xlsx');
header('Accept-Ranges:bytes');
header('Content-Length:' . ob_get_length());
header('Content-Type:application/vnd.ms-excel');
ob_end_flush();
$obj->downFileChunk($filepath, $shopinfo['name'].'_待发货订单.csv');
exit();
// $filepath = $filedir."{$uid}_{$shop_id}_".date("YmdHis").".csv";
// $file = fopen($filepath, 'w');
// fwrite($file, "订单号\t\n");
// fwrite($file, "order_sn\t\n");
// for ($page=1;;$page++) {
// $list = $obj->getOrderList($uid, $shop_id, ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES, $page, 1000);
// if (empty($list)) break;
// foreach ($list as $info) {
// fwrite($file, $info['order_sn']."\t\n");
// }
// }
// fclose($file);
// $obj->downFileChunk($filepath, $shopinfo['name'].'_待发货订单.csv');
// exit();
}
}

Loading…
Cancel
Save