From 590f727f1034400b306c6ae19614bc5ab9d613fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=96=E9=BE=99?= <1261586682@qq.com> Date: Wed, 31 Jul 2024 16:51:40 +0800 Subject: [PATCH] =?UTF-8?q?MOD:=E4=BF=AE=E6=94=B9API=E6=96=87=E6=A1=A3?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0sort=E5=8F=82=E6=95=B0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/xhs/xhs.md | 1 + service/xhs/views/search.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/api/xhs/xhs.md b/docs/api/xhs/xhs.md index fe06b07..62fdac9 100644 --- a/docs/api/xhs/xhs.md +++ b/docs/api/xhs/xhs.md @@ -191,6 +191,7 @@ | keyword | true | string | 搜索词 | | offset | false | int | 搜索翻页偏移量, 默认0 | | limit | false | int | 结果数量, 默认10 | +| sort | false | string | 排序方式,默认为`general`综合。 | - **Success Response** diff --git a/service/xhs/views/search.py b/service/xhs/views/search.py index a2170a6..381a8bb 100644 --- a/service/xhs/views/search.py +++ b/service/xhs/views/search.py @@ -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)