From 30be9389baa29a98402b4c0135c0b49d51bc06ee Mon Sep 17 00:00:00 2001 From: kaniol-lck <375520360@qq.com> Date: Tue, 4 Jun 2024 14:17:55 +0800 Subject: [PATCH] update search api --- src/curseforge/curseforgeapi.cpp | 3 ++- src/modrinth/modrinthapi.cpp | 8 +++---- src/ui/curseforge/curseforgemodbrowser.ui | 27 ++++++++++++++++++++++- src/ui/modrinth/modrinthmodbrowser.ui | 9 ++++++-- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/curseforge/curseforgeapi.cpp b/src/curseforge/curseforgeapi.cpp index 5bb3c24a..2bbc808a 100644 --- a/src/curseforge/curseforgeapi.cpp +++ b/src/curseforge/curseforgeapi.cpp @@ -49,7 +49,8 @@ Reply > CurseforgeAPI::searchMods(int sectionId, const //mod urlQuery.addQueryItem("classId", QString::number(sectionId)); //sort, 0 for no sort spec - urlQuery.addQueryItem("sortOrder", QString::number(sort + 1)); + urlQuery.addQueryItem("sortField", QString::number(sort + 1)); + urlQuery.addQueryItem("sortOrder", "desc"); url.setQuery(urlQuery); diff --git a/src/modrinth/modrinthapi.cpp b/src/modrinth/modrinthapi.cpp index 9403658b..0ef32df3 100644 --- a/src/modrinth/modrinthapi.cpp +++ b/src/modrinth/modrinthapi.cpp @@ -43,13 +43,13 @@ Reply> ModrinthAPI::searchMods(const QString name, int in str = "downloads"; break; case 2: - str = "follows";//New add + str = "follows"; break; case 3: - str = "updated"; + str = "newest"; break; case 4: - str = "newest"; + str = "updated"; break; } urlQuery.addQueryItem("index", str); @@ -72,7 +72,7 @@ Reply> ModrinthAPI::searchMods(const QString name, int in if(type != ModLoaderType::Any) categoryFacets << "categories:" + ModLoaderType::toString(type); - //loader type + //category for(const auto &category : categories) if(!category.isEmpty()) categoryFacets << "categories:" + category; diff --git a/src/ui/curseforge/curseforgemodbrowser.ui b/src/ui/curseforge/curseforgemodbrowser.ui index 68704c37..0df651b7 100644 --- a/src/ui/curseforge/curseforgemodbrowser.ui +++ b/src/ui/curseforge/curseforgemodbrowser.ui @@ -68,6 +68,11 @@ 41 + + + Featured + + Popularity @@ -103,6 +108,26 @@ Game Version + + + Early Access + + + + + Featured Released + + + + + Released Date + + + + + Rating + + @@ -139,7 +164,7 @@ 0 0 800 - 27 + 26 diff --git a/src/ui/modrinth/modrinthmodbrowser.ui b/src/ui/modrinth/modrinthmodbrowser.ui index b5a1f4e1..e5abe91f 100644 --- a/src/ui/modrinth/modrinthmodbrowser.ui +++ b/src/ui/modrinth/modrinthmodbrowser.ui @@ -70,7 +70,7 @@ - Updated + Follows @@ -78,6 +78,11 @@ Newest + + + Updated + + @@ -96,7 +101,7 @@ 0 0 800 - 27 + 26