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 ;