Изменено поле в БД, вынесены лишние функции их functions в профильные файлы. Оказывается, давно не работал логин и плохо работали сессии. Проверяется. Прочие мелкие баги и чистка самых хвостов.

This commit is contained in:
Igor Barkov (iwork)
2021-08-27 18:55:18 +03:00
parent 9c7fcda600
commit 7434f28fa6
36 changed files with 293 additions and 341 deletions
+11
View File
@@ -139,4 +139,15 @@ IMG;
{
return DBPDO::INIT()->execute('delete from inventory where dressed_slot = 0 and owner_id = ? and item_id = ?', [$_SESSION['uid'], $itemId]);
}
/** Надеюсь, временная заглушка, которая объединяет get_meshok() и другую выдачу одной строкой.
* @return string
*/
public static function getWeightData(): string
{
$query = 'select sum(weight) as `all`, strength * 4 as max from inventory left join users u on owner_id = id where owner_id = ?';
$weight = DBPDO::$db->ofetch($query, User::$current->getId());
$css = $weight->all > $weight->max ? ' style="color:maroon;"' : '';
return "<span$css>$weight->all / $weight->max</span>";
}
}
+21
View File
@@ -198,4 +198,25 @@ FORM;
{
return $this->item_type;
}
/** Выдача магазинных предметов по запросу.
* Ввелась чтобы перебить takeshopitem() в functions с идентичным функционалом.
* @param int $item_id ИД предмета.
* @param int $to ИД пперсонажа-получателя.
*/
public static function giveNewItem(int $item_id, int $to): array
{
$check = DBPDO::$db->ofetch('select 1 from items where id = ?', $item_id);
if (!$check) {
return [];
}
DBPDO::$db->execute(self::BUY_QUERY, [$to, $item_id]);
$return = DBPDO::$db->ofetch('select image, name from inventory where item_id = ?', DBPDO::$db->lastInsertId());
return [
'img' => $return->image,
'name' => $return->name,
'id' => $item_id,
];
}
}
+1 -1
View File
@@ -157,7 +157,7 @@ CREATE TABLE `online` (
-- Дамп данных таблицы `online`
--
INSERT INTO `online` (`user_id`, `date`, `real_time`, `room`) VALUES
INSERT INTO `online` (`user_id`, login_time, `real_time`, `room`) VALUES
(2, 1601412403, 1601651536, 1);
-- --------------------------------------------------------