<?php
namespace app\workerapi\lists;

use app\common\lists\ListsSearchInterface;
use app\common\model\training\TrainingCourse;
use app\common\model\training\TrainingWorkerCourse;
use DateTime;

/**
 * TrainingWorkerCourseLists列表
 * Class TrainingWorkerCourseLists
 * @package app\workerapi\listsworks
 */
class TrainingCourseLists extends BaseWorkerDataLists
{

    public function queryWhere(){
        $where = [];
        $where[] = ['course_lock','=',1];
        return $where;
    }
    /**
     * @notes 获取列表
     */
    public function lists(): array
    {
        return TrainingCourse::where($this->queryWhere())
            ->field('*')
            ->limit($this->limitOffset, $this->limitLength)
            ->order(['create_time' => 'desc'])
            ->select()
            ->toArray();
    }


    /**
     * @notes 获取数量
     * @return int
     * @author whitef
     * @date 2024/07/10 15:06
     */
    public function count(): int
    {
        return TrainingCourse::where($this->queryWhere())->count();
    }

}