package com.vci.ubcs.code.controller;
|
|
import com.vci.ubcs.code.service.IPasswordFreeLoginService;
|
import io.swagger.annotations.Api;
|
import org.springblade.core.log.exception.ServiceException;
|
import org.springblade.core.tool.api.R;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.servlet.http.HttpServletRequest;
|
|
/**
|
* @author ludc
|
* @date 2023/9/12 9:07
|
*/
|
@RestController
|
@RequestMapping("/passwordFree")
|
@Api(value = "免密登录接口", tags = "免密登录接口")
|
public class PasswordFreeLoginController {
|
|
@Resource
|
private IPasswordFreeLoginService passwordFreeLoginService;
|
|
@PostMapping("/login")
|
public R passwordFreeLogin(@RequestParam String username, HttpServletRequest request) {
|
boolean status;
|
try {
|
status = passwordFreeLoginService.passwordFreeLogin(username,request);
|
}catch (Exception e){
|
throw new ServiceException("免密登录获取token失败:"+e.getMessage());
|
}
|
return R.status(status);
|
}
|
|
}
|