Skip to content

Latest commit

 

History

History
50 lines (43 loc) · 2.17 KB

用户.md

File metadata and controls

50 lines (43 loc) · 2.17 KB

用户有几个相关的表:

CREATE TABLE IF NOT EXISTS chii_members
(
    uid          mediumint unsigned auto_increment primary key,
    username     char(15) charset utf8 default '' not null,
    nickname     varchar(30)                      not null,
    avatar       varchar(255) charset utf8        not null,
    groupid      smallint(6) unsigned  default 0  not null, # 用户权限组
    regdate      int unsigned          default 0  not null, # 注册日期
    lastvisit    int unsigned          default 0  not null, # 最后访问
    lastactivity int unsigned          default 0  not null, # 最后活动
    lastpost     int unsigned          default 0  not null, # 最后发帖
    dateformat   char(10) charset utf8 default '' not null, # 没用
    timeformat   tinyint(1)            default 0  not null, # 没用
    timeoffset   char(4) charset utf8  default '' not null, # 没用
    newpm        tinyint(1)            default 0  not null,
    new_notify   smallint(6) unsigned  default 0  not null comment '新提醒',
    sign         varchar(255) charset utf8        not null,
    constraint username unique (username)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;

dateformat timeformattimeoffset 都是废弃字段。

CREATE TABLE IF NOT EXISTS `chii_oauth_access_tokens` (
  `access_token` varchar(40) COLLATE utf8_unicode_ci NOT NULL,
  `client_id` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
  `user_id` varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
  `expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `scope` varchar(4000) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

user_id 记得转成 int 再作为uid查询

目前数据库中 scope 为 null

存储具体权限的表 usr_grp_id 为用户表中的 group id

CREATE TABLE IF NOT EXISTS `chii_usergroup` (
  `usr_grp_id` mediumint(8) unsigned NOT NULL,
  `usr_grp_name` varchar(255) CHARACTER SET utf8 NOT NULL,
  `usr_grp_perm` mediumtext CHARACTER SET utf8 NOT NULL,
  `usr_grp_dateline` int(10) unsigned NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;