|
@@ -95,10 +95,8 @@ class Register extends API {
|
|
|
// 查询users表中是否有用户
|
|
|
const userCountQuery = 'SELECT COUNT(*) as count FROM users';
|
|
|
const userCountResult = await db.query(userCountQuery);
|
|
|
- const userCount = userCountResult.count;
|
|
|
-
|
|
|
// 如果是第一个注册的用户 授予admin权限
|
|
|
- const admin = userCount === 0 ? 1 : 0;
|
|
|
+ const admin = userCountResult[0].count === 0 ? 1 : 0;
|
|
|
|
|
|
const uuid = md5(Date.now() + email + code);
|
|
|
const session = this.createSession(code, Math.random().toFixed(6).slice(-6));
|