Compare commits
No commits in common. "0866cbce79121f82351a8251d8b4c01643f4047f" and "f06539ae6f97824369e21f34209c1c0de0a65c5c" have entirely different histories.
0866cbce79
...
f06539ae6f
|
@ -1,44 +0,0 @@
|
||||||
NODE_ENV=
|
|
||||||
BACKEND_URL=http://localhost
|
|
||||||
FRONTEND_URL=http://localhost:3000
|
|
||||||
PROXY_PORT=8080
|
|
||||||
PORT=8080
|
|
||||||
|
|
||||||
DB_DIALECT=mysql
|
|
||||||
DB_HOST=localhost
|
|
||||||
DB_USER=whaticket
|
|
||||||
DB_PASS=strongpassword
|
|
||||||
DB_NAME=whaticket
|
|
||||||
|
|
||||||
# WHATSAPP OFFICIAL
|
|
||||||
VERIFY_TOKEN=HAPPY
|
|
||||||
TOKEN=EAAEPZBB2YqgwBOZBEAvPxYaO2nbPvuzU3ZBaZA6YF6tyWtjKom2yLxPxOm421njhbb1ZC2rOkyQyZCWpZBk9jXZCAaMLNY6SkNOrwPoRNaqO9Fbj31mZC8mxra08jIhBiziX7IZBFDWYbkcfw5cfLdTSys9ilfRlKsIZClOUlTiHnhSDkMvXY6rMFrvWswR2YVvJVH1qPvM7hGuuUqM
|
|
||||||
VERSION=v17.0
|
|
||||||
URL_WHATSAPP_MEDIA=https://ccsm-api.omnihit.app.br/whatsapp/official/media
|
|
||||||
URL_WHATSAPP_API=https://graph.facebook.com
|
|
||||||
|
|
||||||
JWT_SECRET=3123123213123
|
|
||||||
JWT_REFRESH_SECRET=75756756756
|
|
||||||
|
|
||||||
SENTRY_DSN=
|
|
||||||
|
|
||||||
CACHE=
|
|
||||||
|
|
||||||
WHATS_NUMBER_VALIDATOR_URL=http://localhost:8021
|
|
||||||
|
|
||||||
TOKEN_REMOTE_TICKET_CREATION=emvd7UfskjstMC99mFqs2tEiNmn05PgsUVK06TZP9LfkyjxDrsKCxlVV5ApYM7hP
|
|
||||||
TOKEN_IAM_HORACIUS_EL=emvd7UfskjstMC99mFqs2tEiNmn05PgsUVK06TZP9LfkyjxDrsKCxlVV5ApYM7hP
|
|
||||||
|
|
||||||
# omnihit da hit test bot
|
|
||||||
# APP_NAME=recrutamento_el
|
|
||||||
APP_NAME=test
|
|
||||||
|
|
||||||
BACKEND_URL_RAW=http://localhost
|
|
||||||
|
|
||||||
PUBLICKEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwOvEh4Qc0yeJidiX3YpDdOB/XuDeyNRaypmSyW5FjjIxBFaMiUmNSZ2X2m2LqyyrHJxQgRqwjifHUQ+ivmNBm4YFNSr05iFB/kgi/1Jmbst6h1MnmuD1YFSRnEsmdUXzhhgcj5btyjRfw6L2rGwOnqzMzS54seE1aAy+rtN82DW8wfbYU/IO83MAJiocthCBOev5MDUq6hdkGPPZ/kdFOLcQe+wt/suhmF4KRfq77X4GgLM5nAOMj7N7cJ6b97nB47krfPOMJissNzPDZ879BKeQX4t8TwJGUFNOvLd3UW3xVBTBz8pSS36VlCXjbYm44za8eTuBLDYYbGkUNEFYxwIDAQAB
|
|
||||||
|
|
||||||
REDIS_URI=redis://127.0.0.1:6379
|
|
||||||
|
|
||||||
URL_DASHBOARD_SESSIONS=http://localhost:6002
|
|
||||||
TOKEN_DASHBOARD_SESSIONS=8168dd72adb7bab7e8f54f9d022468ab
|
|
||||||
|
|
|
@ -104,16 +104,16 @@ const monitor = async () => {
|
||||||
stdout = stdout[1].trim().split(/\s+/);
|
stdout = stdout[1].trim().split(/\s+/);
|
||||||
|
|
||||||
// DISK SPACE MONITORING
|
// DISK SPACE MONITORING
|
||||||
// const io = getIO();
|
const io = getIO();
|
||||||
// io.emit("diskSpaceMonit", {
|
io.emit("diskSpaceMonit", {
|
||||||
// action: "update",
|
action: "update",
|
||||||
// diskSpace: {
|
diskSpace: {
|
||||||
// size: stdout[1],
|
size: stdout[1],
|
||||||
// used: stdout[2],
|
used: stdout[2],
|
||||||
// available: stdout[3],
|
available: stdout[3],
|
||||||
// use: stdout[4]
|
use: stdout[4]
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
let data: any = {};
|
let data: any = {};
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
import { values } from "sequelize/types/lib/operators";
|
|
||||||
import Ticket from "../models/Ticket";
|
|
||||||
import { get, set } from "./RedisClient";
|
import { get, set } from "./RedisClient";
|
||||||
import { getIO } from "../libs/socket";
|
|
||||||
import UpdateTicketService from "../services/TicketServices/UpdateTicketService";
|
|
||||||
import { v4 as uuidv4 } from "uuid";
|
|
||||||
|
|
||||||
async function controllByNumber() {
|
async function controllByNumber() {
|
||||||
let tickets = await get({ key: "remote:ticketId*", parse: false });
|
let tickets = await get({ key: "remote:ticketId*", parse: false });
|
||||||
|
|
||||||
if (!tickets) return { ticketIds: [], tickets: null };
|
if (!tickets) return { ticketIds: [], tickets: null };
|
||||||
|
|
||||||
|
@ -14,20 +9,20 @@ async function controllByNumber() {
|
||||||
|
|
||||||
for (const ticket of tickets) {
|
for (const ticket of tickets) {
|
||||||
let match = ticket.match(/"whatsappId":(\d+)/);
|
let match = ticket.match(/"whatsappId":(\d+)/);
|
||||||
let whatsappId = match ? match[1] : null;
|
let whatsappId = match ? match[1] : null;
|
||||||
|
|
||||||
const whatsapp = await get({
|
const whatsapp = await get({
|
||||||
key: `whatsapp:${whatsappId}`
|
key: `whatsapp:${whatsappId}`
|
||||||
});
|
});
|
||||||
|
|
||||||
match = whatsapp.match(/"number":"(\d+)"/);
|
match = whatsapp.match(/"number":"(\d+)"/);
|
||||||
let number = match ? match[1] : null;
|
let number = match ? match[1] : null;
|
||||||
|
|
||||||
match = ticket.match(/"id":(\d+)/);
|
match = ticket.match(/"id":(\d+)/);
|
||||||
let ticketId = match ? match[1] : null;
|
let ticketId = match ? match[1] : null;
|
||||||
|
|
||||||
number = JSON.parse(number);
|
number = JSON.parse(number);
|
||||||
ticketId = JSON.parse(ticketId);
|
ticketId = JSON.parse(ticketId);
|
||||||
|
|
||||||
const index = controll.findIndex((c: any) => c.number == number);
|
const index = controll.findIndex((c: any) => c.number == number);
|
||||||
|
|
||||||
|
@ -36,22 +31,7 @@ async function controllByNumber() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ticketIds = controll.map((c: any) => c.ticketId);
|
const ticketIds = controll.map((c: any) => c.ticketId);
|
||||||
|
|
||||||
console.log("=======> ticketIds: ", ticketIds);
|
|
||||||
|
|
||||||
for (const ticketId of ticketIds) {
|
|
||||||
const ticket: any = await Ticket.findByPk(ticketId);
|
|
||||||
|
|
||||||
const { status } = ticket;
|
|
||||||
|
|
||||||
if (status == "pending") {
|
|
||||||
await UpdateTicketService({
|
|
||||||
ticketData: { statusChatEnd: uuidv4() },
|
|
||||||
ticketId: ticket.id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set(`remote:controll`, JSON.stringify(ticketIds));
|
set(`remote:controll`, JSON.stringify(ticketIds));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue