more buy item fixes

This commit is contained in:
Igor Barkov [iwork] 2019-01-14 19:48:36 +02:00
parent 872e200ac8
commit 6566f7e725

View File

@ -100,23 +100,18 @@ if (!empty($_GET['buy'])) {
'nalign' => $dress['nalign'], 'nalign' => $dress['nalign'],
'dategoden' => $dress['dategoden'], 'dategoden' => $dress['dategoden'],
'goden' => $dress['goden'], 'goden' => $dress['goden'],
'otdel' => $dress['otdel'],//s
'gmp' => $dress['gmp'], 'gmp' => $dress['gmp'],
'gmeshok' => $dress['gmeshok'],
'encicl' => $dress['encicl'],//s
'artefact' => $dress['artefact'], 'artefact' => $dress['artefact'],
'koll' => $dress['koll'] 'koll' => $dress['koll']
]; ];
db::c()->query('INSERT INTO `inventory` SET ?A[?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i]', $newItem);
db::c()->query('INSERT INTO `inventory` SET ?A[?i,?i,"?s",?i,?i,?i,"?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,"?s",?i,?i,"?s",?i,?i]', $newItem);
$inventoryItemId = db::c()->getLastInsertId(); $inventoryItemId = db::c()->getLastInsertId();
if ($dress['count'] != -1) db::c()->query('UPDATE `shop` SET `count` = `count` - 1 WHERE `id` = ?i', $_GET['buy']); if ($dress['count'] != -1) db::c()->query('UPDATE `shop` SET `count` = `count` - 1 WHERE `id` = ?i', $_GET['buy']);
$status = "Вы купили \"{$dress['name']}\"."; $status = "Вы купили \"{$dress['name']}\".";
db::c()->query('UPDATE `users` set `money` = ?i WHERE `id` = ?i', $dress['cost'], $_SESSION['uid']); db::c()->query('UPDATE `users` set `money` = ?i WHERE `id` = ?i', $dress['cost'], $_SESSION['uid']);
$deloText = "{$user['login']} купил товар «{$dress['name']}» id:({$inventoryItemId}) в магазине за {$dress['cost']} кр.";
$deloText = "\"" . $user['login'] . "\" купил товар : \"" . $dress['name'] . " id:(" . $inventoryItemId . ") [0/" . $dress['maxdur'] . "] за " . $dress['cost'] . " кр."; addToDelo($deloText);
db::c()->query('INSERT INTO `delo` (`pers`, `text`, `type`, `date`) VALUES (?i, "?s", 1, ?i', $user['id'], $deloText, time());
} else { } else {
$status = "Недостаточно денег или нет вещей в наличии."; $status = "Недостаточно денег или нет вещей в наличии.";