issue #9
This commit is contained in:
parent
90a86133db
commit
30c13a1cfb
|
@ -97,15 +97,24 @@ export default (router, tpl) => {
|
||||||
router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
||||||
let ret;
|
let ret;
|
||||||
if(Object.keys(req.url.qs).length > 0) {
|
if(Object.keys(req.url.qs).length > 0) {
|
||||||
const tag = req.url.qs.tag;
|
let tag = req.url.qs.tag;
|
||||||
|
let rows;
|
||||||
const rows = await sql("tags")
|
|
||||||
.select("items.id", "items.username", "tags.tag")
|
if(tag.startsWith('src:')) {
|
||||||
.leftJoin("tags_assign", "tags_assign.tag_id", "tags.id")
|
tag = tag.substring(4);
|
||||||
.leftJoin("items", "items.id", "tags_assign.item_id")
|
ret = await sql('items')
|
||||||
.where("tags.tag", "like", '%'+tag+'%');
|
.where('src', 'ilike', '%'+tag+'%')
|
||||||
|
.limit(500);
|
||||||
ret = search(rows, tag);
|
}
|
||||||
|
else {
|
||||||
|
rows = await sql("tags")
|
||||||
|
.select("items.id", "items.username", "tags.tag")
|
||||||
|
.leftJoin("tags_assign", "tags_assign.tag_id", "tags.id")
|
||||||
|
.leftJoin("items", "items.id", "tags_assign.item_id")
|
||||||
|
.where("tags.tag", "like", '%'+tag+'%')
|
||||||
|
.limit(500);
|
||||||
|
ret = search(rows, tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.reply({
|
res.reply({
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 128px;"><a href="/{{ line.id }}" target="_blank"><img src="/t/{{ line.id }}.webp" /></a></td>
|
<td style="width: 128px;"><a href="/{{ line.id }}" target="_blank"><img src="/t/{{ line.id }}.webp" /></a></td>
|
||||||
<td style="text-align: center;"><a href="/{{ line.id }}" target="_blank">{{ line.id }}</a></td>
|
<td style="text-align: center;"><a href="/{{ line.id }}" target="_blank">{{ line.id }}</a></td>
|
||||||
<td style="text-align: center;"><a href="/admin/test?tag={{ line.tag.replace(/\s/g, "+") }}">{{ line.tag }}</a></td>
|
<td style="text-align: center;"><a href="/admin/test?tag={{ line.tag?.replace(/\s/g, "+") }}">{{ line.tag }}</a></td>
|
||||||
<td style="text-align: center;">{{ line.username }}</td>
|
<td style="text-align: center;">{{ line.username }}</td>
|
||||||
<td style="text-align: center;">{{ line.score }}</td>
|
<td style="text-align: center;">{{ line.score }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user