MySQL 创建数据库:
CREATE DATABASE [IF NOT EXISTS] <数据库名> [[DEFAULT] CHARACTER SET <字符集名>] [[DEFAULT] COLLATE <校对规则名>];
注: [IF NOT EXISTS] 方法判断数据库是否存在,不存在才创建
[DEFAULT] CHARACTER SET 数据库的默认字符集
[DEFAULT] COLLATE:字符集的默认校对规则
例:
mysql> CREATE DATABASE test;
Query OK, 1 row affected (0.12 sec)
test 数据库创建微信user数据表:
#查询mysql版本号 sql_mode方式
select version(), @@sql_mode;
#[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column "information_schema.PROFILING.SEQ" which is not functionally dependent on columns in GROUP BY clause; this is incompatible with
SET sql_mode=(SELECT REPLACE(@@sql_mode,"ONLY_FULL_GROUP_BY",""));
CREATE TABLE `lev_wx_user` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`openid` varchar(28) DEFAULT NULL COMMENT "小程序用户的openid",
`nickname` varchar(100) DEFAULT NULL COMMENT "用户昵称",
`avatarurl` varchar(100) DEFAULT NULL COMMENT "用户头像",
`gender` tinyint(1) DEFAULT NULL COMMENT "性别 0-男、1-女",
`country` varchar(100) DEFAULT NULL COMMENT "所在国家",
`province` varchar(100) DEFAULT NULL COMMENT "省份",
`city` varchar(100) DEFAULT NULL COMMENT "城市",
`language` varchar(100) DEFAULT NULL COMMENT "语种",
`create_time` datetime DEFAULT NULL COMMENT "创建/注册时间",
`update_time` datetime DEFAULT NULL COMMENT "更新时间",
`mobile` varchar(50) DEFAULT NULL COMMENT "手机号码",
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT="小程序用户表";
注:微信openid获取流程:
-
- 微信小程序方法:wx.login(Object object)=>改为=>uniapp方法:uni.login(Object object)
注意:uniapp的object的参数provider指定登录服务提供商,可通过uni.getProVider获取,如果不设置则弹出登录列表页面
- 微信小程序方法:wx.login(Object object)=>改为=>uniapp方法:uni.login(Object object)