WIP: перед введенимем класса Fighter.php
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user