@GetMapping("getInfo")
public AjaxResult getInfo() {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
return ajax;
}
这里前端返回的不是json字符串而是一个普通的字符串
但是把user对象换成普通字符串就可以
@GetMapping("getInfo")
public AjaxResult getInfo() {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success();
ajax.put("user", "123456");
return ajax;
}
这个是怎么回事