From 27bd20f8b3c482f91de174791c0af061d1b4ebdf Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Tue, 6 Dec 2022 15:11:03 +0800 Subject: [PATCH] =?UTF-8?q?debug=20=E6=9F=A5=E8=AF=A2=E8=80=97=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/app/lib/controllers/mirror/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js b/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js index 445c553..b705faf 100644 --- a/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js +++ b/code/VideoAccess-VCMP/api/app/lib/controllers/mirror/index.js @@ -193,6 +193,7 @@ async function list (ctx) { const { models } = ctx.fs.dc; const { userId, token } = ctx.fs.api + let startTime = moment() const mirrorRes = await models.Mirror.findAll({ attributes: { exclude: ['showHeader'] @@ -200,19 +201,20 @@ async function list (ctx) { where: {}, order: [['id', 'DESC']] }) + console.log(`S1 = ${moment().diff(startTime, 'milliseconds')}`); let createUserIds = new Set() - for (let c of mirrorRes) { createUserIds.add(c.dataValues.createUser) } - + console.log(`S1 = ${moment().diff(startTime, 'milliseconds')}`); // 查对应创建者信息 const corUsers = await ctx.app.fs.authRequest.get(`user/${[...createUserIds].join(',') || -1}/message`, { query: { token } }) + console.log(`S3 = ${moment().diff(startTime, 'milliseconds')}`); for (let { dataValues: mirror } of mirrorRes) { const corUser = corUsers.find(u => u.id == mirror.createUser) mirror.createUser = corUser ? corUser.username : '' } - + console.log(`S4 = ${moment().diff(startTime, 'milliseconds')}`); ctx.status = 200; ctx.body = mirrorRes } catch (error) {