From cc5b0daee92901a646cdc5c4899708f2cb79cd31 Mon Sep 17 00:00:00 2001 From: Dung Nguyen <> Date: Tue, 8 Mar 2022 22:27:44 +0700 Subject: [PATCH] Fix --- analytics.js | 32 ++++++++++++++++++++++++++++++++ index.js | 10 ++++------ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 analytics.js diff --git a/analytics.js b/analytics.js new file mode 100644 index 0000000..c3145a6 --- /dev/null +++ b/analytics.js @@ -0,0 +1,32 @@ +const db = require("./database"); + +db.query( + `select * from analytics WHERE count >= 3`, + [], + (error, results) => { + if (error) { + console.log(error); + } else { + const obj = {}; + + results.forEach((e, i) => { + if (typeof obj[e.count] === 'undefined') { + obj[e.count] = { + prev: {}, + next: {}, + } + } + + if (results[i - 1]) { + obj[e.count].prev[results[i - 1].count] = (obj[e.count].prev[results[i - 1].count] || 0) + 1; + } + + if (results[i + 1]) { + obj[e.count].next[results[i + 1].count] = (obj[e.count].next[results[i + 1].count] || 0) + 1; + } + }); + + console.log(obj); + } + } +); \ No newline at end of file diff --git a/index.js b/index.js index 2443074..c6fe5c7 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,7 @@ let isShowWarningInterrupted = false; const CONFIG = { autoTrade: true, countTradeContinue: 3, // 7 lệnh thông thì đánh ngược lại - moneyEnterOrder: [5, 5, 10, 20, 30], // Nếu gặp 7 lệnh thông sẽ đánh ngược lại với từng mệnh giá này + moneyEnterOrder: [5, 10, 20, 35, 70, 125, 0, 0, 0, 0, 0, 0, 0, 0], // Nếu gặp 7 lệnh thông sẽ đánh ngược lại với từng mệnh giá này maxHistory: 40, // Lưu lại lịch sử 40 phiên historys: [], // Lịch sử lệnh enterOrderList: [], // Lệnh đang vào @@ -74,7 +74,7 @@ puppeteer await Promise.all([page.waitForNavigation()]); const job = new cron.CronJob({ - cronTime: "45 0/1 * * * *", + cronTime: "50 0/1 * * * *", onTick: async function () { await page.reload({ waitUntil: ["networkidle0"] }); }, @@ -84,8 +84,8 @@ puppeteer await cdp.send("Network.enable"); await cdp.send("Page.enable"); let id = 1; + let count = 0; let countStaticData = 0; - let count; const printResponse = async function (cdp, response) { if (!response.response || !page || !page.evaluate) { @@ -147,9 +147,8 @@ puppeteer } else if (finalSide === "NORMAL") { lastResult = 2; } - + // Không tính nến chờ if (currentSessionID !== -1) { - // Không tính nến chờ roleEnterOrder(dataParse.session, lastResult); // TeleGlobal.sendMessage( // TELEGRAM_CHANNEL, @@ -578,7 +577,6 @@ function roleEnterOrder(sessionID, lastResult) { CONFIG.moneyEnterOrder[currentEnterOrder.ind] * 0.95 })` ); - deleteCurrentEnterOrder(); } else { // Nếu vẫn còn vốn xoay vòng thì đánh tiếp