wenlele 2 years ago
parent
commit
490962dc41
  1. 9
      api/app/lib/controllers/control/data.js

9
api/app/lib/controllers/control/data.js

@ -270,7 +270,7 @@ async function getLatestDynamic (ctx) {
const { limit, page, projectCorrelationId, types } = ctx.query; const { limit, page, projectCorrelationId, types } = ctx.query;
const { userInfo } = ctx.fs.api; const { userInfo } = ctx.fs.api;
const { clickHouse } = ctx.app.fs; const { clickHouse } = ctx.app.fs;
limit = 1
let where = { type: { $in: types.split(',') } }//传类型选择 let where = { type: { $in: types.split(',') } }//传类型选择
if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) { if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) {
where.projectCorrelationId = { $in: userInfo.correlationProject } where.projectCorrelationId = { $in: userInfo.correlationProject }
@ -278,7 +278,8 @@ async function getLatestDynamic (ctx) {
if (projectCorrelationId) {//查指定项目,控制台全局切换 if (projectCorrelationId) {//查指定项目,控制台全局切换
where.projectCorrelationId = projectCorrelationId where.projectCorrelationId = projectCorrelationId
} }
console.log(101010, limit, page, projectCorrelationId, types); console.log(1010, limit, page, projectCorrelationId, types);
let news = await models.LatestDynamicList.findAll({//最新动态 let news = await models.LatestDynamicList.findAll({//最新动态
include: [{ include: [{
model: models.ProjectCorrelation, model: models.ProjectCorrelation,
@ -296,8 +297,8 @@ async function getLatestDynamic (ctx) {
model: models.AlarmConfirmLog model: models.AlarmConfirmLog
}], }],
where: where, where: where,
offset: Number(page) * Number(limit), offset: 0,
limit: Number(limit), limit: 1,
order: [['time', 'desc']], order: [['time', 'desc']],
}); });

Loading…
Cancel
Save