feat: 本科生:新增登陆时新生信息未录入或毕业生删号错误处理

ref: 本科生:优化普通接口在其他年级专属选课时间段内被封号的数据处理
main
lensfrex 1 year ago
parent 0ca9d1a48d
commit 5da31b26d1
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 5
      mywust-common/src/main/java/cn/wustlinghang/mywust/exception/ApiException.java
  2. 3
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/auth/UndergraduateLogin.java
  3. 11
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradApiServiceBase.java

@ -104,6 +104,11 @@ public class ApiException extends BasicException {
*/
UNDERGRAD_BANNED_IN_EXCLUSIVE_TIME(100108, "本科生登录:专属选课时间段账号被禁用"),
/**
* 用户名信息不存在新生信息未录入或者老生删档
*/
UNDERGRAD_USERINFO_NOT_EXISTS(100109, "本科生登录:用户名信息(新生信息未录入或者老生删档)"),
// --------------------------------
// 共有异常码:cookie无效

@ -115,6 +115,9 @@ public class UndergraduateLogin {
} else if (test.contains("禁用")) {
// 选课时间段
throw new ApiException(ApiException.Code.UNDERGRAD_BANNED_IN_EXCLUSIVE_TIME);
} else if (test.contains("不存在")) {
// 新生信息未录入/老生被删号
throw new ApiException(ApiException.Code.UNDERGRAD_USERINFO_NOT_EXISTS);
}
return true;

@ -1,13 +1,13 @@
package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.wustlinghang.mywust.core.api.UndergradUrls;
import cn.wustlinghang.mywust.network.request.RequestFactory;
import cn.wustlinghang.mywust.core.util.BkjxUtil;
import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.wustlinghang.mywust.network.Requester;
import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import cn.wustlinghang.mywust.network.request.RequestFactory;
import java.io.IOException;
import java.util.Map;
@ -21,12 +21,13 @@ public abstract class UndergradApiServiceBase {
public void checkResponse(HttpResponse response) throws ApiException {
// 检查响应是否正确
if (response.getBody() == null ||
boolean cookieInvalid = response.getBody() == null ||
response.getStatusCode() != HttpResponse.HTTP_OK ||
BkjxUtil.needLogin(response.getBody()) ||
BkjxUtil.isBannedResponse(response)) {
BkjxUtil.needLogin(response.getBody());
if (cookieInvalid) {
throw new ApiException(ApiException.Code.COOKIE_INVALID);
} else if (BkjxUtil.isBannedResponse(response)) {
throw new ApiException(ApiException.Code.UNDERGRAD_BANNED_IN_EXCLUSIVE_TIME);
}
}

Loading…
Cancel
Save