Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkBadGame() {
- var mysql = require('mysql');
- var connection = mysql.createConnection({
- host: 'localhost'
- , user: 'root'
- , password: ''
- , database: ''
- });
- connection.connect();
- getBadGame = 'SELECT won_items, winner_id, items, won_items, g.id as id, steamid64, accessToken FROM `games` as g JOIN users as u ON winner_id = u.id WHERE `status_prize` = 2 AND status = 3 ORDER BY id DESC LIMIT 0,1';
- connection.query(getBadGame, function (err, rows, fields) {
- if(rows.length == 0){
- return;
- }
- rows.forEach(function (item, i, arr) {
- console.log('Игра # ' + item.id + ' пользователю #' + item.winner_id + ' не отправлено ' + item.items + " предметов. Пытаемся отправить.");
- sendoffer = [];
- offer = JSON.parse(item.won_items);
- offer.forEach(function (it, key, array) {
- sendoffer.push(it.classid);
- });
- sendTradeOffer(730, item.steamid64, item.accessToken, sendoffer, '', item.id, '');
- });
- });
- connection.end();
- }
- setInterval(function () {
- checkBadGame();
- }, 10000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement