瀏覽代碼

client login

deason 3 年之前
父節點
當前提交
d5c8dd6959

+ 23 - 0
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/VerifyCodeController.java

@@ -5,6 +5,7 @@ import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.dao.enums.LoginRuleType;
 import cn.com.qmth.examcloud.core.basic.service.LoginRuleService;
 import cn.com.qmth.examcloud.core.basic.service.VerifyCodeService;
+import cn.com.qmth.examcloud.core.basic.service.bean.ClientLoginInfo;
 import cn.com.qmth.examcloud.core.basic.service.bean.GeetestLoginInfo;
 import cn.com.qmth.examcloud.starters.greetest.model.RegisterReq;
 import cn.com.qmth.examcloud.starters.greetest.model.RegisterResp;
@@ -47,6 +48,28 @@ public class VerifyCodeController extends ControllerSupport {
         return geetestService.register(req);
     }
 
+    @Naked
+    @WithoutStackTrace
+    @ApiOperation(value = "客户端登录接口")
+    @PostMapping(value = "/api/ecs_core/client/login")
+    public StatusResponseX<User> clientLogin(@RequestBody ClientLoginInfo info, HttpServletRequest request) {
+        setAlwaysOKResponse();
+
+        if (info.getRootOrgId() == null) {
+            throw new StatusException("400", "顶级机构ID不能为空");
+        }
+
+        GeetestLoginInfo loginInfo = new GeetestLoginInfo();
+        loginInfo.setRootOrgId(info.getRootOrgId());
+        loginInfo.setAccountType(info.getAccountType());
+        loginInfo.setAccountValue(info.getAccountValue());
+        loginInfo.setPassword(info.getPassword());
+        loginInfo.setIp_address(super.getIp(request));
+
+        User user = verifyCodeService.geetestLogin(loginInfo);
+        return new StatusResponseX<>(user);
+    }
+
     @Naked
     @WithoutStackTrace
     @ApiOperation(value = "极验-验证码登录接口")

+ 57 - 0
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/ClientLoginInfo.java

@@ -0,0 +1,57 @@
+package cn.com.qmth.examcloud.core.basic.service.bean;
+
+import cn.com.qmth.examcloud.api.commons.exchange.JsonSerializable;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 登陆信息
+ */
+public class ClientLoginInfo implements JsonSerializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("顶级机构ID")
+    private Long rootOrgId;
+
+    @ApiModelProperty("登陆账号类型")
+    private String accountType;
+
+    @ApiModelProperty("登陆账号")
+    private String accountValue;
+
+    @ApiModelProperty("登陆密码")
+    private String password;
+
+    public Long getRootOrgId() {
+        return rootOrgId;
+    }
+
+    public void setRootOrgId(Long rootOrgId) {
+        this.rootOrgId = rootOrgId;
+    }
+
+    public String getAccountType() {
+        return accountType;
+    }
+
+    public void setAccountType(String accountType) {
+        this.accountType = accountType;
+    }
+
+    public String getAccountValue() {
+        return accountValue;
+    }
+
+    public void setAccountValue(String accountValue) {
+        this.accountValue = accountValue;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+}