WIP: перед введенимем класса Fighter.php

This commit is contained in:
2024-01-06 00:14:35 +02:00
parent 07f905ef64
commit a2c658166d
67 changed files with 5555 additions and 7135 deletions
+23 -2
View File
@@ -14,7 +14,7 @@ class ActionModel
$this->uid = $uid;
}
public static function new(array $user, string $vals, string $vars, int $time = 0)
public static function new(array $user, string $vals, string $vars, int $time = 0): void
{
if (!$time) {
$time = time();
@@ -60,7 +60,7 @@ class ActionModel
);
}
public function deleteByVals(string $vals)
public function deleteByVals(string $vals): void
{
Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]);
}
@@ -83,4 +83,25 @@ class ActionModel
return !empty($arr) ? $arr : [];
}*/
public function getDailyQuest(): array|false
{
return Db::getRow("select * from actions where uid = ? and vars = 'day_quest' limit 1", [$this->uid]);
}
public function getFinishedDailyQuestTasks(int $timeout): array
{
$arr = [];
$counter = Db::getRows(
"select count(*) as c, vars
from actions
where vars in ('end_trup', 'end_xaot', 'psh0', 'trup_sun', 'izlom', 'win') and time > ? and uid = ?
group by vars",
[$timeout, $this->uid]
);
foreach ($counter as $c) {
$arr[$c['vars']] = $c['c'];
}
return $arr;
}
}