TrainingCourseLists.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\lists\ListsSearchInterface;
  4. use app\common\model\training\TrainingCourse;
  5. use app\common\model\training\TrainingWorkerCourse;
  6. use DateTime;
  7. /**
  8. * TrainingWorkerCourseLists列表
  9. * Class TrainingWorkerCourseLists
  10. * @package app\workerapi\listsworks
  11. */
  12. class TrainingCourseLists extends BaseWorkerDataLists
  13. {
  14. public function queryWhere(){
  15. $where = [];
  16. $where[] = ['course_lock','=',1];
  17. return $where;
  18. }
  19. /**
  20. * @notes 获取列表
  21. */
  22. public function lists(): array
  23. {
  24. return TrainingCourse::where($this->queryWhere())
  25. ->field('*')
  26. ->limit($this->limitOffset, $this->limitLength)
  27. ->order(['create_time' => 'desc'])
  28. ->select()
  29. ->toArray();
  30. }
  31. /**
  32. * @notes 获取数量
  33. * @return int
  34. * @author whitef
  35. * @date 2024/07/10 15:06
  36. */
  37. public function count(): int
  38. {
  39. return TrainingCourse::where($this->queryWhere())->count();
  40. }
  41. }