mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 20:51:25 +03:00
Удалил не нужные строки
This commit is contained in:
parent
3b62109402
commit
8780c1f772
1 changed files with 15 additions and 18 deletions
|
@ -12,12 +12,10 @@ async function save_fiat() {
|
||||||
`https://duckduckgo.com/js/spice/currency/1/${value}/${pair}`,
|
`https://duckduckgo.com/js/spice/currency/1/${value}/${pair}`,
|
||||||
{
|
{
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const regExp = new RegExp('\\(\\s*(.*)\\s*\\);$', 'mg');
|
const regExp = new RegExp('\\(\\s*(.*)\\s*\\);$', 'mg');
|
||||||
const data = JSON.parse(Array.from(res.data.matchAll(regExp))[0][1])
|
const data = JSON.parse(Array.from(res.data.matchAll(regExp))[0][1]);
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
delete data['terms'];
|
delete data['terms'];
|
||||||
delete data['privacy'];
|
delete data['privacy'];
|
||||||
|
@ -29,9 +27,9 @@ async function save_fiat() {
|
||||||
value,
|
value,
|
||||||
pair,
|
pair,
|
||||||
new Date(data['timestamp']).toLocaleDateString()
|
new Date(data['timestamp']).toLocaleDateString()
|
||||||
],
|
]).then(async (db) => {
|
||||||
).then(async (db) => {
|
if (db['rows'][0]) return;
|
||||||
if (!db['rows'][0]) {
|
|
||||||
await pool.query(`INSERT INTO currency (from_currency, conv_currency, rate, date)
|
await pool.query(`INSERT INTO currency (from_currency, conv_currency, rate, date)
|
||||||
VALUES ($1, $2, $3, $4) RETURNING *`,
|
VALUES ($1, $2, $3, $4) RETURNING *`,
|
||||||
[
|
[
|
||||||
|
@ -41,7 +39,6 @@ async function save_fiat() {
|
||||||
new Date(data['timestamp']).toLocaleDateString()
|
new Date(data['timestamp']).toLocaleDateString()
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue