|
|
@@ -0,0 +1,41 @@ |
|
|
|
package com.taauav.front.controller; |
|
|
|
|
|
|
|
import com.taauav.admin.entity.LsAdmin; |
|
|
|
import com.taauav.admin.service.ILsAdminService; |
|
|
|
import com.taauav.common.bean.Response; |
|
|
|
import com.taauav.common.util.JwtUtil; |
|
|
|
import io.jsonwebtoken.Claims; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/front/user") |
|
|
|
public class LSUserController extends FrontBaseController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ILsAdminService adminService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private Response response; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前登录人信息 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/info") |
|
|
|
public Response info(HttpServletRequest request) { |
|
|
|
String token = request.getHeader("token"); |
|
|
|
Claims data = JwtUtil.parseJWT(token); |
|
|
|
this.userId = Integer.valueOf(data.get("id").toString()); |
|
|
|
LsAdmin adminInfo = adminService.getById(this.userId); |
|
|
|
return response.success(adminInfo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |