84 lines
1.5 KiB
PHP
84 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace services;
|
|
|
|
require_once('models/User.php');
|
|
|
|
use models\User;
|
|
|
|
class PropertyChgService extends BaseService {
|
|
|
|
private $chgList = array();
|
|
private $userChg = false;
|
|
|
|
public function addUserChg()
|
|
{
|
|
$this->userChg = true;
|
|
}
|
|
|
|
public function addHeroChg()
|
|
{
|
|
$this->internalAddChg('hero');
|
|
}
|
|
|
|
public function addHeroSkinChg()
|
|
{
|
|
$this->internalAddChg('heroSkin');
|
|
}
|
|
|
|
public function addGunSkinChg()
|
|
{
|
|
$this->internalAddChg('gunSkin');
|
|
}
|
|
|
|
public function addBagChg()
|
|
{
|
|
$this->internalAddChg('bag');
|
|
}
|
|
|
|
public function addGunChg()
|
|
{
|
|
$this->internalAddChg('gun');
|
|
}
|
|
public function addChip()
|
|
{
|
|
$this->internalAddChg('chip');
|
|
}
|
|
|
|
public function addFragment()
|
|
{
|
|
$this->internalAddChg('fragment');
|
|
}
|
|
|
|
public function addParachute()
|
|
{
|
|
$this->internalAddChg('parachute');
|
|
}
|
|
public function addUserLevelChg()
|
|
{
|
|
$this->internalAddChg('level');
|
|
}
|
|
|
|
public function toDto()
|
|
{
|
|
$data = array(
|
|
'container_chg' => $this->chgList
|
|
);
|
|
if ($this->userChg) {
|
|
$data['user_info'] = User::info(myself()->_getOrmUserInfo());
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
private function internalAddChg($name)
|
|
{
|
|
foreach ($this->chgList as $item) {
|
|
if ($item == $name) {
|
|
return;
|
|
}
|
|
}
|
|
array_push($this->chgList, $name);
|
|
}
|
|
|
|
}
|