作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

选择参加的考试

@@ -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 /**
@@ -521,14 +521,19 @@ @@ -521,14 +521,19 @@
521 "id": 3, //ID 521 "id": 3, //ID
522 "name": "", //考试名称 522 "name": "", //考试名称
523 "nickname": "", //昵称 523 "nickname": "", //昵称
524 - "countdown": 26 //考试倒计时 524 + "countdown": 26 //距离考试倒计时天数
525 }], 525 }],
526 "banner_list": [{ //轮播图列表 526 "banner_list": [{ //轮播图列表
527 "id": 1, //ID 527 "id": 1, //ID
528 "image": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png", //图片地址 528 "image": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png", //图片地址
529 "link": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png" //链接地址 529 "link": "https://img02.mockplus.cn/idoc/sketch/2020-08-06/006324c3-e5d3-4206-be48-52a7c7468e74.7C1FC40C-CED5-4B08-9506-3E48A2732B2C.png" //链接地址
530 }], 530 }],
531 - "countdown": 26, //距离考试倒计时天数 531 + "exam": {
  532 + "id": 3, //ID
  533 + "name": "", //考试名称
  534 + "nickname": "", //昵称
  535 + "countdown": 26 //距离考试倒计时天数
  536 + },
532 "news_list": [{ //报考资讯列表 537 "news_list": [{ //报考资讯列表
533 "id": 1, //资讯ID 538 "id": 1, //资讯ID
534 "cover": "", //封面图 539 "cover": "", //封面图
@@ -15313,7 +15318,7 @@ @@ -15313,7 +15318,7 @@
15313 15318
15314 <div class="row mt0 footer"> 15319 <div class="row mt0 footer">
15315 <div class="col-md-6" align="left"> 15320 <div class="col-md-6" align="left">
15316 - Generated on 2020-09-22 17:43:15 </div> 15321 + Generated on 2020-09-22 17:59:05 </div>
15317 <div class="col-md-6" align="right"> 15322 <div class="col-md-6" align="right">
15318 <a href="./" target="_blank">企智帮</a> 15323 <a href="./" target="_blank">企智帮</a>
15319 </div> 15324 </div>