game2006api/webapp/services/PropertyChgService.php
aozhiwei 31c3b0fa63 1
2022-09-15 14:37:09 +08:00

68 lines
1.2 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 addFragment()
{
$this->internalAddChg('fragment');
}
public function toDto()
{
return array(
'user_info' => $this->userChg ? User::info(myself()->_getOrmUserInfo()) : null,
'container_chg' => $this->chgList
);
}
private function internalAddChg($name)
{
foreach ($this->chgList as $item) {
if ($item == $name) {
return;
}
}
array_push($this->chgList, $name);
}
}