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

151 lines
6.5 KiB
MySQL

1 year ago
CREATE TABLE `users` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`contract_no` varchar(32) NOT NULL,
`realname_flag` char(1) NOT NULL DEFAULT 'N',
`bind_card_flag` char(1) NOT NULL DEFAULT 'N',
`set_pwd_flag` char(1) NOT NULL DEFAULT 'N',
`status` varchar(20) NOT NULL DEFAULT 'NORMAL',
`mobile` varchar(15) NOT NULL DEFAULT '',
`email` varchar(32) NOT NULL DEFAULT '',
`real_name` varchar(16) NOT NULL DEFAULT '',
`certificate_no` varchar(20) NOT NULL DEFAULT '',
`user_type` varchar(20) NOt NULL,
`apply_no` varchar(32) NOT NULL DEFAULT '',
1 year ago
`is_platform_account` tinyint(1) not null DEFAULT 0,
1 year ago
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE
1 year ago
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
1 year ago
CREATE TABLE `bank_cards` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`agreement_no` varchar(32) NOT NULL,
`last_card_no` varchar(4) NOT NULL DEFAULT '',
`card_user_name` varchar(16) NOT NULL DEFAULT '',
`bank_mobile` varchar(15) NOT NULL DEFAULT '',
`bank_code` varchar(10) NOT NULL DEFAULT '',
`bank_name` varchar(32) NOT NULL DEFAULT '',
`card_type` tinyint(1) NOT NULL DEFAULT '1',
`cnaps_code` varchar(16) NOT NULL DEFAULT '',
`public_flag` char(1) NOT NULL DEFAULT 'N',
`repayment_date` varchar(20) NOt NULL DEFAULT '',
`main_flag` char(1) NOT NULL DEFAULT 'N',
`status` varchar(16) NOT NULL DEFAULT '',
`ava_flag` varchar(10) NOT NULL DEFAULT '',
`remark` varchar(255) NOT NULL DEFAULT '',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE
1 year ago
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
CREATE TABLE `orders` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`order_no` varchar(32) NOT NULL,
`out_order_no` varchar(32) NOT NULL,
`amount` int(11) NOT NULL DEFAULT 0,
1 year ago
`pay_channel` varchar(20) NOT NULL,
`pay_method` varchar(20) NOT NULL,
`pay_type` varchar(20) NOT NULL,
1 year ago
`agreement_no` varchar(32) NOT NULL DEFAULT '',
`expired_at` datetime DEFAULT NULL,
1 year ago
`applied_at` datetime DEFAULT NULL,
1 year ago
`notify_url` varchar(255) NOT NULL DEFAULT '',
`return_url` varchar(255) NOT NULL DEFAULT '',
1 year ago
`pay_url` varchar(255) NOT NULL DEFAULT '',
1 year ago
`status` varchar(16) NOT NULL DEFAULT '',
1 year ago
`error_code` varchar(20) NOT NULL DEFAULT '',
`error_message` varchar(120) NOT NULL DEFAULT '',
`finished_at` datetime DEFAULT NULL,
`third_order_no` varchar(32) NOT NULL DEFAULT '',
`transaction_id` varchar(32) NOT NULL DEFAULT '',
`out_transaction_id` varchar(32) NOT NULL DEFAULT '',
1 year ago
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
CREATE TABLE `order_split_infos` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`split_member_id` varchar(32) NOT NULL,
`split_user_id` varchar(32) NOT NULL,
1 year ago
`split_user_type` varchar(20) NOT NULL,
1 year ago
`order_no` varchar(32) NOT NULL,
`out_order_no` varchar(32) NOT NULL,
`sub_order_no` varchar(32) NOT NULL,
`sub_out_order_no` varchar(32) NOT NULL,
`split_amount` int(11) NOT NULL DEFAULT 0,
`contract_no` varchar(32) NOT NULL,
`seller_flag` tinyint(1) NOT null DEFAULT 0,
`status` varchar(16) NOT NULL DEFAULT '',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
CREATE TABLE `refunds` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`order_no` varchar(32) NOT NULL,
`out_order_no` varchar(32) NOT NULL,
`refund_order_no` varchar(32) NOT NULL,
`refund_out_order_no` varchar(32) NOT NULL,
`refund_amount` int(11) NOT NULL DEFAULT 0,
`refund_reason` varchar(255) NOT NULL DEFAULT '',
`refund_type` varchar(16) NOT NULL DEFAULT '',
`remark` varchar(255) NOT NULL DEFAULT '',
`notify_url` varchar(255) NOT NULL DEFAULT '',
`status` varchar(16) NOT NULL DEFAULT '',
`finished_at` datetime DEFAULT NULL,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
CREATE TABLE `refund_split_infos` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
`app_id` varchar(16) NOT NULL COMMENT '应用ID',
`member_id` varchar(32) NOT NULL,
`user_id` varchar(32) NOT NULL,
`split_member_id` varchar(32) NOT NULL,
`split_user_id` varchar(32) NOT NULL,
`order_no` varchar(32) NOT NULL,
`out_order_no` varchar(32) NOT NULL,
`sub_order_no` varchar(32) NOT NULL,
`sub_out_order_no` varchar(32) NOT NULL,
`refund_amount` int(11) NOT NULL DEFAULT 0,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_appid` (`app_id`) USING BTREE,
KEY `idx_memberid` (`member_id`) USING BTREE,
KEY `idx_createdat` (`created_at`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;