Complainsubject.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 数据层模型
  10. */
  11. class Complainsubject extends BaseModel
  12. {
  13. public $page_info;
  14. /**
  15. * 增加投诉主题
  16. * @access public
  17. * @author csdeshang
  18. * @param array $data 参数内容
  19. * @return bool
  20. */
  21. public function addComplainsubject($data)
  22. {
  23. return Db::name('complainsubject')->insertGetId($data);
  24. }
  25. /**
  26. * 更新
  27. * @access public
  28. * @author csdeshang
  29. * @param array $update_array 更新数据
  30. * @param array $condition 更新条件
  31. * @return bool
  32. */
  33. public function editComplainsubject($update_array, $condition)
  34. {
  35. return Db::name('complainsubject')->where($condition)->update($update_array);
  36. }
  37. /**
  38. * 删除投诉主题
  39. * @access public
  40. * @author csdeshang
  41. * @param array $condition 检索条件
  42. * @return bool
  43. */
  44. public function delComplainsubject($condition)
  45. {
  46. return Db::name('complainsubject')->where($condition)->delete();
  47. }
  48. /**
  49. * 获得投诉主题列表
  50. * @access public
  51. * @author csdeshang
  52. * @param array $condition 检索条件
  53. * @param int $pagesize 分页信息
  54. * @param str $order 排序
  55. * @return array
  56. */
  57. public function getComplainsubject($condition = '', $pagesize = '', $order = 'complainsubject_id desc')
  58. {
  59. if ($pagesize) {
  60. $res = Db::name('complainsubject')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  61. $this->page_info = $res;
  62. return $res->items();
  63. } else {
  64. return Db::name('complainsubject')->where($condition)->order($order)->select()->toArray();
  65. }
  66. }
  67. /**
  68. * 获得有效投诉主题列表
  69. * @access public
  70. * @author csdeshang
  71. * @param array $condition 检索条件
  72. * @param int $pagesize 分页信息
  73. * @param str $order 排序
  74. * @return array
  75. */
  76. public function getActiveComplainsubject($condition = '', $pagesize = '', $order = 'complainsubject_id desc ')
  77. {
  78. //搜索条件
  79. $condition[] = array('complainsubject_state', '=', 1);
  80. if ($pagesize) {
  81. $res = Db::name('complainsubject')->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
  82. $this->page_info = $res;
  83. return $res->items();
  84. } else {
  85. return Db::name('complainsubject')->where($condition)->order($order)->select()->toArray();
  86. }
  87. }
  88. }