OpinionAction.class.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 OpinionAction extends CommonAction{
  10. public function index()
  11. {
  12. parent::index();
  13. }
  14. public function show_content()
  15. {
  16. $id = intval($_REQUEST['id']);
  17. header("Content-Type:text/html; charset=utf-8");
  18. echo htmlspecialchars(M("DealMsgList")->where("id=".$id)->getField("content"));
  19. }
  20. public function content()
  21. {
  22. $id = intval($_REQUEST['id']);
  23. header("Content-Type:text/html; charset=utf-8");
  24. echo htmlspecialchars(M("Opinion")->where("id=".$id)->getField("content"));
  25. }
  26. public function foreverdelete() {
  27. //彻底删除指定记录
  28. $ajax = intval($_REQUEST['ajax']);
  29. $id = $_REQUEST ['id'];
  30. if (isset ( $id )) {
  31. $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
  32. $rel_data = M(MODULE_NAME)->where($condition)->findAll();
  33. foreach($rel_data as $data)
  34. {
  35. $info[] = $data['id'];
  36. }
  37. if($info) $info = implode(",",$info);
  38. $list = M(MODULE_NAME)->where ( $condition )->delete();
  39. if ($list!==false) {
  40. save_log($info.l("FOREVER_DELETE_SUCCESS"),1);
  41. $this->success (l("FOREVER_DELETE_SUCCESS"),$ajax);
  42. } else {
  43. save_log($info.l("FOREVER_DELETE_FAILED"),0);
  44. $this->error (l("FOREVER_DELETE_FAILED"),$ajax);
  45. }
  46. } else {
  47. $this->error (l("INVALID_OPERATION"),$ajax);
  48. }
  49. }
  50. public function delete() {
  51. //彻底删除指定记录
  52. $ajax = intval($_REQUEST['ajax']);
  53. $id = $_REQUEST ['id'];
  54. if (isset ( $id )) {
  55. $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
  56. $rel_data = M(MODULE_NAME)->where($condition)->count();
  57. $list = M(MODULE_NAME)->where ( $condition )->delete();
  58. if ($list!==false) {
  59. foreach($rel_data as $k=>$v)
  60. {
  61. if($v['log_id']==0)
  62. {
  63. $GLOBALS['db']->query("update ".DB_PREFIX."deal set comment_count = comment_count - 1 where id = ".$v['deal_id']);
  64. }
  65. }
  66. save_log($info."成功删除",1);
  67. $this->success ("成功删除",$ajax);
  68. } else {
  69. save_log($info."删除出错",0);
  70. $this->error ("删除出错",$ajax);
  71. }
  72. } else {
  73. $this->error (l("INVALID_OPERATION"),$ajax);
  74. }
  75. }
  76. }
  77. ?>