bug修改
This commit is contained in:
1 parent
e046c67f64
commit
1024045a92
11 files changed
+104
-56
No files matched your search
@@ -1,14 +1,15 @@
|
||||
-- 航空账号(管理员开通:手机号+密码+有效期+设备唯一绑定)
|
||||
CREATE TABLE IF NOT EXISTS `member_airline_account` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`mobile` varchar(11) NOT NULL COMMENT '手机号',
|
||||
`mobile` varchar(11) NOT NULL COMMENT '手机号(同一手机号可在不同渠道各有一个账号)',
|
||||
`channel` varchar(8) NOT NULL DEFAULT 'CZ' COMMENT '品牌渠道(CZ南航/MU东航/HU海航)',
|
||||
`password` varchar(100) NOT NULL DEFAULT '' COMMENT '密码(BCrypt)',
|
||||
`start_time` datetime NOT NULL COMMENT '生效开始时间',
|
||||
`end_time` datetime NOT NULL COMMENT '生效结束时间',
|
||||
`device_id` varchar(128) NULL DEFAULT NULL COMMENT '手机唯一识别号(首次登录绑定;重装/重启应由客户端保持不变)',
|
||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0开启 1关闭)',
|
||||
`remark` varchar(500) NULL DEFAULT NULL COMMENT '备注',
|
||||
`user_id` bigint NULL DEFAULT NULL COMMENT '关联会员用户编号 member_user.id',
|
||||
`user_id` bigint NULL DEFAULT NULL COMMENT '关联会员用户编号 member_user.id(已废弃,登录不再创建会员用户)',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
@@ -16,8 +17,8 @@ CREATE TABLE IF NOT EXISTS `member_airline_account` (
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_mobile` (`mobile`, `deleted`, `tenant_id`) USING BTREE,
|
||||
UNIQUE KEY `uk_device_id` (`device_id`, `deleted`, `tenant_id`) USING BTREE,
|
||||
UNIQUE KEY `uk_mobile_channel` (`mobile`, `channel`, `deleted`, `tenant_id`) USING BTREE,
|
||||
UNIQUE KEY `uk_channel_device` (`channel`, `device_id`, `deleted`, `tenant_id`) USING BTREE,
|
||||
KEY `idx_end_time` (`end_time`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='航空账号';
|
||||
|
||||
@@ -40,8 +41,9 @@ ON DUPLICATE KEY UPDATE `permission` = VALUES(`permission`);
|
||||
-- 手机号:13800138000 密码:123456 有效期约一年 未绑定设备
|
||||
-- 密码哈希为 BCrypt(123456)
|
||||
INSERT INTO `member_airline_account`
|
||||
(`mobile`, `password`, `start_time`, `end_time`, `device_id`, `status`, `remark`, `user_id`, `tenant_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
||||
(`mobile`, `channel`, `password`, `start_time`, `end_time`, `device_id`, `status`, `remark`, `user_id`, `tenant_id`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
|
||||
SELECT '13800138000',
|
||||
'CZ',
|
||||
'$2a$10$PplOV8yXcQo9xc32V8vwTuIMbMKgNtjXf3lu6l18LUTOy9YGDdAY6',
|
||||
NOW() - INTERVAL 1 DAY,
|
||||
NOW() + INTERVAL 365 DAY,
|
||||
@@ -58,5 +60,5 @@ SELECT '13800138000',
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `member_airline_account`
|
||||
WHERE `mobile` = '13800138000' AND `deleted` = b'0' AND `tenant_id` = 1
|
||||
WHERE `mobile` = '13800138000' AND `channel` = 'CZ' AND `deleted` = b'0' AND `tenant_id` = 1
|
||||
);
|
||||
@@ -0,0 +1,20 @@
|
||||
-- 航空账号增加品牌渠道(channel):CZ 南航 / MU 东航 / HU 海航
|
||||
-- 目的:三个 App 使用同一手机号分别登录,互不干扰。
|
||||
-- 唯一键调整:
|
||||
-- uk_mobile (mobile, deleted, tenant_id) -> 废弃
|
||||
-- uk_device_id (device_id, deleted, tenant_id) -> 废弃
|
||||
-- uk_mobile_channel (mobile, channel, deleted, tenant_id) -> 同一手机号每渠道一个账号
|
||||
-- uk_channel_device (channel, device_id, deleted, tenant_id) -> 同一设备每渠道绑定一个账号
|
||||
|
||||
ALTER TABLE `member_airline_account`
|
||||
ADD COLUMN `channel` varchar(8) NOT NULL DEFAULT 'CZ' COMMENT '品牌渠道(CZ南航/MU东航/HU海航)' AFTER `mobile`;
|
||||
|
||||
-- 存量数据归属渠道默认回填为 CZ(南航),如实际属于东航/海航请手工执行:
|
||||
-- UPDATE `member_airline_account` SET `channel` = 'MU' WHERE ...;
|
||||
-- UPDATE `member_airline_account` SET `channel` = 'HU' WHERE ...;
|
||||
|
||||
ALTER TABLE `member_airline_account`
|
||||
DROP INDEX `uk_mobile`,
|
||||
DROP INDEX `uk_device_id`,
|
||||
ADD UNIQUE KEY `uk_mobile_channel` (`mobile`, `channel`, `deleted`, `tenant_id`),
|
||||
ADD UNIQUE KEY `uk_channel_device` (`channel`, `device_id`, `deleted`, `tenant_id`);
|
||||
Reference in new issue
Block a user