UserNoticeAction.class.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class UserNoticeAction extends CommonAction
  10. {
  11. public function index()
  12. {
  13. $send_type = array(
  14. 'pai_wait_pay' => '竞拍未付款',
  15. 'tip_to_pay' => '提醒买家付款',
  16. 'pay_wait_delivery' => '买家已付款,等待发货',
  17. 'tip_to_delivery' => '提醒发货',
  18. 'tip_podcast_to_tryst' => '提醒主播约会',
  19. 'tip_podcast_to_goods' =>'提醒卖家发货',
  20. 'tip_podcast_to_over_tryst' => '提醒主播确认完成约会',
  21. 'tip_viewer_to_tryst' => '提醒买家约会',
  22. 'tip_viewer_to_over_tryst' => '提醒买家确认完成约会',
  23. 'frozen_margin' => '冻结保证金',
  24. 'return_margin' => '退还保证金',
  25. 'pai_close' => '竞拍关闭',
  26. 'pai_out' => '竞拍出局',
  27. 'pay_margin_success' => '成功缴纳保证金',
  28. 'viewer_to_over_tryst' => '买家确认收货(确定完成约会)',
  29. 'podcast_to_over_tryst' => '主播确认完成约会',
  30. 'sure_delivery' => '买家确认收货',
  31. 'pai_to_delivery' => '竞拍已发货',
  32. 'auto_over_pai' => '自动确认完成竞拍',
  33. 'no_pay' => '付款超时',
  34. 'tip_towait' => '提醒进入等待队列',
  35. 'to_refund' => '进入退款',
  36. );
  37. $param = array(
  38. 'user_id' => trim($_GET['user_id']),
  39. 'send_type' => trim($_GET['send_type']),
  40. 'begin_time' => trim($_GET['begin_time']),
  41. 'end_time' => trim($_GET['end_time']),
  42. );
  43. $map = array();
  44. if ($param['user_id']) {
  45. $map['user_id'] = $param['user_id'];
  46. }
  47. if ($param['send_type']) {
  48. $map['type'] = $param['send_type'];
  49. }
  50. if ($param['begin_time'] && $param['end_time']) {
  51. $map['_string'] = "create_time >=" . to_timespan($param['begin_time']) . " and create_time <=" . to_timespan($param['end_time']);
  52. } else if ($param['begin_time']) {
  53. $map['_string'] = "create_time >=" . to_timespan($param['begin_time']);
  54. } else if ($param['end_time']) {
  55. $map['_string'] = "create_time <=" . to_timespan($param['end_time']);
  56. }
  57. $model = D("user_notice");
  58. if (!empty($model)) {
  59. $this->_list($model, $map);
  60. }
  61. $list = $this->get("list");
  62. $result = array();
  63. $row = 0;
  64. foreach ($list as $k => &$v) {
  65. // if ($v['type'] == 0) {
  66. // $v['type'] = '仅消息';
  67. // } elseif ($v['type'] == 1) {
  68. // $v['type'] = '推送';
  69. // } else {
  70. // $v['type'] = '消息+推送';
  71. // }
  72. $v['type'] = $send_type[$v['type']];
  73. if ($v['is_read'] == 0) {
  74. $v['is_read'] = '未读';
  75. } else {
  76. $v['is_read'] = '已读';
  77. }
  78. $list[$k]['take_name'] = emoji_decode(M("user")->where("id=" . $v['user_id'] . " ")->getField("nick_name")); //接收人
  79. $list[$k]['send_name'] = emoji_decode(M("user")->where("id=" . $v['send_id'] . " ")->getField("nick_name")); //发送人
  80. $list[$k]['content'] = emoji_decode($list[$k]['content']);
  81. }
  82. $this->assign("send_type", $send_type);
  83. $this->assign("param", $param);
  84. $this->assign("list", $list);
  85. $this->display();
  86. return;
  87. }
  88. public function foreverdelete()
  89. {
  90. //彻底删除指定记录
  91. $ajax = intval($_REQUEST['ajax']);
  92. $id = $_REQUEST['id'];
  93. if (isset($id)) {
  94. $condition = array('id' => array('in', explode(',', $id)));
  95. $list = M('user_notice')->where($condition)->delete();
  96. if ($list !== false) {
  97. clear_auto_cache("banner_list");
  98. load_auto_cache("banner_list");
  99. save_log($info . l("FOREVER_DELETE_SUCCESS"), 1);
  100. $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
  101. } else {
  102. save_log($info . l("FOREVER_DELETE_FAILED"), 0);
  103. $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
  104. }
  105. } else {
  106. $this->error(l("INVALID_OPERATION"), $ajax);
  107. }
  108. }
  109. public function view_info()
  110. {
  111. $ajax = intval($_REQUEST['ajax']);
  112. $id = $_REQUEST['id'];
  113. if (isset($id)) {
  114. $list = M('user_notice')->where(array('id' => $id))->find();
  115. if ($list['type'] == 0) {
  116. $list['type'] = '仅消息';
  117. } elseif ($list['type'] == 1) {
  118. $list['type'] = '推送';
  119. } else {
  120. $list['type'] = '消息+推送';
  121. }
  122. if ($list['is_read'] == 0) {
  123. $list['is_read'] = '未读';
  124. } else {
  125. $list['is_read'] = '已读';
  126. }
  127. $list['take_name'] = emoji_decode(M("user")->where("id=" . $list['user_id'] . " ")->getField("nick_name")); //接收人
  128. $list['send_name'] = emoji_decode(M("user")->where("id=" . $list['send_id'] . " ")->getField("nick_name")); //发送人
  129. $this->assign("list", $list);
  130. }
  131. $this->display();
  132. }
  133. public function edit()
  134. {
  135. //彻底删除指定记录
  136. $ajax = intval($_REQUEST['ajax']);
  137. $id = $_REQUEST['id'];
  138. if (isset($id)) {
  139. $list = M('user_notice')->where(array('id' => $id))->save(array('is_read' => 1));
  140. if ($list !== false) {
  141. clear_auto_cache("banner_list");
  142. load_auto_cache("banner_list");
  143. save_log($info . l("UPDATE_SUCCESS"), 1);
  144. $this->success(l("UPDATE_SUCCESS"), $ajax);
  145. } else {
  146. save_log($info . l("UPDATE_FAILED"), 0);
  147. $this->error(l("UPDATE_FAILED"), $ajax);
  148. }
  149. } else {
  150. $this->error(l("INVALID_OPERATION"), $ajax);
  151. }
  152. }
  153. }