mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 11:29:38 +08:00
extra
This commit is contained in:
14
API.md
14
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
2
YYeTsFE
2
YYeTsFE
Submodule YYeTsFE updated: 99b60dd7cd...801dae57ff
@@ -7,6 +7,8 @@
|
||||
|
||||
__author__ = "Benny <benny.think@gmail.com>"
|
||||
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user