game2006api/webapp/services/PropertyChgService.php
2021-12-01 14:17:01 +08:00

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