Убрать из выборки ремонта некоцанные предметы.

This commit is contained in:
Igor Barkov [iwork] 2018-12-12 16:46:07 +02:00
parent 9fcbfb7ba4
commit c59a309a43

View File

@ -28,8 +28,6 @@ if ($_GET['sid'] && $_GET['rep']) {
$row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `isrep` = 1 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['rep']}' AND `setsale`=0 LIMIT 1;")); $row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `isrep` = 1 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `id` = '{$_GET['rep']}' AND `setsale`=0 LIMIT 1;"));
$full = $row['duration']; $full = $row['duration'];
if ($row['duration'] > 1) { if ($row['duration'] > 1) {
//$onecost=$row['cost']/($row['maxdur']*10);
//if($onecost < 0.1) {$onecost=0.1;}
$onecost = 0.1; $onecost = 0.1;
if (round($onecost * $full) <= $user['money']) { if (round($onecost * $full) <= $user['money']) {
if (mysql_query("UPDATE `inventory` SET `duration` = '0' WHERE `id` = {$_GET['rep']}")) { if (mysql_query("UPDATE `inventory` SET `duration` = '0' WHERE `id` = {$_GET['rep']}")) {
@ -49,7 +47,7 @@ if ($_GET['sid'] && $_GET['rep']) {
} }
if (input::post('goto') == 'remont') { if (input::post('goto') == 'remont') {
$data = db::c()->query('SELECT * FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']); $data = db::c()->query('SELECT * FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `duration` > 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
$onecost = 0.1; $onecost = 0.1;
} }
@ -123,8 +121,9 @@ if (input::post('goto') == 'remont') {
<div class="appblock"> <div class="appblock">
<span class="legend"><?= $row['name'] ?></span> <span class="legend"><?= $row['name'] ?></span>
<div style="text-align: center"> <div style="text-align: center">
<img src="i/sh/<?= $row['img'] ?>"> [<?= $row['duration'] ?>/<?= $row['maxdur'] ?>]
<a href="?rep=<?= $row['id'] ?>&sid=full">Ремонт за <?= round(($row['duration'] * $onecost), 2) ?> кр.</a> <br><img src="i/sh/<?= $row['img'] ?>">
<br><a href="?rep=<?= $row['id'] ?>&sid=full">Ремонт за <?= $row['duration'] ?> кр.</a>
</div> </div>
</div> </div>
<?php endwhile; endif; ?> <?php endwhile; endif; ?>