Explorar o código

[修改]增加定时任务

liying %!s(int64=7) %!d(string=hai) anos
pai
achega
4e624fecb1
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      sql/cinema.sql

+ 13 - 0
sql/cinema.sql

@@ -357,3 +357,16 @@ UNLOCK TABLES;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 
 -- Dump completed on 2019-04-24 21:20:52
 -- 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;