Админка: отображение невидимок уехало в новый класс. Отвязка от functions.php.

This commit is contained in:
Ivor Barhansky 2022-06-11 02:17:24 +03:00
parent bcd864d638
commit 4bd6a08e8a
3 changed files with 24 additions and 10 deletions

View File

@ -4,11 +4,11 @@
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
require_once '../functions.php';
require_once '../config.php';
use Battles\Admin\Clan;
use Battles\Admin\User as AUser;
use Battles\Chat;
use Battles\Database\Db;
use Battles\Moderation;
use Battles\Template;
use Battles\User;
@ -49,12 +49,6 @@ if (!empty($_POST['receiver']) && !empty($_POST['tgmsg'])) {
Chat::sendTelegraf($_POST['tgmsg'], $receiver->id);
echo "Успешно.";
}
# Показывает невидимок.
$row = Db::getInstance()->ofetchAll('SELECT id,login FROM users LEFT JOIN users_effects ue on users.id = ue.owner_id WHERE type = 1022 ORDER BY `id` DESC');
foreach ($row as $r) {
$invisList .= '<b>[id] = ' .$r->id. ', ' .$r->login. '</b><br>';
}
Template::header('ᐰdminка');
?>
@ -107,4 +101,4 @@ Template::header('ᐰdminка');
</form>
<span class="legend">Невидимки</span><br>
<div class="abils" style="width: fit-content;"><?= $invisList ?></div>
<div class="abils" style="width: fit-content; font-weight: bold;"><?= AUser::getInvisiblesList() ?></div>

View File

@ -0,0 +1,20 @@
<?php
namespace Battles\Admin;
use Battles\Database\Db;
class User
{
private const INVISIBILITY_EFFECT = 1022;
public static function getInvisiblesList(): string
{
$list = '';
$row = Db::getInstance()->ofetchAll('select id, login from users left join users_effects ue on users.id = ue.owner_id where type = ' . self::INVISIBILITY_EFFECT);
foreach ($row as $item) {
$list .= '[id] = ' . $item->id . ', ' . $item->login . '<br>';
}
return $list;
}
}

View File

@ -473,7 +473,7 @@ function SolveExp($at_id, $def_id, $damage): float
'btl_1' => 1,
'btl_2' => 0.5,
'btl_3' => 0.05,
];
];
$baseexp = [
"0" => "2",
"1" => "5",