SectionModel.php 886 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\models\section;
  3. use think\facade\Db;
  4. use crmeb\traits\ModelTrait;
  5. use crmeb\basic\BaseModel;
  6. class SectionModel extends BaseModel
  7. {
  8. /**
  9. * 数据表主键
  10. * @var string
  11. */
  12. protected $pk = 'id';
  13. /**
  14. * 模型名称
  15. * @var string
  16. */
  17. protected $name = 'section';
  18. use ModelTrait;
  19. public static function systemPage($where)
  20. {
  21. $model = new self;
  22. if ($where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
  23. if ($where['status'] !== '') $model = $model->where('status', $where['status']);
  24. $model = $model->where('is_del', 0);
  25. $model = $model->order('sort desc,id desc');
  26. $count = $model->count();
  27. $list = $model->page((int)$where['page'], (int)$where['limit'])->select()->toArray();
  28. return compact('count', 'list');
  29. }
  30. }