本地调试成功
This commit is contained in:
@@ -48,7 +48,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/user/account/token/", "/user/account/register/").permitAll()
|
||||
.antMatchers("/api/user/account/token/", "/api/user/account/register/").permitAll()
|
||||
.antMatchers("/pk/start/","/pk/receive/bot/move/").hasIpAddress("127.0.0.1")
|
||||
.antMatchers(HttpMethod.OPTIONS).permitAll()
|
||||
.anyRequest().authenticated();
|
||||
|
||||
-1
@@ -10,7 +10,6 @@ import com.kob.backend.mapper.UserMapper;
|
||||
import com.kob.backend.pojo.User;
|
||||
import com.kob.backend.service.impl.utils.UserDetailsImpl;
|
||||
import com.kob.backend.utils.JwtUtil;
|
||||
import com.sun.xml.internal.bind.v2.TODO;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -46,8 +46,8 @@ public class WebSocketServer {
|
||||
private User user;
|
||||
public Game game = null;
|
||||
// addPlayer 添加用户到匹配池的 URL; removePlayer 从匹配池移除用户的 URL
|
||||
private final static String addPlayerUrl = "http://127.0.0.1:3001/player/add/";
|
||||
private final static String removePlayerUrl = "http://127.0.0.1:3001/player/remove/";
|
||||
private final static String addPlayerUrl = "http://127.0.0.1:3002/player/add/";
|
||||
private final static String removePlayerUrl = "http://127.0.0.1:3002/player/remove/";
|
||||
|
||||
@Autowired
|
||||
public void setRestTemplate(RestTemplate restTemplate) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Game extends Thread {
|
||||
// 定义失败者: all(平局), A(A输), B(B输)
|
||||
private String loser = "";
|
||||
// 传送消息给 BotRunningSystem 的链接
|
||||
private static final String addBotUrl = "http://127.0.0.1:3002/bot/add/";
|
||||
private static final String addBotUrl = "http://127.0.0.1:3003/bot/add/";
|
||||
|
||||
|
||||
// 初始化(有参)构造函数
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// 微服务内部 api
|
||||
package com.kob.backend.controller.pk;
|
||||
|
||||
import com.kob.backend.service.pk.ReceiveBotMoveService;
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// 微服务内部 api
|
||||
package com.kob.backend.controller.pk;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class GetRankListController {
|
||||
@Autowired
|
||||
private GetRankListService getRankListService;
|
||||
|
||||
@GetMapping("/ranklist/getranklist/")
|
||||
@GetMapping("/api/ranklist/getranklist/")
|
||||
JSONObject getRankList(@RequestParam Map<String, String> data) {
|
||||
Integer page = Integer.parseInt(data.get("page_index"));
|
||||
Integer.parseInt(data.get("page_index"));
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class GetRecordListController {
|
||||
private GetRecordListService getRecordListService;
|
||||
|
||||
// 这里只需要获取,因此只需要用 get 方法(需要新建和修改数据时,使用 post 方法)
|
||||
@GetMapping("/record/getlist/")
|
||||
@GetMapping("/api/record/getlist/")
|
||||
public JSONObject getList(@RequestParam Map<String, String> data) {
|
||||
// 解析出 page 信息
|
||||
Integer page = Integer.parseInt(data.get("page_index"));
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public class InfoController {
|
||||
private InfoService infoService;
|
||||
|
||||
// 获取信息
|
||||
@GetMapping("/user/account/info/")
|
||||
@GetMapping("/api/user/account/info/")
|
||||
public Map<String,String> getInfo(){
|
||||
return infoService.getInfo();
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ public class LoginController {
|
||||
private LoginService loginService;
|
||||
|
||||
// 登录使用 POST 请求,密文传输,更安全
|
||||
@PostMapping("/user/account/token/")
|
||||
@PostMapping("/api/user/account/token/")
|
||||
public Map<String,String> getToken(@RequestParam Map<String,String> map){
|
||||
String username = map.get("username");
|
||||
String password = map.get("password");
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public class RegisterController {
|
||||
@Autowired
|
||||
private RegisterService registerService;
|
||||
|
||||
@PostMapping("/user/account/register/")
|
||||
@PostMapping("/api/user/account/register/")
|
||||
public Map<String, String> register(@RequestParam Map<String, String> map) {
|
||||
String username = map.get("username");
|
||||
String password = map.get("password");
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ public class AddController {
|
||||
@Autowired
|
||||
private AddService addService;
|
||||
|
||||
@PostMapping("/user/bot/add/")
|
||||
@PostMapping("/api/user/bot/add/")
|
||||
public Map<String,String> add(@RequestParam Map<String,String> data){
|
||||
return addService.add(data);
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ public class GetListController {
|
||||
@Autowired
|
||||
private GetListService getListService;
|
||||
|
||||
@GetMapping("/user/bot/getlist/")
|
||||
@GetMapping("/api/user/bot/getlist/")
|
||||
public List<Bot> getList(){
|
||||
return getListService.getList();
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public class RemoveController {
|
||||
@Autowired
|
||||
private RemoveService removeService;
|
||||
|
||||
@PostMapping("/user/bot/remove/")
|
||||
@PostMapping("/api/user/bot/remove/")
|
||||
public Map<String,String> remove(@RequestParam Map<String,String> data){
|
||||
return removeService.remove(data);
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ public class UpdateController {
|
||||
@Autowired
|
||||
private UpdateService updateService;
|
||||
|
||||
@PostMapping("/user/bot/update/")
|
||||
@PostMapping("/api/user/bot/update/")
|
||||
public Map<String,String> update(@RequestParam Map<String,String> data){
|
||||
return updateService.update(data);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#default server port
|
||||
server.port=3000
|
||||
server.port=3001
|
||||
|
||||
#mysql database connect profile
|
||||
spring.datasource.username=root
|
||||
|
||||
Reference in New Issue
Block a user