|
|
@ -18,8 +18,10 @@ module.exports = function (app, opts) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { userInfo = {} } = ctx.fs.api || {}; |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
|
const { correlationProject = [] } = userInfo |
|
|
|
|
|
|
|
|
|
|
|
// TODO 这儿也许需要判断传进来的 pepProjectId 在不在当前用户的关注范围内
|
|
|
|
const bindRes = await models.ProjectCorrelation.findAll({ |
|
|
|
where: { |
|
|
@ -27,7 +29,8 @@ module.exports = function (app, opts) { |
|
|
|
del: false |
|
|
|
} |
|
|
|
}) |
|
|
|
return [ |
|
|
|
|
|
|
|
const anxinStrucIds = [ |
|
|
|
...bindRes.reduce( |
|
|
|
(arr, b) => { |
|
|
|
for (let sid of b.anxinProjectId) { |
|
|
@ -38,6 +41,21 @@ module.exports = function (app, opts) { |
|
|
|
new Set() |
|
|
|
) |
|
|
|
] |
|
|
|
|
|
|
|
const undelStrucRes = anxinStrucIds.length ? |
|
|
|
await clickHouse.anxinyun.query(` |
|
|
|
SELECT |
|
|
|
id |
|
|
|
FROM |
|
|
|
t_project |
|
|
|
WHERE |
|
|
|
project_state = 4 |
|
|
|
AND |
|
|
|
id IN (${anxinStrucIds.join(',')}) |
|
|
|
`).toPromise() :
|
|
|
|
[] |
|
|
|
|
|
|
|
return undelStrucRes.map(s => s.id) |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|
} |
|
|
|