Plantask.php 731 B

123456789101112131415161718192021222324252627282930313233343536
  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. 'limit_time' => ['gt',0],
  13. 'last_time' => ['lt',time()]
  14. ];
  15. $update = [
  16. 'score' => 0,
  17. 'is_pass' => 0,
  18. // 'grade_time' => 'limit_time',
  19. 'date' => date('Y-m-d'),
  20. 'updatetime' => $nowtime,
  21. 'status' => 2,
  22. 'finish_time' => $nowtime,
  23. ];
  24. $rs = Db::name('exam_grade')->where($map)->update($update);
  25. }
  26. }