1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// 一个user对应多个wechat: 多个微信账号授权可以绑定到同一个手机号
CREATE TABLE `user_wechat` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'userId',
`unionid` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户统一标识,针对一个微信开放平台帐号下的应用同一用户唯一',
`openid` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '普通用户的标识,对当前开发者帐号唯一',
`nickname` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '昵称',
`gender` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '性别:1男 2女',
`province` varchar(60) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '省份',
`city` varchar(60) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '城市',
`country` varchar(60) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '国家',
`avatar` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '头像',
`privilege` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户特权信息',
`access_token` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`refresh_token` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uix_user_wechat_openid` (`openid`),
KEY `idx_user_wechat_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='微信账号信息表';
|