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

--
-- 表的结构 `zjr_promo_coin_trans`
--

CREATE TABLE `zjr_promo_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_promo_coin_trans`
--

INSERT INTO `zjr_promo_coin_trans` (`TransId`, `OkFlag`, `UserId`, `TransTmk`, `TransAmt`, `TransCat`, `RefId`, `TransMemo`) VALUES
(1, '0', 4308211020301, '2015-12-01 19:09:52', 10, '43', 0, '邀请好友系统奖励'),
(2, '0', 4308211020301, '2015-12-01 19:09:55', 10, '43', 0, '邀请好友系统奖励'),
(3, '0', 4308211020302, '2015-12-01 19:13:00', 10, '43', 0, '邀请好友系统奖励'),
(4, '0', 4308211020302, '2015-12-01 19:13:04', 10, '43', 0, '邀请好友系统奖励'),
(5, '0', 4308211020302, '2015-12-01 19:13:07', 10, '43', 0, '邀请好友系统奖励'),
(6, '0', 4308211020302, '2015-12-01 19:13:10', 10, '43', 0, '邀请好友系统奖励'),
(7, '0', 4308211020302, '2015-12-02 14:54:40', -40, '38', 8, '赠送给蔡小严'),
(8, '0', 4308211020305, '2015-12-02 14:54:40', 40, '38', 7, '由蔡太阳赠送'),
(9, '0', 4308211020325, '2016-01-11 15:52:51', 10, '43', 0, '邀请好友系统奖励'),
(10, '0', 4308211020330, '2016-01-11 21:34:17', 10, '43', 0, '邀请好友系统奖励'),
(11, '0', 4308211020330, '2016-01-11 21:34:33', 10, '43', 0, '邀请好友系统奖励'),
(12, '0', 4308211020327, '2016-01-11 23:47:13', 10, '43', 0, '邀请好友系统奖励'),
(13, '0', 4308211020327, '2016-01-11 23:47:37', 10, '43', 0, '邀请好友系统奖励'),
(14, '0', 4308211020327, '2016-01-11 23:47:41', 10, '43', 0, '邀请好友系统奖励'),
(15, '0', 4308211020327, '2016-01-11 23:48:04', 10, '43', 0, '邀请好友系统奖励'),
(18, '0', 4308211020327, '2016-01-16 05:37:05', 10, '43', 0, '邀请好友系统奖励'),
(19, '0', 4308211020327, '2016-01-16 05:37:06', 10, '43', 0, '邀请好友系统奖励'),
(20, '0', 4308211020327, '2016-01-16 05:37:22', 10, '43', 0, '邀请好友系统奖励'),
(21, '0', 4308211020327, '2016-01-16 05:37:23', 10, '43', 0, '邀请好友系统奖励'),
(22, '0', 4308211020327, '2016-01-16 05:37:42', 10, '43', 0, '邀请好友系统奖励'),
(23, '0', 4308211020327, '2016-01-16 05:37:42', 10, '43', 0, '邀请好友系统奖励'),
(24, '0', 4308211020327, '2016-01-16 05:38:14', 10, '43', 0, '邀请好友系统奖励'),
(25, '0', 4308211020327, '2016-01-16 05:38:15', 10, '43', 0, '邀请好友系统奖励'),
(26, '0', 4308211020327, '2016-01-16 05:38:19', 10, '43', 0, '邀请好友系统奖励'),
(27, '0', 4308211020327, '2016-01-16 05:38:20', 10, '43', 0, '邀请好友系统奖励'),
(28, '0', 4308211020363, '2016-03-10 15:04:24', 0, '43', 0, '邀请好友系统奖励');

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