|
@@ -37,14 +37,19 @@ class Index extends Api |
|
@@ -37,14 +37,19 @@ class Index extends Api |
37
|
"id": 3, //ID
|
37
|
"id": 3, //ID
|
38
|
"name": "", //考试名称
|
38
|
"name": "", //考试名称
|
39
|
"nickname": "", //昵称
|
39
|
"nickname": "", //昵称
|
40
|
- "countdown": 26 //考试倒计时
|
40
|
+ "countdown": 26 //距离考试倒计时天数
|
41
|
}],
|
41
|
}],
|
42
|
"banner_list": [{ //轮播图列表
|
42
|
"banner_list": [{ //轮播图列表
|
43
|
"id": 1, //ID
|
43
|
"id": 1, //ID
|
44
|
"image": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png", //图片地址
|
44
|
"image": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png", //图片地址
|
45
|
"link": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png" //链接地址
|
45
|
"link": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png" //链接地址
|
46
|
}],
|
46
|
}],
|
47
|
- "countdown": 26, //距离考试倒计时天数
|
47
|
+ "exam": {
|
|
|
48
|
+ "id": 3, //ID
|
|
|
49
|
+ "name": "", //考试名称
|
|
|
50
|
+ "nickname": "", //昵称
|
|
|
51
|
+ "countdown": 26 //距离考试倒计时天数
|
|
|
52
|
+ },
|
48
|
"news_list": [{ //报考资讯列表
|
53
|
"news_list": [{ //报考资讯列表
|
49
|
"id": 1, //资讯ID
|
54
|
"id": 1, //资讯ID
|
50
|
"cover": "", //封面图
|
55
|
"cover": "", //封面图
|
|
@@ -70,18 +75,19 @@ class Index extends Api |
|
@@ -70,18 +75,19 @@ class Index extends Api |
70
|
$exam = $exam_list[0];
|
75
|
$exam = $exam_list[0];
|
71
|
}else{
|
76
|
}else{
|
72
|
$exam_list = [];
|
77
|
$exam_list = [];
|
73
|
- $exam = Exam::order('exam_time asc')->find();
|
78
|
+ $exam = Exam::field('id,name,nickname,exam_time')
|
|
|
79
|
+ ->order('exam_time asc')
|
|
|
80
|
+ ->find();
|
|
|
81
|
+ $exam['countdown'] = ceil(($exam['exam_time']-time())/86400);
|
74
|
}
|
82
|
}
|
75
|
// 轮播图
|
83
|
// 轮播图
|
76
|
$banner_list = IndexBanner::order('createtime desc')->field('id,image,url')->select();
|
84
|
$banner_list = IndexBanner::order('createtime desc')->field('id,image,url')->select();
|
77
|
- // 距离考试倒计时天数
|
|
|
78
|
- $countdown = ceil(($exam['exam_time']-time())/86400);
|
|
|
79
|
// 报考资讯
|
85
|
// 报考资讯
|
80
|
$news_list = News::order('createtime desc')->select();
|
86
|
$news_list = News::order('createtime desc')->select();
|
81
|
foreach ($news_list as $value) {
|
87
|
foreach ($news_list as $value) {
|
82
|
$value->visible(['id','cover','title','read_num','createtime']);
|
88
|
$value->visible(['id','cover','title','read_num','createtime']);
|
83
|
}
|
89
|
}
|
84
|
- $this->success('成功',compact('exam_list','banner_list','countdown','news_list'));
|
90
|
+ $this->success('成功',compact('exam_list','banner_list','exam','news_list'));
|
85
|
}
|
91
|
}
|
86
|
|
92
|
|
87
|
/**
|
93
|
/**
|