diff --git a/package.json b/package.json index dacf6f2..4081563 100644 --- a/package.json +++ b/package.json @@ -51,53 +51,53 @@ "node": ">= 8" }, "devDependencies": { - "@babel/cli": "^7.4.4", - "@babel/node": "^7.4.5", - "@babel/register": "^7.4.4", - "babel-eslint": "^10.0.1", + "@babel/cli": "^7.6.4", + "@babel/node": "^7.6.3", + "@babel/register": "^7.6.2", + "babel-eslint": "^10.0.3", "babel-plugin-add-module-exports": "^1.0.2", - "babel-plugin-istanbul": "^5.1.4", + "babel-plugin-istanbul": "^5.2.0", "bootstrap": "^3.4.1", "chai": "^4.2.0", "chai-http": "^4.3.0", - "coveralls": "^3.0.3", - "dool": "^4.1.3", - "eslint": "^5.16.0", - "eslint-config-standard": "^12.0.0", - "eslint-plugin-import": "^2.17.2", - "eslint-plugin-node": "^9.1.0", - "eslint-plugin-promise": "^4.1.1", - "eslint-plugin-standard": "^4.0.0", + "coveralls": "^3.0.7", + "dool": "^4.3.3", + "eslint": "^6.6.0", + "eslint-config-standard": "^14.1.0", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-node": "^10.0.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-standard": "^4.0.1", "jquery": "^3.4.1", "koa-passport": "^4.1.3", - "mocha": "^6.1.4", - "mysql2": "^1.6.5", + "mocha": "^6.2.2", + "mysql2": "^2.0.0", "nyc": "^14.1.1", "passport-oauth2": "^1.5.0", "pre-commit": "^1.1.3", - "rimraf": "^2.6.3", - "sqlite3": "^4.0.8" + "rimraf": "^3.0.0", + "sqlite3": "^4.1.0" }, "dependencies": { - "commander": "^2.20.0", - "inquirer": "^6.3.1", - "koa": "^2.7.0", + "commander": "^3.0.2", + "inquirer": "^7.0.0", + "koa": "^2.11.0", "koa-bodyparser": "^4.2.1", - "koa-csrf": "^3.0.7", - "koa-logger": "^3.2.0", - "koa-orm": "^2.3.3", + "koa-csrf": "^3.0.8", + "koa-logger": "^3.2.1", + "koa-orm": "^2.3.6", "koa-router": "^7.4.0", - "koa-session": "^5.12.0", + "koa-session": "^5.12.3", "koa-static": "^5.0.0", "koa-view": "^2.1.3", - "lodash.merge": "^4.6.0", - "lodash.template": "^4.4.0", - "nanoid": "^2.0.3", - "nodemailer": "^6.2.1", + "lodash.merge": "^4.6.2", + "lodash.template": "^4.5.0", + "nanoid": "^2.1.6", + "nodemailer": "^6.3.1", "notp": "^2.0.3", "qr-image": "^3.1.0", "randomcolor": "^0.5.4", "thirty-two": "^1.0.2", - "validator": "^11.0.0" + "validator": "^12.0.0" } } diff --git a/src/controllers/admin.js b/src/controllers/admin.js index e81bdec..fa02a20 100644 --- a/src/controllers/admin.js +++ b/src/controllers/admin.js @@ -42,7 +42,7 @@ export async function userList (ctx) { const offset = (page - 1) * limit; const where = { enable: 1 }; if (query) { - where['email'] = { $like: `%${query}%` }; + where.email = { $like: `%${query}%` }; } const users = await User.findAndCountAll({ where, @@ -72,7 +72,7 @@ export async function clientList (ctx) { const offset = (page - 1) * limit; const where = {}; if (query) { - where['name'] = { $like: `%${query}%` }; + where.name = { $like: `%${query}%` }; } const clients = await Client.findAndCountAll({ where, @@ -221,7 +221,7 @@ export async function roleList (ctx) { email: { $like: `%${query}%` } } }); - where['user_id'] = { + where.user_id = { $in: temp.map(v => v.id) }; } diff --git a/src/middlewares/log.js b/src/middlewares/log.js index 170c913..d7ea5e1 100644 --- a/src/middlewares/log.js +++ b/src/middlewares/log.js @@ -1,9 +1,10 @@ 'use strict'; const ACTIONS = { - 'LOGIN': 1, - 'CHANGE_PWD': 2 + LOGIN: 1, + CHANGE_PWD: 2 }; + export default function (app) { app.use(async function logFn (ctx, next) { ctx.log = async (user_id, action) => {