Commit 5c317aa7 authored by nanahira's avatar nanahira

update

parent 1a90fedf
......@@ -14,6 +14,7 @@ interface Card {
interface QueryInfo {
upper: number;
lower: number;
noFilterAlias: boolean;
where?: Where[];
mayIncorrectStatements?: MayIncorrectStatement[];
}
......@@ -153,7 +154,7 @@ function getMedianCode(cards: Card[]) {
async function queryCards(queryInfo: QueryInfo) {
const whereClauseString = parseWhereClause(queryInfo.where);
const mayIncorrectClauseString = parseMayIncorrectStatements(queryInfo.mayIncorrectStatements);
const sql = `select datas.id,texts.name from datas,texts where datas.id = texts.id and datas.type & 0x4000 = 0 and datas.id > ? and datas.id <= ? and (datas.alias = 0 or datas.alias - datas.id > 10) ${whereClauseString} ${mayIncorrectClauseString} order by datas.id asc`;
const sql = `select datas.id,texts.name from datas,texts where datas.id = texts.id and datas.type & 0x4000 = 0 and datas.id > ? and datas.id <= ? ${queryInfo.noFilterAlias ? "" : "and (datas.alias = 0 or datas.alias - datas.id > 10)"} ${whereClauseString} ${mayIncorrectClauseString} order by datas.id asc`;
console.log(`SQL: ${sql}`);
const cards: Card[] = await db.all(sql, [queryInfo.lower, queryInfo.upper]);
return cards;
......
upper: 100000000
lower: 0
noFilterAlias: false
where:
- "type & {TYPE_MONSTER} > 0"
mayIncorrectStatements:
......
......@@ -27,10 +27,12 @@
```yaml
upper: 100000000
lower: 0
noFilterAlias: false
where:
- "type & {TYPE_MONSTER} > 0"
mayIncorrectStatements:
- incorrectCount: 4
- incorrectCountMin: 4
incorrectCountMax: 4
lessThanOrEqual: true
where:
- "type & {TYPE_FUSION} = 0"
......@@ -45,6 +47,8 @@ mayIncorrectStatements:
* `lower` 卡号下界,用于二分定卡号。
* `noFilterAlias` 不过滤异画卡。
* `where` 约束条件,使用 SQL 语句填写,相互之间是 AND 的关系。
### 模糊逻辑
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment