Merge
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace User;
|
||||
|
||||
use Clan\ClanInfo;
|
||||
use Core\Config;
|
||||
use Core\Db;
|
||||
use Images;
|
||||
|
||||
class Clan
|
||||
{
|
||||
private $userid;
|
||||
private int $id = 0;
|
||||
private ?string $name;
|
||||
private ?int $align;
|
||||
private ?int $logo;
|
||||
private ?int $status;
|
||||
|
||||
public function __construct(array $userinfo)
|
||||
{
|
||||
$this->userid = $userinfo['id'];
|
||||
if (isset($_POST['joinclan']) && ClanInfo::isJoinable($_POST['joinclan'])) {
|
||||
$this->join($_POST['joinclan']);
|
||||
exit('<script>window.location.replace("/main.php?clan=1");</script>');
|
||||
}
|
||||
$c = Db::getRow('select * from clan where id = ?', [$userinfo['clan']]);
|
||||
if (!empty($c)) {
|
||||
foreach ($c as $k => $v) {
|
||||
$this->$k = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function join(string $clanname)
|
||||
{
|
||||
Db::sql('update users set clan = (select id from clan where clan.name = ?) where id = ?', [$clanname, $this->userid]);
|
||||
}
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getStatus(): ?int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function printClan()
|
||||
{
|
||||
echo '<img style="vertical-align:text-bottom;" src="' . Config::img() . '/i/align/align' . $this->getAlign() . '.gif" alt="Склонность">' . $this->printLogoImage() . $this->getName();
|
||||
}
|
||||
|
||||
public function getAlign(): ?int
|
||||
{
|
||||
return $this->align;
|
||||
}
|
||||
|
||||
public function printLogoImage(): string
|
||||
{
|
||||
return '<img style="vertical-align:text-bottom;" src = "' . Images::getSrc($this->logo) . '" width = "24px" height = "15px">';
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getLogo(): ?int
|
||||
{
|
||||
return $this->logo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Клан зарегистрирован и подверждён.
|
||||
* @return bool
|
||||
*/
|
||||
public function isRegistered(): bool
|
||||
{
|
||||
return !empty($this->id) && $this->status !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Клан зарегистрирован и ожидает подтверждения.
|
||||
* @return bool
|
||||
*/
|
||||
public function isAwaitingConfirmation(): bool
|
||||
{
|
||||
return !empty($this->id) && $this->status === 0;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace User;
|
||||
|
||||
use Core\ConversionHelper;
|
||||
use Core\Db;
|
||||
use Delo;
|
||||
use User;
|
||||
|
||||
class ItemsModel
|
||||
@@ -101,24 +102,18 @@ class ItemsModel
|
||||
if ($mxiznos > 0) {
|
||||
$i['iznosMAXi'] = $mxiznos;
|
||||
}
|
||||
if ($user->info['dnow'] > 0) {
|
||||
$room = $user->room['city'];
|
||||
} else {
|
||||
$room = $user->info['city'];
|
||||
}
|
||||
|
||||
$args = [
|
||||
$i['overTypei'] ?? 0,
|
||||
$i['id'],
|
||||
$uid,
|
||||
$data,
|
||||
$i['iznosMAXi'],
|
||||
$i['geni'],
|
||||
$i['magic_inci'],
|
||||
$room,
|
||||
$i['dn_delete'] ?? 0,
|
||||
];
|
||||
Db::sql(
|
||||
'insert into items_users (overType, item_id, uid, data, iznosMAX, geniration, magic_inc, maidin, lastUPD, time_create, dn_delete) values (?,?,?,?,?,?,?,?,unix_timestamp(),unix_timestamp(),?)',
|
||||
'insert into items_users (overType, item_id, uid, data, iznosMAX, magic_inc, lastUPD, time_create, dn_delete) values (?,?,?,?,?,?,unix_timestamp(),unix_timestamp(),?)',
|
||||
$args
|
||||
);
|
||||
$rt = Db::lastInsertId() ?? 0;
|
||||
@@ -132,16 +127,7 @@ class ItemsModel
|
||||
$ads = 'Расплавлен предмет : [' . $plavka . ']';
|
||||
}
|
||||
//Записываем в личное дело что предмет получен
|
||||
$user->addDelo(
|
||||
1,
|
||||
$uid,
|
||||
'"AddItems.' . $user->info['city'] . '": Получен предмет "<strong>' . $i['name'] . '</strong>" (x1) [#' . $i['iid'] . ']. ' . $ads,
|
||||
time(),
|
||||
$user->info['city'],
|
||||
'AddItems.' . $user->info['city'],
|
||||
0,
|
||||
0
|
||||
);
|
||||
Delo::add(1, 'additems', $uid, 'Получен предмет «' . $i['name'] . '» [id:' . $i['iid'] . ']' . $ads);
|
||||
}
|
||||
}
|
||||
return $rt;
|
||||
|
||||
Reference in New Issue
Block a user