battles/models/EffectsModel.php

33 lines
906 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Author: lopiu
* Date: 05.07.2020
* Time: 23:32
*/
class EffectsModel
{
protected $DB;
const EFFECT_HIDEUSERINFO = 5;
public function __construct(int $user_id) {
try {
$this->DB = db::c()->query('SELECT * FROM effects WHERE owner_id = ?i', $user_id);
} catch (Exception $e) {echo '<div class="debug">class EffectsModel: Не могу подключиться к таблице effects!</div>';}
}
/**
* Проверка обезличен ли персонаж.
* @return int date() до конца эффекта или 0.
*/
public function getHideUserInfoStatus()
{
if ($this->DB) {
while ($row = $this->DB->fetch_object()) {
if ($row->type == self::EFFECT_HIDEUSERINFO) {
return $row->time;
}
}
}
return 0;
}
}