<?php

namespace app\models\section;

use think\facade\Db;
use crmeb\traits\ModelTrait;
use crmeb\basic\BaseModel;

class SectionModel extends BaseModel
{
	/**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $name = 'section';

    use ModelTrait;

    public static function systemPage($where)
    {
        $model = new self;
        if ($where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
        if ($where['status'] !== '') $model = $model->where('status', $where['status']);
        $model = $model->where('is_del', 0);
        $model = $model->order('sort desc,id desc');
        $count = $model->count();
        $list = $model->page((int)$where['page'], (int)$where['limit'])->select()->toArray();
        return compact('count', 'list');
    }

}