|
|
@ -270,7 +270,7 @@ async function getLatestDynamic (ctx) { |
|
|
|
const { limit, page, projectCorrelationId, types } = ctx.query; |
|
|
|
const { userInfo } = ctx.fs.api; |
|
|
|
const { clickHouse } = ctx.app.fs; |
|
|
|
|
|
|
|
limit = 1 |
|
|
|
let where = { type: { $in: types.split(',') } }//传类型选择
|
|
|
|
if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) { |
|
|
|
where.projectCorrelationId = { $in: userInfo.correlationProject } |
|
|
@ -278,6 +278,7 @@ async function getLatestDynamic (ctx) { |
|
|
|
if (projectCorrelationId) {//查指定项目,控制台全局切换
|
|
|
|
where.projectCorrelationId = projectCorrelationId |
|
|
|
} |
|
|
|
console.log(101010, limit, page, projectCorrelationId, types); |
|
|
|
let news = await models.LatestDynamicList.findAll({//最新动态
|
|
|
|
include: [{ |
|
|
|
model: models.ProjectCorrelation, |
|
|
@ -300,7 +301,7 @@ async function getLatestDynamic (ctx) { |
|
|
|
order: [['time', 'desc']], |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(111111,news); |
|
|
|
console.log(111111, news); |
|
|
|
|
|
|
|
//查项目名称 查用户名
|
|
|
|
let pepPojectIds = new Set(), notedUserIds = new Set(), emailSendPomsProjectIds = new Set(); |
|
|
@ -320,8 +321,8 @@ async function getLatestDynamic (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log(222222,notedUserIds); |
|
|
|
console.log(333333,emailSendPomsProjectIds); |
|
|
|
console.log(222222, notedUserIds); |
|
|
|
console.log(333333, emailSendPomsProjectIds); |
|
|
|
|
|
|
|
|
|
|
|
// EM 推送的特殊处理
|
|
|
@ -335,7 +336,7 @@ async function getLatestDynamic (ctx) { |
|
|
|
}) : [] |
|
|
|
|
|
|
|
|
|
|
|
console.log(444444,emailLogProjectCorrelationRes); |
|
|
|
console.log(444444, emailLogProjectCorrelationRes); |
|
|
|
|
|
|
|
for (let { dataValues: p } of emailLogProjectCorrelationRes) { |
|
|
|
if (p.pepProjectId) { |
|
|
@ -343,21 +344,21 @@ async function getLatestDynamic (ctx) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log(555555,pepPojectIds); |
|
|
|
console.log(555555, pepPojectIds); |
|
|
|
|
|
|
|
let pepProjects = pepPojectIds.size ? await clickHouse.projectManage.query(` |
|
|
|
SELECT id, project_name FROM t_pim_project WHERE id IN (${[...pepPojectIds].join(',')},-1) |
|
|
|
`).toPromise() : [];
|
|
|
|
|
|
|
|
|
|
|
|
console.log(666666,pepProjects); |
|
|
|
console.log(666666, pepProjects); |
|
|
|
|
|
|
|
|
|
|
|
let userPepRes = notedUserIds.size ? await clickHouse.pepEmis.query( |
|
|
|
`SELECT DISTINCT user.id AS id, "user"."name" AS name FROM user WHERE user.id IN (${[...notedUserIds].join(',')},-1)
|
|
|
|
`).toPromise() : []
|
|
|
|
|
|
|
|
console.log(777777,userPepRes); |
|
|
|
console.log(777777, userPepRes); |
|
|
|
|
|
|
|
|
|
|
|
let appear = [], notice = [], confirm = []; |
|
|
@ -399,7 +400,7 @@ async function getLatestDynamic (ctx) { |
|
|
|
confirm//确认
|
|
|
|
}; |
|
|
|
} catch (error) { |
|
|
|
console.log(888888,error); |
|
|
|
console.log(888888, error); |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|
ctx.status = 400; |
|
|
|
ctx.body = { |
|
|
|