Informsubject.php 2.2 KB

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