putting to shop to class
This commit is contained in:
parent
c1cad30a9e
commit
6ac1056b53
@ -84,6 +84,7 @@ abstract class Item
|
||||
public $zeton;
|
||||
public $onlyone;
|
||||
public $shshop;
|
||||
public $otdel;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -47,13 +47,13 @@ class ShopItem extends Item
|
||||
$btnValue = "Продать";
|
||||
$btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'marketback':
|
||||
$btnValue = "Снять товар с продажи";
|
||||
case 'marketgetback':
|
||||
$btnValue = "Снять с продажи";
|
||||
$btnLink = "?back={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
case 'marketshowmore':
|
||||
$btnValue = "Развернуть";
|
||||
$btnLink = "?max={$this->name}&rnd=" . mt_rand();
|
||||
$btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ if ($user['battle'] != 0) {
|
||||
|
||||
$get = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING'));
|
||||
|
||||
$itemCost = checkIntInRange($_GET['kredit']);
|
||||
$itemId = checkIntInRange($_GET['n']);
|
||||
$returningItemId = checkIntInRange($_GET['back']);
|
||||
if (isset($_GET['kredit'])) $itemCost = checkIntInRange($_GET['kredit']);
|
||||
if (isset($_GET['n'])) $itemId = checkIntInRange($_GET['n']);
|
||||
if (isset($_GET['back'])) $returningItemId = checkIntInRange($_GET['back']);
|
||||
|
||||
if ($itemCost && $itemId) {
|
||||
$commission = ceil($itemCost / 10); # 10% от суммы с округлением вверх.
|
||||
@ -47,18 +47,13 @@ if ($returningItemId) {
|
||||
}
|
||||
|
||||
|
||||
if (($_GET['set'] OR $_POST['set'])) {
|
||||
if ($_GET['set']) {
|
||||
$set = $_GET['set'];
|
||||
}
|
||||
if ($_POST['set']) {
|
||||
$set = $_POST['set'];
|
||||
}
|
||||
if ($_GET['set']) {
|
||||
|
||||
if (!$_POST['count'] || !is_numeric($_POST['count']) || $_POST['count'] <= 0) {
|
||||
$_POST['count'] = 1;
|
||||
}
|
||||
if (is_numeric($set) && $set > 0) {
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `dressed`=0 AND `id` = '{$set}' and `owner`!='" . $user['id'] . "' AND `setsale` > '0' LIMIT 1;"));
|
||||
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `dressed`=0 AND `id` = '{$set}' and `owner`!='" . $user['id'] . "' AND `setsale` > 0"));
|
||||
$userfrom = mysql_fetch_array(mysql_query("SELECT `login`,`id` FROM `users` WHERE `id` = '" . $dress['owner'] . "' LIMIT 1;"));
|
||||
$d = mysql_fetch_array(mysql_query("SELECT sum(`massa`) FROM `inventory` WHERE `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `setsale` = 0 ; "));
|
||||
if ($userfrom['id'] && $dress['id']) {
|
||||
@ -102,6 +97,24 @@ if (($_GET['set'] OR $_POST['set'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($get === 'sale') {
|
||||
$data = db::c()->query('SELECT `inventory`.*,
|
||||
`magic`.`name` AS `magic_name`,
|
||||
`magic`.`chanse` AS `magic_chanse`,
|
||||
`magic`.`time` AS `magic_time`,
|
||||
`magic`.`file` AS `magic_file`,
|
||||
`magic`.`targeted` AS `magic_targeted`,
|
||||
`magic`.`needcharge` AS `magic_needcharge`,
|
||||
`magic`.`img` AS `magic_img`,
|
||||
0 AS `maxdur`
|
||||
|
||||
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` = 0 AND `dressed` = 0 AND `present` = "?s" AND `owner` = ?i ORDER BY `update` DESC ', '', $_SESSION['uid']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
}
|
||||
}
|
||||
|
||||
if ($get === 'unsale') {
|
||||
$data = db::c()->query('SELECT `inventory`.*,
|
||||
`magic`.`name` AS `magic_name`,
|
||||
@ -232,46 +245,30 @@ switch ($shopCategoryTypeNumber) {
|
||||
}
|
||||
} elseif ($get === 'sale') {
|
||||
echo "<TR bgcolor=#C7C7C7><th colspan=2>Комиссия за услуги магазина составляет 10% от цены, по которой вы предлагаете предмет.</th></TR>";
|
||||
$data = db::c()->query('SELECT * FROM `inventory` WHERE `setsale` = 0 AND `dressed` = 0 AND `present` = "?s" AND `owner` = ?i ORDER BY `update` DESC ', '', $_SESSION['uid']);
|
||||
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
?>
|
||||
<TR>
|
||||
<TD align=center style="width:150px"><IMG SRC="i/sh/<?= $row['img'] ?>">
|
||||
<BR>
|
||||
<A onclick="sale('1', '<?= $row['name'] ?>', '<?= $row['id'] ?>', '<?= $row['cost'] ?>');"
|
||||
HREF="#">cдать в магазин</A>
|
||||
</TD>
|
||||
<TD valign=top>
|
||||
<?php showitem($row); ?>
|
||||
</TD>
|
||||
</TR>
|
||||
<?php
|
||||
}
|
||||
} elseif ($get === 'unsale') {
|
||||
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td style='width: 150px; text-align: center;'>";
|
||||
$ii->printImage();
|
||||
$ii->printControls('marketback');
|
||||
$ii->printImage(); ?>
|
||||
<br><button onclick="sale(1, '<?= $row['name'] ?>', '<?= $row['id'] ?>', '<?= $row['cost'] ?>')">Cдать в магазин</button>";
|
||||
<?php
|
||||
echo "</td>";
|
||||
echo "<td style='vertical-align: top;'>";
|
||||
$ii->printInfo();
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
} elseif ($get === 'unsale') {
|
||||
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td style='width: 150px; text-align: center;'>";
|
||||
$ii->printImage();
|
||||
$ii->printControls('marketgetback');
|
||||
echo "</td>";
|
||||
echo "<td style='vertical-align: top;'>";
|
||||
$ii->printInfo();
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
// while ($row = $data->fetch_assoc()) {
|
||||
// ?>
|
||||
<!-- <TR>-->
|
||||
<!-- <TD align=center style="width:150px"><IMG SRC="i/sh/--><?//= $row['img'] ?><!--">-->
|
||||
<!-- <BR><A HREF="?back=--><?//= $row['id'] ?><!--">забрать</A>-->
|
||||
<!-- </TD>-->
|
||||
<!-- <TD valign=top>-->
|
||||
<!-- --><?php //showitem($row); ?>
|
||||
<!-- </TD>-->
|
||||
<!-- </TR>-->
|
||||
<!-- --><?php
|
||||
// }
|
||||
} else {
|
||||
$data = db::c()->query('SELECT DISTINCT `img`, `name`, `nalign`, `massa` FROM `inventory` WHERE `dressed` = 0 AND `setsale` > 0 AND `present` = "?s" AND `otdel` = "?s" GROUP BY `img` ORDER BY `cost` ASC', '', $_GET['otdel']);
|
||||
$replacements = ['+1','+2','+3','+4','+5',' (мф)'];
|
||||
|
Loading…
Reference in New Issue
Block a user