Нападалка вынесена из Magic.php.
This commit is contained in:
@@ -58,7 +58,8 @@ class ItemsModel
|
||||
public static function deleteItemsById(int $id, int $coldel = 1)
|
||||
{
|
||||
Db::sql(
|
||||
'update items_users set `delete` = unix_timestamp() where id in (select id from items_users where item_id = ? and uid = ? and (`delete` = 0 or `delete` = 1000) order by inGroup desc limit ?)',
|
||||
'update items_users set `delete` = unix_timestamp()
|
||||
where id in (select id from items_users where item_id = ? and uid = ? and (`delete` = 0 or `delete` = 1000) order by inGroup desc limit ?)',
|
||||
[$id, User::start()->info['id'], $coldel]
|
||||
);
|
||||
}
|
||||
@@ -70,7 +71,8 @@ class ItemsModel
|
||||
$stats = User::start()->stats;
|
||||
|
||||
return [
|
||||
'now' => Db::getValue('select sum(massa) from items_users left join items_main on item_id = items_main.id where uid = ? and (`delete` = 0 or (`delete` = 1000 and inGroup > 0)) and inShop = 0 and inOdet = 0', [$uid]),
|
||||
'now' => Db::getValue('select sum(massa) from items_users left join items_main on item_id = items_main.id
|
||||
where uid = ? and (`delete` = 0 or (`delete` = 1000 and inGroup > 0)) and inShop = 0 and inOdet = 0', [$uid]),
|
||||
'max' => 40 + ($stats['os7'] * 10) + $stats['s4'] + $stats['maxves'] + $stats['s1'] * 4,
|
||||
'items' => Db::getValue('select count(*) from items_users where uid = ? and `delete` = 0 and inShop = 0 and inOdet = 0', [$uid]),
|
||||
];
|
||||
@@ -140,12 +142,17 @@ class ItemsModel
|
||||
*/
|
||||
public static function getOwnedItemById(int $itemId, int $ownerId): array
|
||||
{
|
||||
return Db::getRow('select * from items_users left join items_main on item_id = items_main.id where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]);
|
||||
return Db::getRow('select * from items_users left join items_main on item_id = items_main.id
|
||||
where uid = ? and items_users.id = ? and `delete` = 0 and inOdet = 0 and inShop = 0', [$ownerId, $itemId]);
|
||||
}
|
||||
|
||||
public static function delete(int $id)
|
||||
{
|
||||
Db::sql('update items_users set `delete` = unix_timestamp() where id = ?', [$id]);
|
||||
Db::sql('delete from items_users where id = ?', [$id]);
|
||||
}
|
||||
|
||||
public static function getDressedEkrTotalPrice($uid)
|
||||
{
|
||||
return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user