


CREATE TABLE IF NOT EXISTS `wp_vk_orders` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `order_no` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '订单号',
  `uid` int(10) UNSIGNED NOT NULL COMMENT '会员',
  `pid` int(10) UNSIGNED NOT NULL COMMENT '套餐id',
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0未处理1处理中10已处理',
  `pay_status` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '状态0未支付,1支付',
  `trade_sn` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '交易id',
  `created` datetime NOT NULL COMMENT '创建时间',
  `expired` datetime NOT NULL COMMENT '订单支付有效时间',
  `pay_at` datetime DEFAULT NULL COMMENT '支付时间',
  `price` float(10,2) NOT NULL DEFAULT '0.00' COMMENT '价格',
  `money` decimal(8,2) NOT NULL COMMENT '金额',
  `trade_money` float(8,2) NOT NULL COMMENT '交易金额',
  `u_del` tinyint(4) NOT NULL DEFAULT '0' COMMENT '用户删除',
  `pay_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '支付方式1支付宝2微信',
  `name` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `use_coupon` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
  `memo` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `order_no` (`order_no`),
  KEY `uid` (`uid`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单';


-- row split --


CREATE TABLE IF NOT EXISTS `wp_vk_trade_log` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `oid` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `order_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '订单号',
  `trade_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易流水号',
  `trade_status` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易状态',
  `type` tinyint(3) UNSIGNED NOT NULL COMMENT '类型1收款码2第三方10官方',
  `pay_type` tinyint(3) UNSIGNED NOT NULL DEFAULT '1' COMMENT '支付方式1支付宝2微信',
  `buyer_id` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付者id',
  `total_amount` float(10,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额',
  `gmt_payment` datetime DEFAULT NULL COMMENT '支付时间',
  `created` datetime DEFAULT NULL COMMENT '创建时间',
  `memo` text COLLATE utf8mb4_unicode_ci,
  PRIMARY KEY (`id`),
  KEY `order_no` (`order_no`),
  KEY `trade_status` (`trade_status`),
  KEY `oid` (`oid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='交易日志';



