Plantask.php 677 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\index\controller;
  3. use think\Controller;
  4. use think\Db;
  5. class Plantask extends Controller
  6. {
  7. //考试到时间了,自动结束,0分
  8. public function auto_grade_finish(){
  9. $nowtime = time();
  10. $map = [
  11. 'status' => 1,
  12. 'last_time' => ['lt',time()]
  13. ];
  14. $update = [
  15. 'score' => 0,
  16. 'is_pass' => 0,
  17. // 'grade_time' => 'limit_time',
  18. 'date' => date('Y-m-d'),
  19. 'updatetime' => $nowtime,
  20. 'status' => 2,
  21. 'finish_time' => $nowtime,
  22. ];
  23. $rs = Db::name('exam_grade')->where($map)->update($update);
  24. }
  25. }