Info_UserInteract.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. //
  3. //namespace loyalsoft;
  4. //
  5. ///**
  6. // * 用户交互信息数据模型
  7. // * 注:mem中是独立于userInfo的存在, 以减少交互操作的时候出现写入冲突产生覆盖的情况。
  8. // * attention: 读写数据的时候,利用redis的watch机制实现事务写入,加上自动重试机制. (Ps.这是目标,gwang.20170426153414)
  9. // *
  10. // * @version
  11. // * 1.0.0 Created at 2017-3-25. by --gwang
  12. // * @author gwang (mail@wanggangzero.cn)
  13. // * @copyright ? 2017-3-25, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  14. // */
  15. //class UserInteractModel extends Object_ext
  16. //{
  17. //
  18. // public $uid;
  19. // public $zoneid;
  20. // // ------------字段声明-------------
  21. //
  22. // /**
  23. // * 邮件列表
  24. // * @var object
  25. // */
  26. // public $mailQueue;
  27. //
  28. // /**
  29. // * 邮件序列id
  30. // * @var int
  31. // */
  32. // public $mailMaxId = 0;
  33. //
  34. // /**
  35. // * 系统邮件记录[存在于系统公共缓冲区的邮件仅能接收一次]
  36. // * @var array
  37. // */
  38. // public $sysMailRecord;
  39. //
  40. //// ------------ 初始化 ------------------
  41. //
  42. // /**
  43. // * 创建账号的时候执行初始化.
  44. // */
  45. // public function initialize()
  46. // {
  47. // $this->mailQueue = ObjectInit();
  48. // $this->mailMaxId = 10000;
  49. // $this->sysMailRecord = ArrayInit();
  50. // }
  51. //
  52. //// ----------- 方法 ---------------------
  53. // // <editor-fold defaultstate="collapsed" desc=" 公开方法 ">
  54. //
  55. // /**
  56. // * 新增系统邮件
  57. // * @param int $sysId 邮件的id
  58. // * @param string $title 邮件标题
  59. // * @param type $content 邮件正文
  60. // * @param type $itemid 道具id (附加于tag字段)
  61. // * @param type $startts 生效时间
  62. // * @param type $endts 过期时间
  63. // * @param type $interact 目标交互体
  64. // */
  65. // static function insertSysMail($sysId, $title, $content, $itemid, $startts, $endts, &$interact)
  66. // {
  67. // self::insertMail("0", "系统邮件", "", "", 1, $title, $content, $itemid, $startts, $endts, $interact);
  68. // if ($sysId != 0) {
  69. // $sysMailRecord = $interact->sysMailRecord;
  70. // $sysMailRecord[] = $sysId;
  71. // $interact->sysMailRecord = $sysMailRecord;
  72. // }
  73. // }
  74. //
  75. // /**
  76. // * 新增邮件
  77. // * @param string $fromoid 发送人的oid
  78. // * @param type $name 发送人的呢称
  79. // * @param type $pf pf
  80. // * @param type $img 图像
  81. // * @param type $type 邮件类型
  82. // * @param string $title 邮件标题
  83. // * @param string $content 邮件正文
  84. // * @param type $tag 额外标签可以传递数据
  85. // * @param ts $startts 生效时间
  86. // * @param ts $endts 过期时间
  87. // * @param UserInteractModel $interact 目标交互体
  88. // * @return void
  89. // */
  90. // static function insertMail($fromoid, $name, $pf, $img, $type, $title, $content, $tag, $startts, $endts, &$interact)
  91. // {
  92. // if (CommUtil::tsCurrent() > $endts) {
  93. // return;
  94. // }
  95. // $interact->mailMaxId++;
  96. // $mailMaxId = $interact->mailMaxId;
  97. // $mail = new EmailModel;
  98. // $mail->fromoid = $fromoid;
  99. // $mail->name = $name;
  100. // $mail->pf = $pf;
  101. // $mail->img = $img;
  102. // $mail->type = $type;
  103. // $mail->title = $title;
  104. // $mail->content = $content;
  105. // $mail->tag = $tag;
  106. // $mail->startts = $startts;
  107. // $mail->endts = $endts;
  108. // $mail->ts = CommUtil::tsCurrent();
  109. // $interact->mailQueue->$mailMaxId = $mail;
  110. // # 记录日志
  111. // self::_insertMailRecord($interact->oid, $interact->zoneid, $mail, $mailMaxId);
  112. // }
  113. //
  114. // /**
  115. // * 插入发送邮件的日志
  116. // * @param string uid
  117. // * @param int $zoneid
  118. // * @param EmailModel $mail
  119. // * @param int $mailId
  120. // */
  121. // static function _insertMailRecord($uid, $zoneid, $mail, $mailId)
  122. // {
  123. // $sql = <<<ins
  124. //INSERT INTO `tab_mailrecord` (oid,`zoneid`,mailId, fromoid,`name`, pf,img,type,title,content,tag,startts,endts,insertts)
  125. // VALUES ('%s',%d,%d,'%s','%s','%s','%s',%d,'%s','%s','%s',%d,%d,now());
  126. //ins;
  127. // $insertstr = sprintf($sql, $uid, $zoneid, $mailId, $mail->fromoid, $mail->name, #
  128. // $mail->pf, $mail->img, $mail->type, $mail->title, $mail->content, #
  129. // $mail->tag, $mail->startts, $mail->endts);
  130. // daoInst()->query($insertstr);
  131. // }
  132. //
  133. // /**
  134. // * 获取邮件序列[自动过滤尚未到(生效)期的邮件,自动删除已过期的邮件]
  135. // * @param UserInteractModel $interact Description
  136. // */
  137. // static function getMailQueue($interact)
  138. // {
  139. // $mailList = ObjectInit();
  140. // $mailQueue = $interact->mailQueue;
  141. // foreach ($mailQueue as $mailId => $mail) {
  142. // $ts = CommUtil::tsCurrent();
  143. // if ($ts >= $mail->startts) {
  144. // if ($ts > $mail->endts) {
  145. // self::deleteMail($mailId, $interact);
  146. // } else {
  147. // $mailList->$mailId = $mail;
  148. // }
  149. // }
  150. // }
  151. // return $mailList;
  152. // }
  153. //
  154. // /**
  155. // * 删除邮件[附件接收完毕之后]
  156. // * @param type $mailId
  157. // * @param UserInteractModel $interact Description
  158. // */
  159. // static function deleteMail($mailId, &$interact)
  160. // {
  161. // self::_drawMailRecord($mailId, $interact); # 领取记录
  162. // StlUtil::dictRemove($interact->mailQueue, $mailId);
  163. // }
  164. //
  165. // /**
  166. // * 更新领取记录
  167. // * @param type $mailId
  168. // * @param UserInteractModel $interact
  169. // */
  170. // static function _drawMailRecord($mailId, $interact)
  171. // {
  172. // $sql = "update tab_mailrecord set drawedts=now() where mailId=%d and zoneid=%s and uid=%s;";
  173. // $updatestr = sprintf($sql, $mailId, $interact->zoneid, $interact->uid);
  174. // daoInst()->query($updatestr);
  175. // }
  176. //
  177. //// </editor-fold>
  178. //}