|
|
@@ -31,6 +31,31 @@ class FilmRepository extends BaseRepository
|
|
31
|
31
|
}
|
|
32
|
32
|
|
|
33
|
33
|
/**
|
|
|
34
|
+ * 根据开始、结束日期获取影片
|
|
|
35
|
+ *
|
|
|
36
|
+ * @param $page
|
|
|
37
|
+ * @param $limit
|
|
|
38
|
+ * @param $startDate
|
|
|
39
|
+ * @param $endDate
|
|
|
40
|
+ * @param $with
|
|
|
41
|
+ * @return array
|
|
|
42
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
43
|
+ * @throws \think\db\exception\DbException
|
|
|
44
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
45
|
+ */
|
|
|
46
|
+ public function getFilmByStartEndDate($page, $limit, $startDate, $endDate, $with = [])
|
|
|
47
|
+ {
|
|
|
48
|
+ $field = 'film_sign,film_name,publish_date,language,type,duration,version,cover_img,grade,hots,director,actors';
|
|
|
49
|
+ $where = [['publish_date', '<=', $endDate], ['publish_date', '>', $startDate]];
|
|
|
50
|
+
|
|
|
51
|
+ return $this->dao->where($where)->when($with, function ($query) use ($with) {
|
|
|
52
|
+ $query->with($with);
|
|
|
53
|
+ })->when($page && $limit, function ($query) use ($page, $limit) {
|
|
|
54
|
+ $query->page($page, $limit);
|
|
|
55
|
+ })->field([$field])->order('hots desc')->select()->toArray();
|
|
|
56
|
+ }
|
|
|
57
|
+
|
|
|
58
|
+ /**
|
|
34
|
59
|
* @param $page
|
|
35
|
60
|
* @param $limit
|
|
36
|
61
|
* @param $type
|