|
@@ -3,7 +3,7 @@
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
-
|
|
|
+use think\Db;
|
|
|
/**
|
|
|
* 首页接口
|
|
|
*/
|
|
@@ -18,6 +18,20 @@ class Index extends Api
|
|
|
*/
|
|
|
public function index()
|
|
|
{
|
|
|
- $this->success('请求成功');
|
|
|
+ //热门试卷列表
|
|
|
+ $now = time();
|
|
|
+ $papers = Db::name('exam_paper')->field('id,image,title,start_time,end_time,total_score,limit_time')
|
|
|
+ ->where('status', 'NORMAL')
|
|
|
+ ->where('index_status', 1)
|
|
|
+ ->limit(3)
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ foreach($papers as $key => &$val){
|
|
|
+ $val['image'] = localpath_to_netpath($val['image']);
|
|
|
+ $val['limit_time'] = $val['limit_time']/60; //秒转换分种
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('', $papers);
|
|
|
}
|
|
|
+
|
|
|
}
|