activeDic = new \stdClass(); } else { parent::__construct($args); } } public function initialize() { $this->initActiveItem();//创建账号 初始化活动信息 } /** * 初始化活动信息 */ public function initActiveItem() { $nowTs = time(); if($this->activeDic == null){ $this->activeDic = new \stdClass(); } $aDic = new \stdClass(); $enum = new Enum_Active(); $list = array_values($enum->getConstList()); foreach ($list as $type) { if($type == null){ continue; } if(StlUtil::dictHasProperty($this->activeDic, $type)){ if($type == Enum_Active::NewWish){ if($this->activeDic->$type->totalNum >= glc()->UserWishNumLimit){ $this->isComNewWish = 1; StlUtil::dictRemove($this->activeDic, $type); StlUtil::dictPropertyRandom($dict); } } else if($type > Enum_Active::HuanlingshiActive){//检测时间是否过期 $shenmiaoMo = GameConfig::shenmiao_getItem($this->activeDic->$type->id); if($shenmiaoMo->startTs >= $nowTs || $nowTs > $shenmiaoMo->endTs){ $list = GameConfig::shenmiaoTypeList_getItemArray($type); if($list != null){ foreach ($list as $val) { if($val->startTs <=$nowTs && $nowTs<= $val->endTs){ $item = new Ins_active(); $item->id = $val->id; $this->activeDic->$type = $item; } } } } } } else { if($this->isComNewWish == 0 && $type == Enum_Active::NewWish){ $dic = GameConfig::shenmiaoTypeList_getItemArray($type)[0]; $item = new Ins_active(); $item->id = $dic->id; $this->activeDic->$type = $item; } elseif ($type == Enum_Active::OpenWish) { $dic = GameConfig::shenmiaoTypeList_getItemArray($type)[0]; $item = new Ins_active(); $item->id = $dic->id; $this->activeDic->$type = $item; } else { $list = GameConfig::shenmiaoTypeList_getItemArray($type); if($list != null){ foreach ($list as $val) { if($val->startTs <=$nowTs && $nowTs<= $val->endTs){ $item = new Ins_active(); $item->id = $val->id; $this->activeDic->$type = $item; } } } } } } } /** * 新手 常驻 * @param type $type */ public function createRegularActiveData($type) { } /** * 不定期 * @param type $type */ public function createLrregularActiveData($type) { } }