Complainsubject.php 3.1 KB

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