mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-25 19:37:34 +08:00
extra
This commit is contained in:
14
API.md
14
API.md
@@ -99,10 +99,18 @@
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"data": [],
|
"data": [],
|
||||||
"extra": {
|
"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"
|
"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>"
|
__author__ = "Benny <benny.think@gmail.com>"
|
||||||
|
|
||||||
|
import contextlib
|
||||||
|
|
||||||
import pymongo
|
import pymongo
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@@ -307,13 +309,10 @@ class ResourceMongoResource(ResourceResource, Mongo):
|
|||||||
class_ = globals().get(class_name)
|
class_ = globals().get(class_name)
|
||||||
result = class_().search_preview(kw)
|
result = class_().search_preview(kw)
|
||||||
result.pop("class")
|
result.pop("class")
|
||||||
json_result = {}
|
|
||||||
print(result)
|
|
||||||
if result:
|
if result:
|
||||||
# this means we have search result, get it from redis cache with real name
|
return list(result.values())
|
||||||
for values in result.values():
|
else:
|
||||||
json_result[values["name"]] = values["url"]
|
return []
|
||||||
return json_result
|
|
||||||
|
|
||||||
def get_resource_data(self, resource_id: int, username: str) -> dict:
|
def get_resource_data(self, resource_id: int, username: str) -> dict:
|
||||||
data = self.db["yyets"].find_one_and_update(
|
data = self.db["yyets"].find_one_and_update(
|
||||||
|
|||||||
Reference in New Issue
Block a user