Комиссионка. Наброски.

This commit is contained in:
lopar
2021-08-31 10:43:48 +03:00
parent 54f4c08678
commit 6f7223a242
4 changed files with 27 additions and 5 deletions
+6
View File
@@ -7,6 +7,7 @@ use Battles\Database\DBPDO;
class Shop
{
public const GENERAL_SHOP = 1;
public const BARTER_SHOP = 2;
public const CATEGORY_SALE_ITEMS = -1;
public static Shop $current;
public int $categoryType = 0;
@@ -20,14 +21,19 @@ class Shop
{
if ($this->categoryType) {
$stmt = DBPDO::$db->ofetchAll('select * from items inner join trade_offers on id = shop_item_id where shop_id = ? and shop_item_quantity !=0 and item_type = ?', [$this->shopId, $this->categoryType]);
$stmt2 = DBPDO::$db->ofetchAll('select * from inventory where on_sale != 0 and present is null and item_type = ?', $this->categoryType);
} else {
$stmt = DBPDO::$db->ofetchAll('select * from items inner join trade_offers on id = shop_item_id where shop_id = ? and shop_item_quantity !=0', $this->shopId);
$stmt2 = DBPDO::$db->ofetchAll('select * from inventory where on_sale != 0 and present is null');
}
$iteminfo = [];
foreach ($stmt as $item) {
$iteminfo[] = new ShopItem($item, 'buyshop');
}
foreach ($stmt2 as $item) {
$iteminfo[] = new ShopItem($item, 'buymarket');
}
return $this->strFromArr($iteminfo);
}