You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/payment.sql

132 lines
7.0 KiB
MySQL

1 year ago
CREATE TABLE `request_logs` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`request_id` varchar(22) not null COMMENT '请求ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`request_uri` varchar(255) not null COMMENT '请求URI',
`request_data` text default NULL COMMENT '请求内容',
`response_data` text default NULL COMMENT '响应内容',
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`response_time` datetime default NULL,
`third_request_data` text default NULL COMMENT '第三方请求内容',
`third_response_data` text default NULL COMMENT '第三方响应内容',
`third_request_time` datetime default NULL,
`third_response_time` datetime default NULL,
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单状态',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE,
UNIQUE KEY `udx_requestid` (`request_id`) USING BTREE,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
CREATE TABLE `users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
1 year ago
`member_id` varchar(32) not null default '',
`real_name` varchar(20) not null default '',
1 year ago
`card_no` varchar(32) not null default '',
`mobile` varchar(15) not null default '',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
1 year ago
KEY `idx_cardno` (`card_no`) USING BTREE,
1 year ago
KEY `idx_createdat` (`created_at`) USING BTREE,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
1 year ago
CREATE TABLE `bank_cards` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL COMMENT '用户编号',
`card_no` varchar(32) not null default '',
`real_name` varchar(20) not null default '',
`mobile` varchar(15) not null default '',
`bank_card_no` varchar(20) not null default '',
`bank_card_type` varchar(10) not null default '',
`sms_no` varchar(32) NOT NULL DEFAULT '',
`protocol` varchar(32) NOT NULL DEFAULT '',
1 year ago
`expired` varchar(4) NOT NULL DEFAULT '',
`cvn` varchar(10) NOT NULL DEFAULT '',
1 year ago
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `idx_mobile` (`mobile`) USING BTREE,
KEY `idx_bankcardno` (`bank_card_no`) USING BTREE,
KEY `idx_realname` (`real_name`) USING BTREE,
KEY `idx_cardno` (`card_no`) USING BTREE,
KEY `idx_smsno` (`sms_no`) USING BTREE,
KEY `idx_protocol` (`protocol`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='银行卡';
1 year ago
CREATE TABLE `orders` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`order_info` text default null COMMENT '商品信息',
`out_order_no` varchar(32) NOT NULL COMMENT '外部订单号',
`pay_order_no` varchar(32) NOT NULL DEFAULT '' COMMENT '支付订单号',
`channel_order_no` varchar(32) NOT NULL DEFAULT '' COMMENT '渠道上游订单号',
`amount` int NOT NULL DEFAULT '0' COMMENT '支付金额',
`fee` int NOT NULL DEFAULT '0' COMMENT '手续费',
`redirect_url` varchar(1024) NOT NULL DEFAULT '' COMMENT '跳转地址',
`notify_url` varchar(1024) NOT NULL DEFAULT '' COMMENT '通知地址',
`pay_url` varchar(1024) NOT NULL DEFAULT '' COMMENT '支付地址',
`token` varchar(32) NOT NULL DEFAULT '',
1 year ago
`protocol` varchar(32) NOT NULL DEFAULT '',
1 year ago
`payed_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '支付时间',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单状态',
`error_code` varchar(32) NOT NULL DEFAULT '' COMMENT '错误码',
`error_msg` varchar(255) NOT NULL DEFAULT '' COMMENT '错误信息',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `idx_outorderno` (`out_order_no`) USING BTREE,
KEY `idx_token` (`token`) USING BTREE,
KEY `idx_protocol` (`protocol`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='订单表';
CREATE TABLE `refund_orders` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`out_order_no` varchar(32) NOT NULL COMMENT '外部订单号',
`out_refund_order_no` varchar(32) NOT NULL COMMENT '外部退款订单号',
`order_amount` int NOT NULL DEFAULT '0' COMMENT '订单金额',
`refund_amount` int NOT NULL DEFAULT '0' COMMENT '退款金额',
`fee` int NOT NULL DEFAULT '0' COMMENT '手续费',
`notify_url` varchar(1024) NOT NULL DEFAULT '' COMMENT '通知地址',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
`refunded_at` datetime default NULL COMMENT '退款时间',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单状态',
`error_code` varchar(32) NOT NULL DEFAULT '' COMMENT '错误码',
`error_msg` varchar(255) NOT NULL DEFAULT '' COMMENT '错误信息',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1 year ago
KEY `idx_outrefundorderno` (`out_refund_order_no`) USING BTREE,
1 year ago
KEY `idx_createdat` (`created_at`) USING BTREE,
PRIMARY KEY (`id`) USING BTREE
1 year ago
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='退款订单表';
CREATE TABLE `pre_pay_logs` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`out_order_no` varchar(32) NOT NULL COMMENT '外部订单号',
`out_member_id` varchar(32) NOT NULL COMMENT '外部用户ID',
`redirect_url` varchar(1024) NOT NULL DEFAULT '' COMMENT '跳转地址',
`notify_url` varchar(1024) NOT NULL DEFAULT '' COMMENT '通知地址',
`token` varchar(32) NOT NULL DEFAULT '',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
KEY `idx_outorderno` (`out_order_no`) USING BTREE,
KEY `idx_token` (`token`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='预支付表';
alter table users add column `out_member_id` varchar(32) not null default '' after member_id;
1 year ago
alter table orders add column `out_member_id` varchar(32) not null default '' after member_id;
alter table orders add column `member_id` varchar(32) not null default '' after app_id;
alter table orders add column `order_no` varchar(32) not null default '' after app_id;