HouseOwnerLog.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\admin\controller;
  3. use think\App;
  4. class HouseOwnerLog extends Auth
  5. {
  6. public function __construct(App $app = null) {
  7. parent::__construct($app);
  8. $this->table= 'house_owner_log_view';
  9. }
  10. public function index(){
  11. if(request()->isAjax()){
  12. //分页参数
  13. $length = input('rows',10,'intval'); //每页条数
  14. $page = input('page',1,'intval'); //第几页
  15. $start = ($page - 1) * $length; //分页开始位置
  16. //排序
  17. $sortRow = input('sidx','id','trim'); //排序列
  18. $sort = input('sord','desc','trim'); //排序方式
  19. $order = $sortRow.' '.$sort;
  20. $name = input('name','','trim');
  21. if($name){
  22. $map[] = ['name','like','%'.$name.'%'];
  23. }
  24. $title = input('content','','trim');
  25. if($title){
  26. $map[] = ['content','like','%'.$title.'%'];
  27. }
  28. $enable = input('enable','','trim');
  29. if($enable != ''){
  30. $map[] = ['enable','=',$enable];
  31. }
  32. $map[] = ['org_id','=',$this->orgId];
  33. $map= empty($map) ? true: $map;
  34. //数据查询
  35. $lists = db($this->table)->where($map)->limit($start,$length)->order($order)->select();
  36. //数据返回
  37. $totalCount = db($this->table)->where($map)->count();
  38. $totalPage = ceil($totalCount/$length);
  39. $result['page'] = $page;
  40. $result['total'] = $totalPage;
  41. $result['records'] = $totalCount;
  42. $result['rows'] = $lists;
  43. return json($result);
  44. }else{
  45. $this->assign('m_name','业主变更记录');
  46. return $this->fetch();
  47. }
  48. }
  49. }