diff --git a/API.md b/API.md index 6cce997..a063199 100644 --- a/API.md +++ b/API.md @@ -99,10 +99,18 @@ ```json { "data": [], - "extra": { - "东城梦魇": "https://www.zimuxia.cn/portfolio/%e4%b8%9c%e5%9f%8e%e6%a2%a6%e9%ad%87", - "黑色止血钳": "https://www.zimuxia.cn/portfolio/%e9%bb%91%e8%89%b2%e6%ad%a2%e8%a1%80%e9%92%b3" - } + "extra": [ + { + "url": "https://www.zimuxia.cn/portfolio/%e4%b8%9c%e5%9f%8e%e6%a2%a6%e9%ad%87", + "name": "东城梦魇", + "class": "ZimuxiaOnline" + }, + { + "url": "https://www.zimuxia.cn/portfolio/%e9%bb%91%e8%89%b2%e6%ad%a2%e8%a1%80%e9%92%b3", + "name": "黑色止血钳", + "class": "ZimuxiaOnline" + } + ] } ``` diff --git a/YYeTsFE b/YYeTsFE index 99b60dd..801dae5 160000 --- a/YYeTsFE +++ b/YYeTsFE @@ -1 +1 @@ -Subproject commit 99b60dd7cd8b0e82a88beb05c5b0621179a448da +Subproject commit 801dae57ff1afb6eae5828b10cd9ac72615bac1c diff --git a/yyetsweb/Mongo.py b/yyetsweb/Mongo.py index cc099d1..2b3010f 100644 --- a/yyetsweb/Mongo.py +++ b/yyetsweb/Mongo.py @@ -7,6 +7,8 @@ __author__ = "Benny " +import contextlib + import pymongo import os import time @@ -307,13 +309,10 @@ class ResourceMongoResource(ResourceResource, Mongo): class_ = globals().get(class_name) result = class_().search_preview(kw) result.pop("class") - json_result = {} - print(result) if result: - # this means we have search result, get it from redis cache with real name - for values in result.values(): - json_result[values["name"]] = values["url"] - return json_result + return list(result.values()) + else: + return [] def get_resource_data(self, resource_id: int, username: str) -> dict: data = self.db["yyets"].find_one_and_update(