<?php

namespace app\index\controller;

use think\Controller;
use think\Db;

class Plantask extends Controller
{

    //考试限时 且到交卷时间了，自动结束，0分
    public function auto_grade_finish(){

        $nowtime = time();
        $map = [
            'status' => 1,
            'limit_time' => ['gt',0],
            'last_time' => ['lt',time()]
        ];
        $update = [
            'score' => 0,
            'is_pass' => 0,
//            'grade_time' => 'limit_time',
            'date' => date('Y-m-d'),

            'updatetime' => $nowtime,
            'status' => 2,
            'finish_time' => $nowtime,
        ];
        $rs = Db::name('exam_grade')->where($map)->update($update);
    }




}
