123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace loyalsoft;
- /**
- * Description of Info_ShenMiao
- *
- * @author cyzhao
- */
- class Info_ShenMiao extends Object_ext {
-
- /**
- * 新手祈愿是否已经完成 0:没有
- * @var type
- */
- public $isComNewWish = 0;
- /**
- * 活动信息
- * @var type
- */
- public $activeDic = null;
- /**
- * 构造函数
- * @param type $args
- */
- public function __construct($args = null) {
- if($args == null){
- $this->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) {
-
- }
-
- }
|