ky 6 years ago
parent 8ea09cf171
commit c4f7a5db86

@ -75,7 +75,7 @@ public class MyRealm extends AuthorizingRealm {
if(userType.equals("miniUser")){
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("openId", username);
columnMap.put("open_id", username);
List<MiniUser> miniUsers = miniUserMapper.selectByMap(columnMap);
if(miniUsers.size()==0){
throw new AuthenticationException("用户不存在!");

@ -94,6 +94,28 @@ public class LoginController {
// }
//
//
/**
*
*
* @return
*/
@PostMapping("/minitestlogin")
@ApiImplicitParams({
@ApiImplicitParam(name = "openid", value = "openid", dataType = "string", paramType = "query"),
})
public Result minitestlogin(String openid, HttpServletResponse response) {
boolean login = true;
if (login) {
Cookie cookie = new Cookie("username", openid);
cookie.setMaxAge(60 * 60);
cookie.setPath("/");
response.addCookie(cookie);
String sign = JwtUtils.sign(openid, openid,"miniUser");
return ResultBuilder.withPayload(sign).build();
} else {
return ResultBuilder.error("登录失败").build();
}
}
/**
* pc
*

Loading…
Cancel
Save