Info_ShenMiao.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of Info_ShenMiao
  10. *
  11. * @author cyzhao
  12. */
  13. class Info_ShenMiao extends Object_ext {
  14. /**
  15. * 新手祈愿是否已经完成 0:没有
  16. * @var type
  17. */
  18. public $isComNewWish = 0;
  19. /**
  20. * 活动信息
  21. * @var type
  22. */
  23. public $activeDic = null;
  24. /**
  25. * 构造函数
  26. * @param type $args
  27. */
  28. public function __construct($args = null) {
  29. if($args == null){
  30. $this->activeDic = new \stdClass();
  31. } else {
  32. parent::__construct($args);
  33. }
  34. }
  35. public function initialize() {
  36. $this->initActiveItem();//创建账号 初始化活动信息
  37. }
  38. /**
  39. * 初始化活动信息
  40. */
  41. public function initActiveItem() {
  42. $nowTs = time();
  43. if($this->activeDic == null){
  44. $this->activeDic = new \stdClass();
  45. }
  46. $aDic = new \stdClass();
  47. $enum = new Enum_Active();
  48. $list = array_values($enum->getConstList());
  49. foreach ($list as $type) {
  50. if($type == null){
  51. continue;
  52. }
  53. if(StlUtil::dictHasProperty($this->activeDic, $type)){
  54. if($type == Enum_Active::NewWish){
  55. if($this->activeDic->$type->totalNum >= glc()->UserWishNumLimit){
  56. $this->isComNewWish = 1;
  57. StlUtil::dictRemove($this->activeDic, $type);
  58. StlUtil::dictPropertyRandom($dict);
  59. }
  60. } else if($type > Enum_Active::HuanlingshiActive){//检测时间是否过期
  61. $shenmiaoMo = GameConfig::shenmiao_getItem($this->activeDic->$type->id);
  62. if($shenmiaoMo->startTs >= $nowTs || $nowTs > $shenmiaoMo->endTs){
  63. $list = GameConfig::shenmiaoTypeList_getItemArray($type);
  64. if($list != null){
  65. foreach ($list as $val) {
  66. if($val->startTs <=$nowTs && $nowTs<= $val->endTs){
  67. $item = new Ins_active();
  68. $item->id = $val->id;
  69. $this->activeDic->$type = $item;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. } else {
  76. if($this->isComNewWish == 0 && $type == Enum_Active::NewWish){
  77. $dic = GameConfig::shenmiaoTypeList_getItemArray($type)[0];
  78. $item = new Ins_active();
  79. $item->id = $dic->id;
  80. $this->activeDic->$type = $item;
  81. } elseif ($type == Enum_Active::OpenWish) {
  82. $dic = GameConfig::shenmiaoTypeList_getItemArray($type)[0];
  83. $item = new Ins_active();
  84. $item->id = $dic->id;
  85. $this->activeDic->$type = $item;
  86. } else {
  87. $list = GameConfig::shenmiaoTypeList_getItemArray($type);
  88. if($list != null){
  89. foreach ($list as $val) {
  90. if($val->startTs <=$nowTs && $nowTs<= $val->endTs){
  91. $item = new Ins_active();
  92. $item->id = $val->id;
  93. $this->activeDic->$type = $item;
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. /**
  102. * 新手 常驻
  103. * @param type $type
  104. */
  105. public function createRegularActiveData($type) {
  106. }
  107. /**
  108. * 不定期
  109. * @param type $type
  110. */
  111. public function createLrregularActiveData($type) {
  112. }
  113. }