12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- class Index extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
-
- public function index()
- {
-
- $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)
- ->whereRaw("((start_time = 0 and end_time = 0) or (start_time < {$now} and end_time > {$now}))")
- ->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);
- }
-
-
-
-
-
- }
|