Skip to content

Commit

Permalink
MOD:修改API文档,增加sort参数默认值
Browse files Browse the repository at this point in the history
  • Loading branch information
ShilongLee committed Jul 31, 2024
1 parent feccd36 commit 590f727
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/api/xhs/xhs.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
| keyword | true | string | 搜索词 |
| offset | false | int | 搜索翻页偏移量, 默认0 |
| limit | false | int | 结果数量, 默认10 |
| sort | false | string | 排序方式,默认为`general`综合。 |

- **Success Response**

Expand Down
4 changes: 2 additions & 2 deletions service/xhs/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from ..logic import request_search
import random

async def search(keyword: str, sort: str, offset: int = 0, limit: int = 20):
async def search(keyword: str, sort: str = "general", offset: int = 0, limit: int = 20):
"""
获取笔记搜索
"sort": "time_descending", # 排序,general:默认, popularity_descending:最热, time_descending:最新
"sort": general:默认, popularity_descending:最热, time_descending:最新
"""
_accounts = await accounts.load()
random.shuffle(_accounts)
Expand Down

0 comments on commit 590f727

Please sign in to comment.