Админка: телеграф переехал в Chat.

This commit is contained in:
2022-06-11 00:36:30 +03:00
parent 197e489e0e
commit bcd864d638
9 changed files with 21 additions and 29 deletions
+7 -3
View File
@@ -62,14 +62,18 @@ class Chat
return $wrappedMessage;
}
public function addMessage(string $msg)
public function sendMessage(string $msg)
{
$this->db->execute('insert into chat (user_id, msg) values (?,?)', [User::getInstance()->getId(), $msg]);
}
public static function addSYSMessage( string $msg, ?int $receiver_id = null)
public static function sendSys(string $msg, ?int $receiver_id = null)
{
Db::getInstance()->execute('insert into chat (user_id, msg, receiver_id, type) values (?,?,?,?)', [User::getInstance()->getId(), $msg, $receiver_id, 'sys']);
Db::getInstance()->execute('insert into chat (user_id, msg, receiver_id, type) values (-1,?,?,?)', [$msg, $receiver_id, 'sys']);
}
public static function sendTelegraf(string $msg, int $receiver_id)
{
Db::getInstance()->execute('insert into chat (user_id, msg, receiver_id, type) values (-1,?,?,?)', [$msg, $receiver_id, 'sms']);
}
}
+1 -1
View File
@@ -213,7 +213,7 @@ class UserStats extends User
$this->level += 1;
$this->free_stat_points += 2;
$this->saveStats();
Chat::addSYSMessage('Внимание, вы получили ' . $this->level . 'уровень. Доступны очки распределения параметров.');
Chat::sendSys('Внимание, вы получили ' . $this->level . 'уровень. Доступны очки распределения параметров.');
return 'Персонаж перешёл на ' . $this->level . 'уровень.';
}