Browse Source

🐞 fix: 修复UA无法插入登陆记录的问题

Pchen. 9 months ago
parent
commit
1c1a0f1637
1 changed files with 1 additions and 4 deletions
  1. 1 4
      apis/User/uniLogin/Login.js

+ 1 - 4
apis/User/uniLogin/Login.js

@@ -95,11 +95,8 @@ class Login extends API {
             // 增加登录记录
             try {
                 const userAgent = req.headers['user-agent']
-                const parser = new UAParser(userAgent)
-                const uaResult = parser.getResult()
-                console.log(uaResult)
                 let insertSql = 'INSERT INTO login_history (uuid, time, deviceInfo, type, ip) VALUES (?, ?, ?, ?, ?)'
-                await db.query(insertSql, [uuid, time, uaResult, type || 'qq', ip])
+                await db.query(insertSql, [uuid, time, { 'ua': userAgent }, type || 'qq', ip])
             } catch (error) {
                 this.logger.error(`写入登录记录失败!${error}`)
             }