diff --git a/app/Controllers/Http/ErpsController.ts b/app/Controllers/Http/ErpsController.ts index d05f201..3b6c02e 100644 --- a/app/Controllers/Http/ErpsController.ts +++ b/app/Controllers/Http/ErpsController.ts @@ -18,10 +18,23 @@ export default class ErpsController { // console.log("check!") const listLog: string[] = []; const response = await axios.get("http://192.168.5.7:8080/"); - const data = response.data; - const arrayLine = data + const responseAUTO = await axios.get( + "http://192.168.5.7:8080/AUTOlog/" + ); + + let data1 = response.data .split("\n") .filter((i) => i.search(" i.search(" i.search(" { let temp = u .slice(u.search("")) @@ -32,7 +45,7 @@ export default class ErpsController { parseInt(temp?.split("-")[0]) <= to ) { listLog.push( - "http://192.168.5.7:8080/" + + (u.slice(u.search("")).split(">")[1].includes("AUTO")?"http://192.168.5.7:8080/AUTOlog/":"http://192.168.5.7:8080/") + u.slice(u.search("")).split(">")[1] + " " ); @@ -290,7 +303,7 @@ export default class ErpsController { fileName.search("AUTO") !== -1 ? "AUTOlog/" + fileName : fileName; const res = await axios.get("http://192.168.5.7:8080/" + fName); const arrayLine = res?.data?.split("\n"); - + if (range >= line) { response.status(200).json({ content: arrayLine?.slice(0, line + range)?.join("\n"), diff --git a/screenshot.js b/screenshot.js index 99c0cb1..37c1124 100644 --- a/screenshot.js +++ b/screenshot.js @@ -1,5 +1,7 @@ // const puppeteer = require("puppeteer"); +const axios = require("axios"); + // (async () => { // // Launch a headless browser // const browser = await puppeteer.launch({ @@ -176,22 +178,61 @@ // // Close the browser. // await browser2.close(); // })(); -const zulip = require("zulip-js"); +// const zulip = require("zulip-js"); -(async () => { - const config = { - username: "networktool-bot@zulip.ipsupply.com.au", - apiKey: "0jMAmOuhfLvBqKJikv5oAkyNM4RIEoAM", - realm: "https://zulip.ipsupply.com.au", - }; - const client = await zulip(config); - const user_id = 45; - let params = { - to: "joseph.le@apactech.io", - type: "private", - content: "With mirth and laughter let old wrinkles come.", - }; - console.log(await client.messages.send(params)) +// (async () => { +// const config = { +// username: "networktool-bot@zulip.ipsupply.com.au", +// apiKey: "0jMAmOuhfLvBqKJikv5oAkyNM4RIEoAM", +// realm: "https://zulip.ipsupply.com.au", +// }; +// const client = await zulip(config); +// const user_id = 45; +// let params = { +// to: "joseph.le@apactech.io", +// type: "private", +// content: "With mirth and laughter let old wrinkles come.", +// }; +// console.log(await client.messages.send(params)) +// })() + +(async()=>{ + let listLog = [] + let from = 20230926 + let to = 20230926 + const response = await axios.get("http://192.168.5.7:8080/"); + const responseAUTO = await axios.get( + "http://192.168.5.7:8080/AUTOlog/" + ); + + let data1 = response.data.split("\n") + .filter((i) => i.search(" i.search(" i.search(" { + let temp = u + .slice(u.search("")) + .split(">")[1]; + + if ( + parseInt(temp?.split("-")[0]) >= from && + parseInt(temp?.split("-")[0]) <= to + ) { + listLog.push( + (u.slice(u.search("")).split(">")[1].includes("AUTO")?"http://192.168.5.7:8080/AUTOlog/":"http://192.168.5.7:8080/") + + u.slice(u.search("")).split(">")[1] + + " " + ); + } +}); + console.log(listLog) })() \ No newline at end of file