Informsubject.php 2.6 KB

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