Mysql建立触发器
DELIMITER $$ CREATE /*!50017 DEFINER = 'root'@'%' */ TRIGGER `AddTransferAccountLog` AFTER INSERT ON `user_transfer_account_log` FOR EACH ROW IF new.orderid IS NOT NULL THEN UPDATE account SET money=money+new.money WHERE id=new.aid; INSERT INTO `msgs` (`id`, `type`, `title`, `content`, `level`, `markread`, `notify`, `byer`, `toer`, `create_at`) VALUES (NULL, 1, '账户充值成功', CONCAT('恭喜您,已成功充值',new.money,'元'), 1, 0, 0, 0, new.aid, NOW()); END IF; $$ DELIMITER ;
posted on 2018-02-01 17:10 loveking_阳 阅读(128) 评论(0) 编辑 收藏 举报