Подрубил счётчик участий в турнирах #12

This commit is contained in:
2022-06-27 14:44:30 +03:00
parent 1666e39160
commit dc710a8cb1
3 changed files with 30 additions and 13 deletions
+15 -1
View File
@@ -199,11 +199,25 @@ class Achievements
return $this->info;
}
public function updateTier($name)
private function addOne($name)
{
Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]);
}
public function updateTier($name)
{
if (in_array($name, array_keys($this->data))) {
$this->addOne($name . '_n');
}
}
public function updateCounter($name)
{
if (in_array($name, array_keys($this->data))) {
$this->addOne($name);
}
}
/**
* @return array[]
*/
@@ -1,6 +1,9 @@
<?php
namespace Insallah;
use Achievements;
use user;
class TournamentModel
{
@@ -182,11 +185,11 @@ class TournamentModel
$db = new Db();
$db::sql('update tournaments_users set death_time = unix_timestamp() where uid = ?', [$uid]);
self::teleport($uid, 9);
(new Achievements(user::start()))->updateCounter('trn');
}
/**
* Узнаём id турнира по id игрока.
* todo Проверить, возможно можно обращаться к уровню игрока.
*
* @param int $uid
*