ludc
2023-09-19 8381325223bee254168855b1b697db31fc591b9e
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/PasswordFreeLoginController.java
@@ -2,12 +2,12 @@
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
 * @author ludc
@@ -21,13 +21,15 @@
   @Resource
   private IPasswordFreeLoginService passwordFreeLoginService;
   @GetMapping("/login")
   public R passwordFreeLogin(String account) {
      boolean resBoolean = passwordFreeLoginService.passwordFreeLogin(account);
      return R.status(resBoolean);
   @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);
   }
}