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.
212 lines
9.6 KiB
SQL
212 lines
9.6 KiB
SQL
CREATE TABLE `merchants` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
|
`username` varchar(32) NOT NULL COMMENT '用户名',
|
|
`password` varchar(64) NOT NULL COMMENT '密码',
|
|
`email` varchar(32) NOT NULL DEFAULT '' COMMENT '用户邮箱',
|
|
`mobile` varchar(16) NOT NULL DEFAULT '' COMMENT '用户手机',
|
|
`register_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '注册时间',
|
|
`register_ip` varchar(15) NOT NULL DEFAULT '' COMMENT '注册IP',
|
|
`last_login_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后登录时间',
|
|
`last_login_ip` varchar(15) NOT NULL DEFAULT '' COMMENT '最后登录IP',
|
|
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '用户状态',
|
|
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
UNIQUE KEY `username` (`username`) USING BTREE
|
|
) ENGINE=InnoDB COMMENT='用户表';
|
|
|
|
CREATE TABLE `apps` (
|
|
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
`app_id` varchar(16) NOT NULL COMMENT 'appId',
|
|
`app_key` varchar(32) NOT NULL COMMENT 'appKey',
|
|
`app_name` varchar(64) NOT NULL COMMENT '应用名称',
|
|
`merchant_id` int NOT NULL COMMENT '商户ID',
|
|
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
|
|
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
UNIQUE KEY `udx_appid` (`app_id`) USING BTREE
|
|
) ENGINE=InnoDB COMMENT='应用表';
|
|
|
|
CREATE TABLE `request_logs` (
|
|
`id` bigint 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_token` varchar(32) NOT NULL COMMENT 'Token',
|
|
`request_data` text COMMENT '请求内容',
|
|
`response_data` text COMMENT '响应内容',
|
|
`request_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`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,
|
|
PRIMARY KEY (`id`) USING BTREE,
|
|
UNIQUE KEY `udx_requestid` (`request_id`) USING BTREE,
|
|
UNIQUE KEY `udx_requesttoken` (`request_token`) USING BTREE,
|
|
KEY `idx_appid` (`app_id`) USING BTREE,
|
|
KEY `idx_createdat` (`created_at`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC;
|
|
|
|
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 '',
|
|
`is_platform_account` tinyint(1) 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,
|
|
UNIQUE KEY `udx_memberid` (`member_id`) USING BTREE,
|
|
UNIQUE KEY `udx_userid_appid` (`user_id`, `app_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,
|
|
UNIQUE KEY `udx_agreementno` (`agreement_no`) 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_channel` varchar(20) NOT NULL,
|
|
`pay_method` varchar(20) NOT NULL,
|
|
`pay_type` varchar(20) NOT NULL,
|
|
`agreement_no` varchar(32) NOT NULL DEFAULT '',
|
|
`expired_at` datetime DEFAULT NULL,
|
|
`applied_at` datetime DEFAULT NULL,
|
|
`notify_url` varchar(255) NOT NULL DEFAULT '',
|
|
`return_url` varchar(255) NOT NULL DEFAULT '',
|
|
`org_split_info_list` varchar(512) NOT NULL DEFAULT '',
|
|
`pay_url` varchar(255) NOT NULL DEFAULT '',
|
|
`status` varchar(16) NOT NULL DEFAULT '',
|
|
`error_code` varchar(64) 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 '',
|
|
`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,
|
|
`split_user_type` varchar(20) 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_no` varchar(32) NOT NULL,
|
|
`out_refund_no` varchar(32) NOT NULL,
|
|
`third_refund_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 '',
|
|
`real_refund_amount` int(11) NOT NULL DEFAULT 0,
|
|
`remark` varchar(255) NOT NULL DEFAULT '',
|
|
`notify_url` varchar(255) NOT NULL DEFAULT '',
|
|
`org_refund_split_info_list` varchar(512) NOT NULL DEFAULT '',
|
|
`status` varchar(16) NOT NULL DEFAULT '',
|
|
`applied_at` datetime DEFAULT NULL,
|
|
`error_code` varchar(20) NOT NULL DEFAULT '',
|
|
`error_message` varchar(120) NOT NULL DEFAULT '',
|
|
`refund_success_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,
|
|
`status` varchar(16) NOT NULL DEFAULT '',
|
|
`message` 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; |