 
 CREATE TABLE `u1_session` (
   `id` int(11) NOT NULL COMMENT 'ID',
-  `session_token` varchar(45) COLLATE utf8mb4_unicode_520_ci NOT NULL COMMENT '会话令牌',
-  `token_purpose_code` tinyint(2) NOT NULL COMMENT '令牌用途代码（临时令牌/正式令牌等）',
-  `session_token_create_time` datetime NOT NULL COMMENT '会话令牌创建时间',
-  `session_token_term_of_validity` datetime NOT NULL COMMENT '会话令牌有效期至',
-  `session_token_check_times` int(11) DEFAULT NULL COMMENT '令牌校验次数',
-  `graphic_captcha` varchar(10) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '图形验证码（可选）',
-  `graphic_captcha_check_times` datetime DEFAULT NULL COMMENT '图形验证码有效期',
-  `notes_app_name` varchar(45) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '备注：应用名称',
-  `notes_device_name` varchar(45) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '备注：设备名称',
-  `notes_ip_address` int(11) DEFAULT NULL COMMENT '备注：IP地址',
-  `notes_ua` varchar(45) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '备注：UA（可选）'
+  `token` char(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL COMMENT '会话令牌',
+  `apptoken` char(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL COMMENT 'APP钥匙访问代码',
+  `ipid` int(11) UNSIGNED NOT NULL COMMENT 'IP地址ID',
+  `appid` int(11) UNSIGNED NOT NULL COMMENT '已注册应用ID',
+  `time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '令牌生成时间',
+  `endtime` datetime DEFAULT NULL COMMENT '令牌失效时间'
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='会话令牌表';
 
 -- --------------------------------------------------------

  `answer1` tinytext COLLATE utf8mb4_unicode_520_ci COMMENT '密码保护答案1',
  `answer2` tinytext COLLATE utf8mb4_unicode_520_ci COMMENT '密码保护答案2',
  `answer3` tinytext COLLATE utf8mb4_unicode_520_ci COMMENT '密码保护答案3',
  `totp` char(32) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT 'TOTP验证码',
  `recovery1` char(25) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '恢复代码1',
  `recovery2` char(25) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '恢复代码2',
  `recovery3` char(25) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '恢复代码3',
  `recovery4` char(25) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '恢复代码4',
  `recovery5` char(25) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '恢复代码5'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='密保表';

-- --------------------------------------------------------


CREATE TABLE `u1_history` (
  `id` bigint(20) NOT NULL COMMENT '序号',
  `userhash` char(64) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL COMMENT '用户哈希',
  `apptoken` char(64) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL COMMENT 'APP密钥',
  `session` char(64) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL COMMENT '会话代码',
  `ipid` int(11) NOT NULL COMMENT 'IP表id',
  `time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '发生时间',
  `operation` enum('USER_SIGN_UP','USER_SIGN_IN','') CHARACTER SET ascii DEFAULT NULL COMMENT '执行操作',
  `sender` tinytext COLLATE utf8mb4_unicode_520_ci COMMENT '发送者',
  `receiver` tinytext COLLATE utf8mb4_unicode_520_ci COMMENT '接收者',
  `process` longtext COLLATE utf8mb4_unicode_520_ci COMMENT '过程',
  `result` longtext COLLATE utf8mb4_unicode_520_ci COMMENT '结果',
  `auditadmin` char(64) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL COMMENT '审核员哈希',
  `audittime` datetime DEFAULT NULL COMMENT '审核时间',
  `auditresult` tinytext COLLATE utf8mb4_unicode_520_ci COMMENT '审核意见'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
