This commit is contained in:
syuilo 2019-04-14 16:06:04 +09:00
parent 837be06b72
commit 2d5158c680
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 4 additions and 7 deletions

View File

@ -57,13 +57,10 @@ export default define(meta, async (ps) => {
let i = 0; let i = 0;
for (const subDomain of subDomains) { for (const subDomain of subDomains) {
const p = `blackSubDomain_${subDomain}_${i}`; const p = `blackSubDomain_${subDomain}_${i}`;
if (i === subDomains.length - 1) { // 全体で否定できないのでド・モルガンの法則で
// SQL is 1 based, so we need '+ 1' // !(P && Q) を !P || !Q で表す
qb.andWhere(`log.domain[${i + 1}] != :${p}`, { [p]: subDomain }); // SQL is 1 based, so we need '+ 1'
} else { qb.orWhere(`log.domain[${i + 1}] != :${p}`, { [p]: subDomain });
// SQL is 1 based, so we need '+ 1'
qb.andWhere(`log.domain[${i + 1}] = :${p}`, { [p]: subDomain });
}
i++; i++;
} }
} }