
-- --------------------------------------------------------

--
-- 表的结构 `zjr_rebate_coin_trans`
--

CREATE TABLE `zjr_rebate_coin_trans` (
  `TransId` bigint(20) UNSIGNED NOT NULL,
  `OkFlag` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0',
  `UserId` bigint(13) UNSIGNED NOT NULL,
  `TransTmk` datetime NOT NULL,
  `TransAmt` bigint(20) NOT NULL,
  `TransCat` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `RefId` bigint(20) UNSIGNED NOT NULL,
  `TransMemo` varchar(50) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='返现交易记录';

--
-- 触发器 `zjr_rebate_coin_trans`
--
DELIMITER $$
CREATE TRIGGER `update_rebate_coin` AFTER INSERT ON `zjr_rebate_coin_trans` FOR EACH ROW begin
 update zjr_coin_balance set RebateBal=RebateBal+new.TransAmt where UserId=new.UserId;
end
$$
DELIMITER ;
