分页
一个例子
public static function getList($advertiser_id,$type=0,$page=1,$is_read='all')
{
    if (!empty($advertiser_id))
    {
        $where['advertiser_id'] = $advertiser_id;
    }else{
        return [];
    }
    if (!empty($type))
    {
        $where['type'] = $type;
    }
    if ($is_read != 'all')
    {
        $where['is_read'] = $is_read;
    }
    
    $query = self::find()->where($where);
    $count = $query->count();
    // 使用总数来创建一个分页对象
    $pagination = new Pagination(['totalCount' => $count]);
    
    //大于页总数的时候返回 空的值
    $pagination->validatePage=false;
    // 使用分页对象来填充 limit 子句并取得文章数据
    $list = $query->offset($pagination->offset)->limit($pagination->limit)->select('id,title,description,type,create_data,is_read')->asArray()->all();
    $type_name = [ 0=>'',1=>'财务消息', 2=>'审核通知', 3=>'预算通知',4=>'功能上线', 5=>'反馈消息', 6=>'公告通知'];
    foreach ($list as &$vo)
    {
        $vo['type_name'] = empty($type_name[$vo['type']]) ? '' : $type_name[$vo['type']];
    }
    $data['total_count'] = $pagination->totalCount;
    $data['page_size'] = $pagination->defaultPageSize;
    $data['page_count'] = ceil($pagination->totalCount/$pagination->defaultPageSize);
    $data['list'] = $list;
    return $data;
}
大于页总数的时候返回 空的值
$pagination->validatePage=false;