if (!defined('BASEPATH')) exit('No direct script access allowed');
class Diy extends M_Controller {
public function remove(){
$time = time();
//查询出超时的数据 然后更改
$this->db->where('inputtime update('imt_1_mall', array('status' => 9));
}
public function export_excel() {
$filed = [
'注册时间',
'会员',
'订单号',
'商品名称',
'价格',
'支付类型',
'支付状态'
];
$ids = $this->input->get('ids');
$sql="select imt_1_mall.*,imt_member_paylog.* from imt_1_mall,imt_member_paylog where imt_member_paylog.id in ($ids) and imt_1_mall.id = imt_member_paylog.order_id";
$data= $this->db->query($sql);
$temppath = 'cache/export/' . date('Y-m-d H:i:s', time()). rand(0, 9999) . '.csv';
$f = fopen(WEBPATH . $temppath, 'w');
fputcsv($f, $filed);
while ($row = $data->unbuffered_row()) {
$row = (array)$row;
fputcsv($f,[
$row['inputtime'],$row['uid'],$row['order_number'],$row['title'],$row['value'],$row['type'],$row['status'],
]);
}
fclose($f);
header("Content-Type: text/csv");
header("Location: /$temppath");
}
}