EmailModel.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 邮件数据模型
  5. * @version
  6. * 1.0.0 Created at 2017-4-27. by --gwang
  7. * @author gwang (mail@wanggangzero.cn)
  8. * @copyright ? 2017-4-27, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  9. */
  10. class EmailModel extends Object_ext
  11. {
  12. /**
  13. * 邮件编号
  14. * @var int
  15. */
  16. public $mailId;
  17. /**
  18. * 发件人uid
  19. * @var string
  20. */
  21. public $uid_sender;
  22. /**
  23. * 发件人昵称
  24. * @var string
  25. */
  26. public $name_sender;
  27. /**
  28. * 道具Id
  29. * @var string
  30. */
  31. public $itemid;
  32. /**
  33. * 道具数量
  34. * @var int
  35. */
  36. public $num;
  37. /**
  38. * 邮件类型
  39. * @var int
  40. */
  41. public $type;
  42. /**
  43. * 邮件标题
  44. * @var string
  45. */
  46. public $title;
  47. /**
  48. * 邮件正文
  49. * @var string
  50. */
  51. public $content;
  52. /**
  53. * 附加标签
  54. * @var obj
  55. */
  56. public $tag;
  57. /**
  58. * 生效时间
  59. * @var ts
  60. */
  61. public $startts;
  62. /**
  63. * 过期时间
  64. * @var ts
  65. */
  66. public $endts;
  67. /**
  68. * 领取时间
  69. * @var ts
  70. */
  71. public $drawedts = 0;
  72. /**
  73. * 发送时间
  74. * @var ts
  75. */
  76. public $insertts;
  77. /**
  78. * 邮件是否已经领取
  79. * true = 已读
  80. * @return bool
  81. */
  82. public function isDrawed()
  83. {
  84. return $this->drawedts > 0;
  85. }
  86. /**
  87. * 邮件是否存在奖励内容
  88. * true = 有奖励
  89. * false = 无
  90. * @return bool
  91. */
  92. public function isExistReward()
  93. {
  94. return $this->itemid > 0 && $this->num > 0;
  95. }
  96. /**
  97. * 返回: 物品id,数量 的字符串
  98. * @return string
  99. */
  100. public function getRewardStr()
  101. {
  102. return $this->itemid . "," . $this->num;
  103. }
  104. function __construct($tag = null, $type = 1, $title = "", $content = "", $itemid = 0, $num = 0, #
  105. $uid_sender = "系统", $name_sender = "系统", $startts = 0, $endts = 1999999999)
  106. {
  107. if (1 == func_num_args() && $tag) { # 默认的Object初始化方法
  108. parent::__construct($tag);
  109. } else {
  110. $this->tag = $tag;
  111. $this->type = $type;
  112. $this->title = $title;
  113. $this->content = $content;
  114. $this->itemid = $itemid;
  115. $this->num = $num;
  116. $this->uid_sender = $uid_sender;
  117. $this->name_sender = $name_sender;
  118. $this->startts = $startts;
  119. $this->endts = $endts;
  120. }
  121. }
  122. }