Browse Source

Merge pull request 'export_wait_deliver_goods_tids xlsx' (#3) from 20220708_export_xlsx into master

Reviewed-on: #3
pull/5/head
liuyu 3 years ago
parent
commit
ca06ef2382
  1. 40
      control/index.php

40
control/index.php

@ -84,24 +84,50 @@ class index extends publicBase {
chown($filedir, 'nobody'); chown($filedir, 'nobody');
chgrp($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"); ob_get_clean();
fwrite($file, "order_sn\t\n"); ob_start();
echo "订单号\t\n";
echo "order_sn\t\n";
for ($page=1;;$page++) { for ($page=1;;$page++) {
$list = $obj->getOrderList($uid, $shop_id, ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES, $page, 1000); $list = $obj->getOrderList($uid, $shop_id, ORDER_STATUS_WAIT_DELIVER_GOODS, REFUND_STATUS_NO_AFTER_SALES, $page, 1000);
if (empty($list)) break; if (empty($list)) break;
foreach ($list as $info) { 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(); 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