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

139 lines
6.0 KiB
SQL

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 '',
`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 `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
) 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,
`pay_type` varchar(10) NOT NULL,
`agreement_no` varchar(32) NOT NULL DEFAULT '',
`expired_at` datetime DEFAULT NULL,
`notify_url` varchar(255) NOT NULL DEFAULT '',
`return_url` varchar(255) NOT NULL DEFAULT '',
`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 `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,
`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;