Informsubject.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 数据层模型
  13. */
  14. class Informsubject 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 addInformsubject($data)
  25. {
  26. return Db::name('informsubject')->insertGetId($data);
  27. }
  28. /**
  29. * 更新
  30. * @access public
  31. * @author csdeshang
  32. * @param array $update_array 数据
  33. * @param array $where_array 条件
  34. * @return bool
  35. */
  36. public function editInformsubject($update_array, $where_array)
  37. {
  38. return Db::name('informsubject')->where($where_array)->update($update_array);
  39. }
  40. /**
  41. * 删除
  42. * @access public
  43. * @author csdeshang
  44. * @param array $condition 条件
  45. * @return bool
  46. */
  47. public function delInformsubject($condition)
  48. {
  49. return Db::name('informsubject')->where($condition)->delete();
  50. }
  51. /**
  52. * 获得列表
  53. * @access public
  54. * @author csdeshang
  55. * @param array $condition 查询条件
  56. * @param int $pagesize 分页
  57. * @param string $field 字段
  58. * @param string $order 排序
  59. * @return array
  60. */
  61. public function getInformsubjectList($condition = '', $pagesize = '', $field = '', $order = 'informsubject_id asc')
  62. {
  63. if ($pagesize) {
  64. $res = Db::name('informsubject')->field($field)->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('informsubject')->field($field)->where($condition)->order($order)->select()->toArray();
  69. }
  70. }
  71. /**
  72. * 获取单个信息
  73. * @access public
  74. * @author csdeshang
  75. * @param type $condition 查询条件
  76. * @return type
  77. */
  78. public function getOneInformsubject($condition)
  79. {
  80. return Db::name('informsubject')->where($condition)->find();
  81. }
  82. }