|
@@ -2,12 +2,17 @@ package com.flyer.foster.controller.app;
|
|
|
|
|
|
import com.flyer.foster.dto.app.AppUserQueryDTO;
|
|
import com.flyer.foster.dto.app.AppUserQueryDTO;
|
|
import com.flyer.foster.service.IAppUserService;
|
|
import com.flyer.foster.service.IAppUserService;
|
|
|
|
+import com.flyer.util.JwtUtil;
|
|
import com.flyer.util.R;
|
|
import com.flyer.util.R;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 小程序用户
|
|
* 小程序用户
|
|
*
|
|
*
|
|
@@ -18,10 +23,28 @@ import org.springframework.web.bind.annotation.RestController;
|
|
@RequestMapping("/app/user")
|
|
@RequestMapping("/app/user")
|
|
public class AppUserController {
|
|
public class AppUserController {
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private JwtUtil jwtUtil;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private IAppUserService iAppUserService;
|
|
private IAppUserService iAppUserService;
|
|
|
|
|
|
@RequestMapping("/login")
|
|
@RequestMapping("/login")
|
|
public R login(@RequestBody AppUserQueryDTO dto) {
|
|
public R login(@RequestBody AppUserQueryDTO dto) {
|
|
return R.ok().result(iAppUserService.login(dto));
|
|
return R.ok().result(iAppUserService.login(dto));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成飞鸟看园token
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/generate-birdseye-token")
|
|
|
|
+ public R generateBirdseyeToken() {
|
|
|
|
+ String audience = "sysuimars";
|
|
|
|
+ String subject = "api";
|
|
|
|
+ Map<String, Object> claims = new HashMap<>();
|
|
|
|
+ claims.put("userid", 12);
|
|
|
|
+ String birdseyeToken = jwtUtil.createBirdseyeToken(claims, audience, subject);
|
|
|
|
+ return R.ok().result(birdseyeToken);
|
|
|
|
+ }
|
|
}
|
|
}
|