修复图书馆请求的一些智障操作

old-package
lensfrex 2 years ago
parent 6cd228098c
commit 6eaeadb11d
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 2
      mywust-core/src/main/java/cn/linghang/mywust/core/api/LibraryUrls.java
  2. 2
      mywust-core/src/main/java/cn/linghang/mywust/core/request/factory/library/LibraryRequestFactory.java
  3. 22
      mywust-core/src/main/java/cn/linghang/mywust/core/request/service/library/LibraryApiService.java

@ -13,7 +13,7 @@ public class LibraryUrls {
public static final String LIBRARY_LOAN_HISTORY_API = "https://libsys.wust.edu.cn/meta-local/opac/users/loan_hists?page=1&pageSize=100"; public static final String LIBRARY_LOAN_HISTORY_API = "https://libsys.wust.edu.cn/meta-local/opac/users/loan_hists?page=1&pageSize=100";
public static final String LIBRARY_OVERDUE_SOON_API = "https://libsys.wust.edu.cn/meta-local/opac/users/overdue_soon"; public static final String LIBRARY_OVERDUE_SOON_API = "https://libsys.wust.edu.cn/meta-local/opac/users/overdue_soon";
public static final String LIBRARY_BOOK_INFO_API = "https://libsys.wust.edu.cn/meta-local/opac/bibs/%s/holdings"; public static final String LIBRARY_BOOK_INFO_API = "https://libsys.wust.edu.cn/meta-local/opac/bibs/%s/infos";
public static final String LIBRARY_BOOK_COVER_IMAGE_API = "https://libsys.wust.edu.cn/meta-local/opac/search/extend/"; public static final String LIBRARY_BOOK_COVER_IMAGE_API = "https://libsys.wust.edu.cn/meta-local/opac/search/extend/";

@ -25,7 +25,7 @@ public class LibraryRequestFactory extends RequestFactory {
} }
public static HttpRequest bookSearchRequest(String keyword, int page, int pageSize) { public static HttpRequest bookSearchRequest(String keyword, int page, int pageSize) {
return bookSearchRequest(new SearchRequest(keyword, page, pageSize)); return bookSearchRequest(new SearchRequest(keyword, pageSize, page));
} }
public static HttpRequest bookSearchRequest(SearchRequest request) { public static HttpRequest bookSearchRequest(SearchRequest request) {

@ -21,46 +21,46 @@ public class LibraryApiService extends LibraryApiServiceBase {
HttpResponse response = requester.post(request); HttpResponse response = requester.post(request);
checkResponse(response); checkResponse(response);
return request.getStringData(); return response.getStringBody();
} }
public String getBookDetail(String bookId) throws ApiException, IOException { public String getBookDetail(String bookId) throws ApiException, IOException {
HttpRequest request = LibraryRequestFactory.bookInfoRequest(bookId); HttpRequest request = LibraryRequestFactory.bookInfoRequest(bookId);
HttpResponse response = requester.post(request); HttpResponse response = requester.get(request);
checkResponse(response); checkResponse(response);
return request.getStringData(); return response.getStringBody();
} }
public String getBookCoverImageUrl(String isbn) throws ApiException, IOException { public String getBookCoverImageUrl(String isbn) throws ApiException, IOException {
HttpRequest request = LibraryRequestFactory.bookCoverImageUrlRequest(isbn); HttpRequest request = LibraryRequestFactory.bookCoverImageUrlRequest(isbn);
HttpResponse response = requester.post(request); HttpResponse response = requester.get(request);
checkResponse(response); checkResponse(response);
return request.getStringData(); return response.getStringBody();
} }
public String getOverdueSoon(String cookie) throws ApiException, IOException { public String getOverdueSoon(String cookie) throws ApiException, IOException {
HttpRequest request = LibraryRequestFactory.overdueSoonRequest(cookie); HttpRequest request = LibraryRequestFactory.overdueSoonRequest(cookie);
HttpResponse response = requester.post(request); HttpResponse response = requester.get(request);
checkResponse(response); checkResponse(response);
return request.getStringData(); return response.getStringBody();
} }
public String getCurrentLoan(String cookie) throws ApiException, IOException { public String getCurrentLoan(String cookie) throws ApiException, IOException {
HttpRequest request = LibraryRequestFactory.currentLoanRequest(cookie); HttpRequest request = LibraryRequestFactory.currentLoanRequest(cookie);
HttpResponse response = requester.post(request); HttpResponse response = requester.get(request);
checkResponse(response); checkResponse(response);
return request.getStringData(); return response.getStringBody();
} }
public String getLoanHistory(String cookie) throws ApiException, IOException { public String getLoanHistory(String cookie) throws ApiException, IOException {
HttpRequest request = LibraryRequestFactory.loanHistoryRequest(cookie); HttpRequest request = LibraryRequestFactory.loanHistoryRequest(cookie);
HttpResponse response = requester.post(request); HttpResponse response = requester.get(request);
checkResponse(response); checkResponse(response);
return request.getStringData(); return response.getStringBody();
} }
} }
Loading…
Cancel
Save