CREATE TABLE `mta_pay` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `pid` varchar(255) NOT NULL COMMENT '支付号', `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付类型(1支付宝/2微信)', `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付状态(1未支付/2已支付)', `money` int(11) NOT NULL DEFAULT '0' COMMENT '支付金额(分)', `title` varchar(255) DEFAULT NULL COMMENT '商品描述(第三方平台显示)', `flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付成功标记(1异步通知/2同步回调/3主动查询/4对账)', `ptime` datetime DEFAULT NULL COMMENT '支付时间', `ctime` datetime DEFAULT NULL COMMENT '创建时间', `utime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`), UNIQUE KEY `pid` (`pid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- 以下表弃用 CREATE TABLE `mta_pay_app` ( `app_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `app_key` varchar(255) NOT NULL COMMENT '业务唯一标识', `app_name` varchar(255) NOT NULL COMMENT '业务名称, 在第三方支付页面显示', `notify_url` varchar(255) DEFAULT NULL COMMENT '支付成功后异步通知地址(post/可选)', `return_url` varchar(255) DEFAULT NULL COMMENT '支付成功后同步回调地址(get/可选)', `debug` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否测试状态(测试中支付金额为1分)', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`app_id`), UNIQUE KEY `app_key` (`app_key`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `mta_pay_item` ( `pay_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `pay_num` varchar(255) NOT NULL COMMENT '支付号', `pay_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付状态(1未支付/2已支付)', `pay_money` int(11) NOT NULL DEFAULT '0' COMMENT '支付金额(分)', `pay_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付类型(1支付宝/2微信)', `pay_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '支付成功标记(1异步通知/2同步回调/3主动查询/4对账)', `trade_num` varchar(255) DEFAULT NULL COMMENT '第三方交易号(由第三方通知返回)', `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单ID', `pay_time` datetime DEFAULT NULL COMMENT '支付时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`pay_id`), UNIQUE KEY `pay_num` (`pay_num`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE `mta_pay_order` ( `order_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID', `order_num` varchar(255) NOT NULL COMMENT '订单号', `order_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '订单状态(1待付款/2已付款)', `order_money` int(11) NOT NULL DEFAULT '0' COMMENT '订单金额(分)', `order_title` varchar(255) DEFAULT NULL COMMENT '订单标题', `app_id` int(11) NOT NULL DEFAULT '0' COMMENT '业务ID', `pay_time` datetime DEFAULT NULL COMMENT '支付时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`order_id`), UNIQUE KEY `order_num` (`order_num`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;