1
This commit is contained in:
parent
726d2e5ec5
commit
120fea95b6
@ -5,6 +5,27 @@ const event = require('j7/event');
|
|||||||
const config = require('j7/config');
|
const config = require('j7/config');
|
||||||
const bchelper = require('common/bchelper');
|
const bchelper = require('common/bchelper');
|
||||||
|
|
||||||
|
function jsonToCsv(fileName, data, fields) {
|
||||||
|
let out = '';
|
||||||
|
fields.forEach(
|
||||||
|
(field) => {
|
||||||
|
out += field + ',';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
out += '\n';
|
||||||
|
data.forEach(
|
||||||
|
(row) => {
|
||||||
|
fields.forEach(
|
||||||
|
(field) => {
|
||||||
|
out += row[field] + ',';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
out += '\n';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
fs.writeFileSync(fileName, out);
|
||||||
|
}
|
||||||
|
|
||||||
const airDropDate = utils.getArgv('f');
|
const airDropDate = utils.getArgv('f');
|
||||||
const json = utils.readJsonFromFile
|
const json = utils.readJsonFromFile
|
||||||
(`../bin_dev/web3dbspider/config/airdrops/${airDropDate}.airdop.json`);
|
(`../bin_dev/web3dbspider/config/airdrops/${airDropDate}.airdop.json`);
|
||||||
@ -16,4 +37,15 @@ json.forEach(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
fs.writeFileSync('1.json', utils.prettyJsonEncode(json));
|
fs.writeFileSync('1.json', utils.prettyJsonEncode(json));
|
||||||
|
jsonToCsv(
|
||||||
|
airDropDate + '.dirdop.csv',
|
||||||
|
json,
|
||||||
|
[
|
||||||
|
'address',
|
||||||
|
'type',
|
||||||
|
'item_id',
|
||||||
|
'level',
|
||||||
|
'quality',
|
||||||
|
'token_id'
|
||||||
|
]);
|
||||||
console.log(utils.prettyJsonEncode(json));
|
console.log(utils.prettyJsonEncode(json));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user