Complainsubject.php 3.0 KB

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