WeiboAllegeListAction.class.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 WeiboAllegeListAction extends CommonAction{
  10. public function index($type='')
  11. {
  12. $weibo = $this->get_allege_list();
  13. $this->assign ( 'list', $weibo );
  14. $this->display ();
  15. }
  16. public function pending_deal(){
  17. $weibo = $this->get_allege_list(0);
  18. $this->assign ( 'weibo', $weibo );
  19. $this->display ();
  20. }
  21. public function already_deal(){
  22. $weibo = $this->get_allege_list(1);
  23. $this->assign ( 'weibo', $weibo );
  24. $this->display ();
  25. }
  26. public function get_allege_list($status=''){
  27. $now=get_gmtime();
  28. $condition = "";
  29. if(intval($_REQUEST['id'])>0)
  30. {
  31. $condition .= " id =". intval($_REQUEST['id']);
  32. }
  33. if(intval($_REQUEST['user_id'])>0)
  34. {
  35. $condition .= " user_id =". intval($_REQUEST['user_id']);
  36. }
  37. if(intval($_REQUEST['weibo_id'])>0)
  38. {
  39. $condition .= " id =". intval($_REQUEST['weibo_id']);
  40. }
  41. if($status!==''){
  42. $condition .= " status =". intval($_REQUEST['status']);
  43. }
  44. $create_time_2=empty($_REQUEST['create_time_2'])?to_date($now,'Y-m-d'):strim($_REQUEST['create_time_2']);
  45. $create_time_2=to_timespan($create_time_2)+24*3600;
  46. if(trim($_REQUEST['create_time_1'])!='' )
  47. {
  48. $map[DB_PREFIX.'weibo.create_time'] = array('between',array(to_timespan($_REQUEST['create_time_1']),$create_time_2));
  49. $condition .= " create_time between (".to_timespan($_REQUEST['create_time_1']).",".$create_time_2." ) ";
  50. }
  51. $count = M('WeiboAllege')->where($condition)->count();
  52. $p = new Page($count, $listRows = 20);
  53. //举报类型
  54. $weibo = M('WeiboAllege')->where($condition)->order('id desc')->limit($p->firstRow . ',' . $p->listRows)->findAll();
  55. $page = $p->show();
  56. $this->assign("page", $page);
  57. return $weibo;
  58. }
  59. public function foreverdelete() {
  60. //彻底删除指定记录
  61. $ajax = intval($_REQUEST['ajax']);
  62. $id = $_REQUEST ['id'];
  63. if (isset ( $id )) {
  64. $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
  65. $rel_data = M('WeiboAllege')->where($condition)->findAll();
  66. foreach($rel_data as $data)
  67. {
  68. $info[] = $data['user_id'].'的动态'.$data['id'];
  69. }
  70. if($info) $info = implode(",",$info);
  71. $list = M('Weibo')->where ( $condition )->delete();
  72. //删除相关预览图
  73. // foreach($rel_data as $data)
  74. // {
  75. // @unlink(get_real_path().$data['preview']);
  76. // }
  77. if ($list!==false) {
  78. save_log($info.l("FOREVER_DELETE_SUCCESS"),1);
  79. clear_auto_cache("get_help_cache");
  80. $this->success (l("FOREVER_DELETE_SUCCESS"),$ajax);
  81. } else {
  82. save_log($info.l("FOREVER_DELETE_FAILED"),0);
  83. $this->error (l("FOREVER_DELETE_FAILED"),$ajax);
  84. }
  85. } else {
  86. $this->error (l("INVALID_OPERATION"),$ajax);
  87. }
  88. }
  89. }
  90. ?>