'use strict'; const { simpleExcelDown } = require('../../../../utils/xlsxDownload'); async function dataExport (ctx) { try { // const models = ctx.fs.dc.models; // const { userId } = ctx.fs.api // const { ids } = ctx.query; // const exportData = await models.BusCar.destroy({ // where: { // id: { $in: ids.split(',') } // } // }) // const fileName = `摄像头信息列表_${userId}_${moment().format('YYYYMMDDHHmmss')}` + '.csv' // const filePath = await simpleExcelDown({ data: exportData, header, fileName: fileName }) // const fileData = fs.readFileSync(filePath); // ctx.status = 200; // ctx.set('Content-Type', 'application/x-xls'); // ctx.set('Content-disposition', 'attachment; filename=' + encodeURI(fileName)); // ctx.body = fileData; } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : undefined } } } module.exports = { dataExport };