//禁用7天时间到后,自动解封
DELIMITER ;;
CREATE PROCEDURE `changestatus`()
BEGIN
update users as u set u.status=0 where u.status=2 and TIMESTAMPDIFF(minute,u.locktime,NOW())>167;
END
;;
DELIMITER ;
DELIMITER ;;
CREATE EVENT `changestatus` ON SCHEDULE EVERY 1 hour STARTS '2017-01-09 11:50:13' ON COMPLETION NOT PRESERVE ENABLE DO call changestatus()
;;
DELIMITER ;
//禁用30天时间到后,自动解封
DELIMITER ;;
CREATE PROCEDURE `changestatustwo`()
BEGIN
update users as u set u.status=0 where u.status=3 and TIMESTAMPDIFF(minute,u.locktime,NOW())>719;
END
;;
DELIMITER ;
DELIMITER ;;
CREATE EVENT `changestatustwo` ON SCHEDULE EVERY 1 hour STARTS '2017-01-09 11:50:13' ON COMPLETION NOT PRESERVE ENABLE DO call changestatustwo()
;;
DELIMITER ;;
CREATE PROCEDURE `changestatus`()
BEGIN
update users as u set u.status=0 where u.status=2 and TIMESTAMPDIFF(minute,u.locktime,NOW())>167;
END
;;
DELIMITER ;
DELIMITER ;;
CREATE EVENT `changestatus` ON SCHEDULE EVERY 1 hour STARTS '2017-01-09 11:50:13' ON COMPLETION NOT PRESERVE ENABLE DO call changestatus()
;;
DELIMITER ;
//禁用30天时间到后,自动解封
DELIMITER ;;
CREATE PROCEDURE `changestatustwo`()
BEGIN
update users as u set u.status=0 where u.status=3 and TIMESTAMPDIFF(minute,u.locktime,NOW())>719;
END
;;
DELIMITER ;
DELIMITER ;;
CREATE EVENT `changestatustwo` ON SCHEDULE EVERY 1 hour STARTS '2017-01-09 11:50:13' ON COMPLETION NOT PRESERVE ENABLE DO call changestatustwo()
;;
DELIMITER ;
my.ini or my.cnf 中的
[mysqld]
添加 event_scheduler=ON