Ins_Email.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 Ins_Email extends Object_ext {
  11. /**
  12. * 邮件编号
  13. * @var int
  14. */
  15. public $mailId;
  16. /**
  17. * 发件人uid
  18. * @var string
  19. */
  20. public $sender_uid;
  21. /**
  22. * 发件人昵称
  23. * @var string
  24. */
  25. public $sender_name;
  26. /**
  27. * 附件
  28. * @var string itemId,num;itemId,num;....
  29. */
  30. public $appendix;
  31. /**
  32. * 邮件类型
  33. * @var int
  34. */
  35. public $type;
  36. /**
  37. * 邮件标题
  38. * @var string
  39. */
  40. public $title;
  41. /**
  42. * 邮件正文
  43. * @var string[]
  44. */
  45. public $content;
  46. /**
  47. * 附加标签
  48. * @var obj
  49. */
  50. public $tag;
  51. /**
  52. * 打开/读取邮件 时间戳
  53. * @var ts
  54. */
  55. public $readts = 0;
  56. /**
  57. * 领取时间
  58. * @var ts
  59. */
  60. public $drawedts = 0;
  61. /**
  62. * 发送时间
  63. * @var ts
  64. */
  65. public $insertts = 0;
  66. /**
  67. * 邮件是否已经领取
  68. * true = 已读
  69. * @return bool
  70. */
  71. public function isDrawed() {
  72. return $this->drawedts > 0;
  73. }
  74. /**
  75. * 计算邮件的超时时间
  76. * @return type
  77. */
  78. public function ExpireTs() {
  79. return $this->insertts + EmailProc::MaxMailExpireTs;
  80. }
  81. /**
  82. * 邮件是否存在奖励内容
  83. * true = 有奖励
  84. * false = 无
  85. * @return bool
  86. */
  87. public function isExistReward() {
  88. return strlen($this->appendix) > 0;
  89. }
  90. function __construct($tag = null, $type = 1, $title = "", $content = "", $appendix = "", #
  91. $uid_sender = "系统", $name_sender = "系统") {
  92. if (1 == func_num_args() && $tag) { # 默认的Object初始化方法
  93. parent::__construct($tag);
  94. } else { # 并非只有一个参数的情况下, tag还是tag
  95. $this->tag = $tag;
  96. $this->type = $type;
  97. $this->title = $title;
  98. $this->content = $content;
  99. $this->appendix = $appendix;
  100. $this->sender_uid = $uid_sender;
  101. $this->sender_name = $name_sender;
  102. $this->insertts = now(); # 初始化插入/创建时间
  103. }
  104. }
  105. }