Browse Source

[修改]增加定时任务

liying 7 years ago
parent
commit
4e624fecb1
1 changed files with 13 additions and 0 deletions
  1. 13 0
      sql/cinema.sql

+ 13 - 0
sql/cinema.sql

@@ -357,3 +357,16 @@ UNLOCK TABLES;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 -- Dump completed on 2019-04-24 21:20:52
+
+-- 定时任务
+show variables like '%sche%';
+set global event_scheduler =1;
+CREATE PROCEDURE cancel ()
+  update ticket SET  state =2 WHERE minute(timediff(now(),time))>15 and state=0;
+create event if not exists e_cancel
+  on schedule every 30 second
+  on completion preserve
+do call cancel();
+
+alter event e_cancel ON
+COMPLETION PRESERVE ENABLE;