Commit 831b2afe authored by root's avatar root

file

parent 329dc106
......@@ -22,7 +22,7 @@ async function getAgentDb() {
}
async function getNewDb() {
const conn = await MongoClient.connect('mongodb://wjh:c9yJ2gBFkp7U6@10.11.3.136:1304,10.11.3.137:1304,10.11.3.134:1304/remarketingv3?replicaSet=bjwjh-v4');
const conn = await MongoClient.connect('mongodb://wjh:c9yJ2gBFkp7U6@10.11.3.136:1304/remarketingv3');
newDb = conn.db("remarketingv3");
return newDb;
}
......
const db = require('../db');
const xlsx = require('node-xlsx').default;
const fs = require('fs');
const _ = require('lodash');
const moment = require('moment');
var readline = require('linebyline'),
rl = readline('../latest.log');
async function task(argument) {
const calltasks = await db.getNewCollection('calltasks');
let count = 0;
let binds = [];
rl.on('line', async function(line, lineCount, byteCount) {
//console.dir(line)
if(line.indexOf('2018122715284246afbc72e628') >= 0){
console.dir(line)
}
if(line.indexOf('2018/12/27') >= 0 && line.indexOf('result') >= 0) {
console.log("||||||||||||||" + count ++ );
let json = JSON.parse(line.substr(20,line.length).trim());
console.dir({
bindID: json.bindID,
caller: json.caller,
duration: Number(json.duration || 0),
url:json.record,
result: json.record,
minutes: Math.ceil(Number(json.duration || 0) / 60),
cron: false
});
/* await calltasks.update({
bindID: json.bindID
}, {
$set: {
caller: json.caller,
duration: Number(json.duration || 0),
url:json.record,
result: json.record,
minutes: Math.ceil(Number(json.duration || 0) / 60),
cron: false
}
})*/
}
})
.on('error', function(e) {
// something went wrong
});
}
function ISODateRange(date) {
const startAt = moment(date).format(`YYYY-MM-DD 00:00:00`)
, endAt = moment(date).add(1, 'd').format(`YYYY-MM-DD 00:00:00`)
return [new Date(startAt), new Date(endAt)];
}
task();
\ No newline at end of file
This diff is collapsed.
......@@ -14,6 +14,7 @@
"license": "ISC",
"dependencies": {
"cron": "^1.3.0",
"linebyline": "^1.3.0",
"lodash": "^4.17.5",
"moment": "^2.22.1",
"mongodb": "^3.0.6",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment