thêm query lịch sử theo ngày

This commit is contained in:
Dung Nguyen 2022-03-03 18:32:14 +07:00
parent e25974a49a
commit 0c115fe806

View File

@ -260,7 +260,7 @@ puppeteer
5. /set_money_enter:number1,number2 - Vào tiền khi đủ điều kiện; 5. /set_money_enter:number1,number2 - Vào tiền khi đủ điều kiện;
6. /history - Vào tiền khi đủ điều kiện; 6. /history - Vào tiền khi đủ điều kiện;
7. /check_tk - Check tiền ; 7. /check_tk - Check tiền ;
8. /view_history - Xem toàn bộ lịch sử vào lệnh;`, 8. /view_history:[date] - Xem toàn bộ lịch sử vào lệnh; dụ /view_history:3/3/2022`,
{ parse_mode: "HTML" } { parse_mode: "HTML" }
); );
return; return;
@ -348,8 +348,9 @@ SELL: /sell:[number]`,
} }
if (text.startsWith('/view_history')) { if (text.startsWith('/view_history')) {
const dateQuery = text.replace('/view_history:');
db.query( db.query(
`SELECT * FROM histories ORDER BY id desc`, `SELECT * FROM histories WHERE time like '%${dateQuery}' ORDER BY id asc`,
[], (error, results) => { [], (error, results) => {
if (error) { if (error) {
console.log(error); console.log(error);