Compare commits
1 Commits
dev
...
4943-close
Author | SHA1 | Date |
---|---|---|
Vicent Llopis | 64e446d1cf |
|
@ -25,10 +25,10 @@ module.exports = Self => {
|
|||
return false;
|
||||
|
||||
const con = mysql.createConnection({
|
||||
host: `${config.hostDb}`,
|
||||
user: `${config.userDb}`,
|
||||
password: `${config.passwordDb}`,
|
||||
port: `${config.portDb}`
|
||||
host: config.hostDb,
|
||||
user: config.userDb,
|
||||
password: config.passwordDb,
|
||||
port: config.portDb
|
||||
});
|
||||
|
||||
const sql = `SELECT ot.ticket_id, ot.number
|
||||
|
@ -38,10 +38,10 @@ module.exports = Self => {
|
|||
JOIN (
|
||||
SELECT ote.thread_id, MAX(ote.created) created, MAX(ote.updated) updated
|
||||
FROM osticket.ost_thread_entry ote
|
||||
WHERE ote.staff_id != 0 AND ote.type = 'R'
|
||||
WHERE ote.staff_id AND ote.type = 'R'
|
||||
GROUP BY ote.thread_id
|
||||
) sub ON sub.thread_id = ot2.id
|
||||
WHERE ot.isanswered = 1
|
||||
WHERE ot.isanswered
|
||||
AND ots.state = '${config.oldStatus}'
|
||||
AND IF(sub.updated > sub.created, sub.updated, sub.created) < DATE_SUB(CURDATE(), INTERVAL ${config.day} DAY)`;
|
||||
|
||||
|
@ -112,6 +112,7 @@ module.exports = Self => {
|
|||
|
||||
async function close(token, secondCookie) {
|
||||
for (const ticketId of ticketsId) {
|
||||
try {
|
||||
const lockCode = await getLockCode(token, secondCookie, ticketId);
|
||||
let form = new FormData();
|
||||
form.append('__CSRFToken__', token);
|
||||
|
@ -133,7 +134,12 @@ module.exports = Self => {
|
|||
'Cookie': secondCookie
|
||||
}
|
||||
};
|
||||
return fetch(ostUri, params);
|
||||
await fetch(ostUri, params);
|
||||
} catch (e) {
|
||||
const err = new Error(`${ticketId} Ticket close faildes: ${e.message}`);
|
||||
err.stack += e.stack;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue