You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
942 B
Java
29 lines
942 B
Java
2 years ago
|
package com.supervision.controller;
|
||
|
|
||
|
import cn.hutool.core.util.StrUtil;
|
||
|
import cn.hutool.json.JSONObject;
|
||
|
import cn.hutool.json.JSONUtil;
|
||
|
import cn.hutool.jwt.JWTUtil;
|
||
|
import cn.hutool.jwt.signers.JWTSigner;
|
||
|
import cn.hutool.jwt.signers.JWTSignerUtil;
|
||
|
import com.supervision.domain.UserInfo;
|
||
|
import com.supervision.exception.BusinessException;
|
||
|
import com.supervision.util.TokenUtil;
|
||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
@RestController
|
||
|
@RequestMapping("user")
|
||
|
public class UserController {
|
||
|
|
||
|
@GetMapping("login")
|
||
|
public String login(String userName, String password) {
|
||
|
if (StrUtil.isBlank(userName)) {
|
||
|
throw new BusinessException("用户名不能为空");
|
||
|
}
|
||
|
UserInfo userInfo = new UserInfo();
|
||
|
return TokenUtil.creatToken(userInfo);
|
||
|
}
|
||
|
}
|