Authored by Targaryen

data-handle

... ... @@ -20,8 +20,17 @@ const file = {
*/
page: async(ctx) => {
let result = await qn.listAsync('/yoho');
let resultArray = result.items;
_.forEach(resultArray, perFile => {
perFile.fsizekb = (perFile.fsize / 1024).toFixed(2) + 'kb';
let dateTime = _.parseInt(perFile.putTime.toString().substring(0, 13));
perFile.putTimeFormat = moment(dateTime).format('YYYY-MM-DD HH:mm');
});
await ctx.render('/action/file_page', {fileList: result});
await ctx.render('/action/file_page', {fileList: resultArray});
},
/**
... ... @@ -53,7 +62,7 @@ const file = {
});
// 解压
await decompress(fileSavePath, fileDistPath, {
await decompress(path.resolve(fileSavePath), fileDistPath, {
plugins: [
decompressUnzip()
]
... ... @@ -83,6 +92,11 @@ const file = {
state: `SUCCESS! ${fileList[i]} Uploaded to Qiniu!`
});
}
ctx.body = {
code: 200,
message: ''
};
}
}
... ...