Разбивка inf.php по классам.
This commit is contained in:
30
models/EffectsModel.php
Normal file
30
models/EffectsModel.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: lopiu
|
||||
* Date: 05.07.2020
|
||||
* Time: 23:32
|
||||
*/
|
||||
|
||||
class EffectsModel
|
||||
{
|
||||
protected $DB;
|
||||
const EFFECT_HIDEUSERINFO = 5;
|
||||
public function __construct(int $user_id) {
|
||||
$this->DB = db::c()->query('SELECT * FROM effects WHERE owner_id = ?i', $user_id);
|
||||
throw new Exception('<div class="debug">Не могу подключиться к таблице effects!</div>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка обезличен ли персонаж.
|
||||
* @return int date() до конца эффекта или 0.
|
||||
*/
|
||||
public function getHideUserInfoStatus()
|
||||
{
|
||||
while ($row = $this->DB->fetch_object()) {
|
||||
if ($row->type == self::EFFECT_HIDEUSERINFO) {
|
||||
return $row->time;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,20 @@
|
||||
|
||||
class PresentsModel
|
||||
{
|
||||
public function getAllPresents($user_id) {
|
||||
return db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
|
||||
protected $DB;
|
||||
|
||||
public function __construct(int $user_id)
|
||||
{
|
||||
$this->DB = db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
|
||||
}
|
||||
|
||||
public function getAllPresents()
|
||||
{
|
||||
return $this->DB;
|
||||
}
|
||||
|
||||
public function getPresentsSum()
|
||||
{
|
||||
return $this->DB->getNumRows();
|
||||
}
|
||||
}
|
||||
22
models/UserLogModel.php
Normal file
22
models/UserLogModel.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: lopiu
|
||||
* Date: 05.07.2020
|
||||
* Time: 22:38
|
||||
*/
|
||||
|
||||
class UserLogModel
|
||||
{
|
||||
protected $DB;
|
||||
|
||||
public function __construct(int $user_id)
|
||||
{
|
||||
$this->DB = db::c()->query('SELECT * FROM users_logs WHERE user_id = ?i ORDER BY `id` ASC', $user_id);
|
||||
|
||||
}
|
||||
|
||||
public function getUserLog()
|
||||
{
|
||||
return $this->DB;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user