|
@@ -70,10 +70,14 @@ public class TokenController extends BaseController {
|
|
|
|
|
|
@PostMapping(value = "/smsLogin", consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
|
@ApiOperation(value = "短信验证码的方式登录")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "smsCode", value = "验证码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "clientSecret", value = "固定传 app", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "clientId", value = "固定传 app", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String")})
|
|
|
+ @ApiImplicitParam(name = "clientSecret", value = "固定传 app", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "smsCode", value = "验证码", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "isSurportRegister", value = "是否在登录时注册", dataType = "Boolean"),
|
|
|
+ @ApiImplicitParam(name = "loginUserType", value = "登录用户类型 STUDENT TEACHER(官网登录)", dataType = "String")
|
|
|
+ })
|
|
|
public Object smsLogin() {
|
|
|
return succeed();
|
|
|
}
|
|
@@ -99,10 +103,13 @@ public class TokenController extends BaseController {
|
|
|
|
|
|
@PostMapping(value = "/usernameLogin", consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
|
@ApiOperation(value = "手机号密码方式登录")
|
|
|
- @ApiImplicitParams({@ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "clientSecret", value = "固定传 app", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "clientId", value = "固定传 app", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "username", value = "手机号", required = true, dataType = "String")})
|
|
|
+ @ApiImplicitParam(name = "clientSecret", value = "固定传 app", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "username", value = "手机号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "password", value = "密码", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "loginUserType", value = "登录用户类型 STUDENT TEACHER(官网登录)", dataType = "String")
|
|
|
+ })
|
|
|
public Object usernameLogin() {
|
|
|
return succeed();
|
|
|
}
|
|
@@ -177,13 +184,8 @@ public class TokenController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 获取二维码登录code(不需要鉴权)
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
@GetMapping("/getQRLoginCode")
|
|
|
- @ApiOperation(value = "获取二维码登录code")
|
|
|
+ @ApiOperation(value = "获取二维码登录code(不需要鉴权)")
|
|
|
public HttpResponseResult<QRLoginDto> getQRLoginCode(
|
|
|
@ApiParam(value = "clientId", required = true) @RequestParam("clientId") String clientId,
|
|
|
@ApiParam(value = "clientSecret", required = true) @RequestParam("clientSecret") String clientSecret) {
|
|
@@ -208,13 +210,8 @@ public class TokenController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 前端轮询登录(不需要鉴权)
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
@GetMapping("/pollingQRLoginCode")
|
|
|
- @ApiOperation(value = "获取二维码登录code")
|
|
|
+ @ApiOperation(value = "前端轮询登录(不需要鉴权)")
|
|
|
public HttpResponseResult<QRLoginDto> pollingQRLoginCode(@ApiParam(value = "二维码登录code", required = true) @RequestParam("code") String code) {
|
|
|
if (StringUtil.isEmpty(code)) {
|
|
|
return HttpResponseResult.failed("登录失败");
|
|
@@ -229,12 +226,6 @@ public class TokenController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 二维码登录
|
|
|
- *
|
|
|
- * @return
|
|
|
- * @throws IOException
|
|
|
- */
|
|
|
@GetMapping(value = "/qrLogin")
|
|
|
@ApiOperation(value = "二维码登录")
|
|
|
public HttpResponseResult<QRLoginDto> qrLogin(
|
|
@@ -277,16 +268,15 @@ public class TokenController extends BaseController {
|
|
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
|
|
|
|
|
Map map = objectMapper.readValue(resp.getBody(), Map.class);
|
|
|
- Boolean status = (Boolean)map.get("status");
|
|
|
- if(status){
|
|
|
+ Boolean status = (Boolean) map.get("status");
|
|
|
+ if (status) {
|
|
|
dto.setCodeStatus("succeed");
|
|
|
Object obj = JSONObject.parseObject(JSONObject.toJSONString(map.get("data"))).get("authentication");
|
|
|
dto.setAuthentication(obj);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
dto.setCodeStatus("filed");
|
|
|
}
|
|
|
redissonClient.getBucket(CacheNameEnum.QR_LOGIN_CODE.getRedisKey(code)).set(dto, 5, TimeUnit.MINUTES);
|
|
|
return succeed(dto);
|
|
|
}
|
|
|
-
|
|
|
}
|