diff --git a/backendCloud/backend/pom.xml b/backendCloud/backend/pom.xml index c253734..9e02d68 100644 --- a/backendCloud/backend/pom.xml +++ b/backendCloud/backend/pom.xml @@ -11,6 +11,7 @@ com.kob.backend backend + jar 8 @@ -100,4 +101,22 @@ + + + + org.springframework.boot + spring-boot-maven-plugin + + com.kob.backend.BackendApplication + + + + + repackage + + + + + + \ No newline at end of file diff --git a/backendCloud/backend/src/main/java/com/kob/backend/config/SecurityConfig.java b/backendCloud/backend/src/main/java/com/kob/backend/config/SecurityConfig.java index 868fcb0..1c4dbf6 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/config/SecurityConfig.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/config/SecurityConfig.java @@ -43,7 +43,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/game/").hasIpAddress("127.0.0.1") .antMatchers("/pk/receive/bot/move/").hasIpAddress("127.0.0.1") .antMatchers(HttpMethod.OPTIONS).permitAll() diff --git a/backendCloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java b/backendCloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java index 0254fcc..779340f 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java @@ -45,8 +45,8 @@ public class WebSocketServer { // 注入RestTemplate public static RestTemplate restTemplate; // 可以作用于两个springboot进程间的通信 - private static final String addPlayerUrl = "http://127.0.0.1:3001/player/add/"; - private static final String removePlayerUrl = "http://127.0.0.1:3001/player/remove/"; + private static final String addPlayerUrl = "http://127.0.0.1:4001/player/add/"; + private static final String removePlayerUrl = "http://127.0.0.1:4001/player/remove/"; @Autowired diff --git a/backendCloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java b/backendCloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java index bd53dfd..a61fbc4 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java @@ -34,7 +34,7 @@ public class Game extends Thread { private String status = "playing"; // playing -> finished private String loser = "";// "all": 平局 "A": A输 "B": B输 - private final static String addBotUrl = "http://127.0.0.1:3002/bot/add/"; + private final static String addBotUrl = "http://127.0.0.1:4002/bot/add/"; public Game(Integer rows, Integer cols, Integer inner_walls_count, Integer idA, Integer idB, Bot bot_a,Bot bot_b) { this.rows = rows; diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/ranklist/GetRankListController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/ranklist/GetRankListController.java index 4182b56..dde73ac 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/ranklist/GetRankListController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/ranklist/GetRankListController.java @@ -16,7 +16,7 @@ public class GetRankListController { @Autowired private GetRankListService getRankListService; - @GetMapping("/ranklist/getlist/") + @GetMapping("/api/ranklist/getlist/") public JSONObject getList(@RequestParam Map data) { Integer page = Integer.parseInt(data.get("page")); return getRankListService.getList(page); diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/record/GetRecordListController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/record/GetRecordListController.java index 4d44070..31ffd26 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/record/GetRecordListController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/record/GetRecordListController.java @@ -15,7 +15,7 @@ public class GetRecordListController { @Autowired private GetRecordListService getRecordListService; - @GetMapping("/record/list/") + @GetMapping("/api/record/list/") public JSONObject getList(@RequestParam MultiValueMap data) { Integer page = Integer.parseInt(Objects.requireNonNull(data.getFirst("page"))); return getRecordListService.getList(page); diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/InfoServiceController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/InfoServiceController.java index e624ddd..340aaa7 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/InfoServiceController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/InfoServiceController.java @@ -15,7 +15,7 @@ public class InfoServiceController { @Autowired private InfoService infoService; - @GetMapping("/user/account/info/") + @GetMapping("/api/user/account/info/") public Map getInfo() { return infoService.getInfo(); } diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/LoginController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/LoginController.java index 961a5c8..fb6acb9 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/LoginController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/LoginController.java @@ -16,7 +16,7 @@ public class LoginController { @Autowired private LoginService loginService; - @PostMapping("/user/account/token/") + @PostMapping("/api/user/account/token/") // 利用RequestParam注解将用户名和密码存到一个Map中 public Map getToken(@RequestParam Map map) { String username = map.get("username"); diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/RegisterController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/RegisterController.java index 8a4d57a..d73c0d3 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/RegisterController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/RegisterController.java @@ -16,7 +16,7 @@ public class RegisterController{ @Autowired private RegisterService registerService; - @PostMapping("/user/account/register/") + @PostMapping("/api/user/account/register/") public Map register(@RequestParam Map map) { String username = map.get("username"); diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/AddController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/AddController.java index bcaf1f2..9699771 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/AddController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/AddController.java @@ -16,7 +16,7 @@ public class AddController { @Autowired private AddService addService; - @PostMapping("/user/bot/add/") + @PostMapping("/api/user/bot/add/") public Map add(@RequestParam Map data){ return addService.add(data); } diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/GetListController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/GetListController.java index 11a13b6..92e6c72 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/GetListController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/GetListController.java @@ -17,7 +17,7 @@ public class GetListController { @Autowired private GetListService getListService; - @GetMapping("/user/bot/getlist") + @GetMapping("/api/user/bot/getlist") public List getList() { return getListService.getList(); } diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/RemoveController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/RemoveController.java index 5bc4a71..cb16b8e 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/RemoveController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/RemoveController.java @@ -16,7 +16,7 @@ public class RemoveController { @Autowired private RemoveService removeService; - @PostMapping("/user/bot/remove/") + @PostMapping("/api/user/bot/remove/") public Map remove(@RequestParam Map data) { return removeService.remove(data); } diff --git a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/UpdateController.java b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/UpdateController.java index be5c2c9..c03209b 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/UpdateController.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/UpdateController.java @@ -16,7 +16,7 @@ public class UpdateController { @Autowired private UpdateService updateService; - @PostMapping("/user/bot/update/") + @PostMapping("/api/user/bot/update/") public Map update(@RequestParam Map data) { return updateService.update(data); } diff --git a/backendCloud/backend/src/main/java/com/kob/backend/service/impl/ranklist/GetRankListServiceImpl.java b/backendCloud/backend/src/main/java/com/kob/backend/service/impl/ranklist/GetRankListServiceImpl.java index c5eeae8..8f61629 100644 --- a/backendCloud/backend/src/main/java/com/kob/backend/service/impl/ranklist/GetRankListServiceImpl.java +++ b/backendCloud/backend/src/main/java/com/kob/backend/service/impl/ranklist/GetRankListServiceImpl.java @@ -19,7 +19,7 @@ public class GetRankListServiceImpl implements GetRankListService { @Override public JSONObject getList(Integer page) { JSONObject resp = new JSONObject(); - IPage userIPage = new Page<>(page,3); // 每页展示3个 + IPage userIPage = new Page<>(page,8); // 每页展示8个 QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.orderByDesc("rating"); // 分值从高到低排序 List users = userMapper.selectPage(userIPage,queryWrapper).getRecords();// 返回满足条件的users diff --git a/backendCloud/backend/src/main/resources/application.properties b/backendCloud/backend/src/main/resources/application.properties index 092a61b..c8fb5c0 100644 --- a/backendCloud/backend/src/main/resources/application.properties +++ b/backendCloud/backend/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.port=3000 +server.port=4000 spring.datasource.username=root spring.datasource.password=zfp251217 spring.datasource.url=jdbc:mysql://101.33.213.197:3307/kob?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8 diff --git a/backendCloud/backend/src/test/java/com/kob/backend/BackendApplicationTests.java b/backendCloud/backend/src/test/java/com/kob/backend/BackendApplicationTests.java index ab85ecb..f9a5121 100644 --- a/backendCloud/backend/src/test/java/com/kob/backend/BackendApplicationTests.java +++ b/backendCloud/backend/src/test/java/com/kob/backend/BackendApplicationTests.java @@ -2,35 +2,12 @@ package com.kob.backend; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; -@SpringBootTest +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class BackendApplicationTests { @Test void contextLoads() { - PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); -// // 编码后的值不同 -// String str1 = passwordEncoder.encode("zfp"); -// String str2 = passwordEncoder.encode("zfp"); -// System.out.println(str1); -// System.out.println(str2); -// // 但是匹配的结果正确 -// System.out.println(passwordEncoder.matches("zfp",str1)); -// System.out.println(passwordEncoder.matches("zfp",str2)); -// // 匹配失败 -// System.out.println(passwordEncoder.matches("zfp1",str2)); - // 将数据库中的明文密码编码为密文 - // user1,user2,user3 - System.out.println(passwordEncoder.encode("123456")); - System.out.println(passwordEncoder.encode("test")); - System.out.println(passwordEncoder.encode("root")); - - String str = "$2a$10$ZgDd5mwlUUIRLlRaXMoisO1M7SI5ol6jN5NZV8AQ4/Aho7QD1xUqO"; - System.out.println(passwordEncoder.matches("123456",str)); - - } diff --git a/backendCloud/botRunningSystem/pom.xml b/backendCloud/botRunningSystem/pom.xml index 7714b70..c99a2bc 100644 --- a/backendCloud/botRunningSystem/pom.xml +++ b/backendCloud/botRunningSystem/pom.xml @@ -11,6 +11,7 @@ com.kob.botRunningSystem botRunningSystem + jar 8 @@ -57,7 +58,25 @@ 0.9.14 - + + + + org.springframework.boot + spring-boot-maven-plugin + + com.kob.botRunningSystem.BotRunningSystemApplication + + + + + repackage + + + + + + + \ No newline at end of file diff --git a/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/BotRunningServiceImpl.java b/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/BotRunningServiceImpl.java index 2941826..0586e2f 100644 --- a/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/BotRunningServiceImpl.java +++ b/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/BotRunningServiceImpl.java @@ -9,7 +9,6 @@ public class BotRunningServiceImpl implements BotRunningService { public static final BotPool botpool = new BotPool(); @Override public String addBot(Integer userId, String botCode, String input) { - System.out.println("add bot: " + userId + " " + botCode + " " + input); botpool.addBot(userId,botCode,input); return "add bot success"; } diff --git a/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/utils/Consumer.java b/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/utils/Consumer.java index 711c64a..5b854ad 100644 --- a/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/utils/Consumer.java +++ b/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/utils/Consumer.java @@ -1,13 +1,17 @@ package com.kob.botRunningSystem.Service.impl.utils; -import com.kob.botRunningSystem.utils.BotInterface; import org.joor.Reflect; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintWriter; import java.util.UUID; +import java.util.function.Supplier; @Component @@ -17,7 +21,7 @@ public class Consumer extends Thread{ private static RestTemplate restTemplate; - private static final String receiveBotMoveUrl = "http://127.0.0.1:3000/pk/receive/bot/move/"; + private static final String receiveBotMoveUrl = "http://127.0.0.1:4000/pk/receive/bot/move/"; @Autowired private void setRestTemplate(RestTemplate restTemplate) { @@ -37,7 +41,7 @@ public class Consumer extends Thread{ } private String addUid(String code,String uid) { // 在Code的bot类名后添加uid - int k = code.indexOf(" implements com.kob.botRunningSystem.utils.BotInterface"); + int k = code.indexOf(" implements java.util.function.Supplier"); return code.substring(0,k) + uid + code.substring(k); } @@ -49,10 +53,19 @@ public class Consumer extends Thread{ UUID uuid = UUID.randomUUID(); String uid = uuid.toString().substring(0,8); // 获取8位随机字符串 - BotInterface botInterface = Reflect.compile( + Supplier botInterface = Reflect.compile( "com.kob.botRunningSystem.utils.Bot" + uid, addUid(bot.getBotCode(),uid)).create().get(); - Integer direction = botInterface.nextMove(bot.getInput()); + File file = new File("input.txt"); + try (PrintWriter fout = new PrintWriter(file)){ + fout.println(bot.getInput()); + fout.flush(); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + + + Integer direction = botInterface.get(); System.out.println("move-direction: " + bot.getUserId() + " " + direction); MultiValueMap data = new LinkedMultiValueMap<>(); diff --git a/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/utils/Bot.java b/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/utils/Bot.java index cdc2584..e47771a 100644 --- a/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/utils/Bot.java +++ b/backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/utils/Bot.java @@ -1,9 +1,25 @@ package com.kob.botRunningSystem.utils; +import java.io.File; +import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; +import java.util.Scanner; + +public class Bot implements java.util.function.Supplier{ + + + @Override + public Integer get() { + File file = new File("input.txt"); + try { + Scanner sc = new Scanner(file); + return nextMove(sc.next()); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + } -public class Bot implements com.kob.botRunningSystem.utils.BotInterface{ static class Cell{ public int x,y; public Cell(int x,int y) { @@ -43,7 +59,6 @@ public class Bot implements com.kob.botRunningSystem.utils.BotInterface{ return res; } - @Override public Integer nextMove(String input) { String[] strs = input.split("#"); int [][] g = new int[13][14]; diff --git a/backendCloud/botRunningSystem/src/main/resources/application.properties b/backendCloud/botRunningSystem/src/main/resources/application.properties index 36f374e..ee12fdc 100644 --- a/backendCloud/botRunningSystem/src/main/resources/application.properties +++ b/backendCloud/botRunningSystem/src/main/resources/application.properties @@ -1 +1 @@ -server.port=3002 \ No newline at end of file +server.port=4002 \ No newline at end of file diff --git a/backendCloud/input.txt b/backendCloud/input.txt new file mode 100644 index 0000000..8615ed2 --- /dev/null +++ b/backendCloud/input.txt @@ -0,0 +1 @@ +11111111111111100000011000011000000001000111100000000101101000000000011100000000000110001011010001100000000000111000000000010110100000000111100010000000011000011000000111111111111111#1#12#(2222230030001122222)#11#1#(0000010100001112112) diff --git a/backendCloud/matchingsystem/pom.xml b/backendCloud/matchingsystem/pom.xml index f99a842..081db41 100644 --- a/backendCloud/matchingsystem/pom.xml +++ b/backendCloud/matchingsystem/pom.xml @@ -8,6 +8,7 @@ 0.0.1-SNAPSHOT 4.0.0 + jar com.kob.matchingsystem matchingsystem @@ -53,4 +54,23 @@ + + + + org.springframework.boot + spring-boot-maven-plugin + + com.kob.matchingsystem.MatchingSystemApplication + + + + + repackage + + + + + + + \ No newline at end of file diff --git a/backendCloud/matchingsystem/src/main/java/com/kob/matchingsystem/service/impl/utils/MatchingPool.java b/backendCloud/matchingsystem/src/main/java/com/kob/matchingsystem/service/impl/utils/MatchingPool.java index bea9902..1bdfbad 100644 --- a/backendCloud/matchingsystem/src/main/java/com/kob/matchingsystem/service/impl/utils/MatchingPool.java +++ b/backendCloud/matchingsystem/src/main/java/com/kob/matchingsystem/service/impl/utils/MatchingPool.java @@ -18,7 +18,7 @@ public class MatchingPool extends Thread{ private static RestTemplate restTemplate; - private static final String startGameUrl= "http://127.0.0.1:3000/pk/start/game/"; + private static final String startGameUrl= "http://127.0.0.1:4000/pk/start/game/"; @Autowired public void setRestTemplate(RestTemplate restTemplate) { @@ -65,7 +65,6 @@ public class MatchingPool extends Thread{ // 尝试匹配玩家 private void matchPlayer() { - System.out.println("match_players: " + players.toString()); boolean[] used = new boolean[players.size()]; // 记录用户是否已经被匹配 for (int i = 0; i < players.size(); i++) { diff --git a/backendCloud/matchingsystem/src/main/resources/application.properties b/backendCloud/matchingsystem/src/main/resources/application.properties index 032aec6..70b46e2 100644 --- a/backendCloud/matchingsystem/src/main/resources/application.properties +++ b/backendCloud/matchingsystem/src/main/resources/application.properties @@ -1 +1 @@ -server.port=3001 \ No newline at end of file +server.port=4001 \ No newline at end of file diff --git a/web/src/components/MatchGround.vue b/web/src/components/MatchGround.vue index c34a620..39765ed 100644 --- a/web/src/components/MatchGround.vue +++ b/web/src/components/MatchGround.vue @@ -73,7 +73,7 @@ export default { const refresh_bots = () => { $.ajax({ - url: "http://localhost:3000/user/bot/getlist/", + url: "https://kob.bnblogs.cc/api/user/bot/getlist/", type: "GET", headers:{ "Authorization": "Bearer " + store.state.user.token, // 任何需要登录才能显示的都要加这个验证 diff --git a/web/src/store/user.js b/web/src/store/user.js index a1b7a9b..e27b62b 100644 --- a/web/src/store/user.js +++ b/web/src/store/user.js @@ -35,7 +35,7 @@ export default { actions: { // 在actions中调用修改全局变量的函数 login(context,data) { $.ajax({ - url: "http://localhost:3000/user/account/token/", + url: "https://kob.bnblogs.cc/api/user/account/token/", type : "POST", data: { username: data.username, @@ -61,7 +61,7 @@ export default { }, getInfo(context,data) { $.ajax({ - url: "http://localhost:3000/user/account/info/", + url: "https://kob.bnblogs.cc/api/user/account/info/", type: "GET", headers: { Authorization: "Bearer " + context.state.token, diff --git a/web/src/views/pk/PkIndexView.vue b/web/src/views/pk/PkIndexView.vue index d5a6563..38977b0 100644 --- a/web/src/views/pk/PkIndexView.vue +++ b/web/src/views/pk/PkIndexView.vue @@ -24,7 +24,7 @@ export default { }, setup() { const store = useStore(); - const socket_url = `ws://localhost:3000/websocket/${store.state.user.token}/`; + const socket_url = `wss://kob.bnblogs.cc/websocket/${store.state.user.token}/`; store.commit("updateLoser","none"); store.commit("updateIsRecord",false); diff --git a/web/src/views/ranklist/RanklistIndexView.vue b/web/src/views/ranklist/RanklistIndexView.vue index 5beec35..38a0695 100644 --- a/web/src/views/ranklist/RanklistIndexView.vue +++ b/web/src/views/ranklist/RanklistIndexView.vue @@ -57,7 +57,7 @@ export default { let pages = ref([]); // 展示的多个对战页面 const updatePages = () => { - let max_pages = parseInt(Math.ceil(total_users / 3)); + let max_pages = parseInt(Math.ceil(total_users / 8)); let new_pages = []; for (let i = currentPage - 2; i <= currentPage + 2; i++) { if (i >= 1 && i <= max_pages) { @@ -73,7 +73,7 @@ export default { const click_page = page => { if (page === -2) page = currentPage - 1; else if (page === -1) page = currentPage + 1; - let max_pages = parseInt(Math.ceil(total_users / 3)); + let max_pages = parseInt(Math.ceil(total_users / 8)); if (page >= 1 && page <= max_pages) { pull_page(page); @@ -85,7 +85,7 @@ export default { const pull_page = page => { currentPage = page; $.ajax({ - url: "http://localhost:3000/ranklist/getlist/", + url: "https://kob.bnblogs.cc/api/ranklist/getlist/", type: "GET", data: { page diff --git a/web/src/views/record/RecordIndexView.vue b/web/src/views/record/RecordIndexView.vue index d2afc60..8b967e6 100644 --- a/web/src/views/record/RecordIndexView.vue +++ b/web/src/views/record/RecordIndexView.vue @@ -102,7 +102,7 @@ export default { const pull_page = page => { currentPage = page; $.ajax({ - url: "http://localhost:3000/record/list/", + url: "https://kob.bnblogs.cc/api/record/list/", type: "GET", data: { page diff --git a/web/src/views/user/account/UserRegisterView.vue b/web/src/views/user/account/UserRegisterView.vue index 4bf96d0..83b5e31 100644 --- a/web/src/views/user/account/UserRegisterView.vue +++ b/web/src/views/user/account/UserRegisterView.vue @@ -59,7 +59,7 @@ export default { let error_msg = ref(""); const register = () => { $.ajax({ - url: "http://localhost:3000/user/account/register/", + url: "https://kob.bnblogs.cc/api/user/account/register/", type: "POST", data: { username: username.value, diff --git a/web/src/views/user/bot/UserBotIndexView.vue b/web/src/views/user/bot/UserBotIndexView.vue index 385be3f..dd81e44 100644 --- a/web/src/views/user/bot/UserBotIndexView.vue +++ b/web/src/views/user/bot/UserBotIndexView.vue @@ -161,7 +161,7 @@ export default { const refresh_bots = () => { $.ajax({ - url: "http://localhost:3000/user/bot/getlist/", + url: "https://kob.bnblogs.cc/api/user/bot/getlist/", type: "GET", headers:{ "Authorization": "Bearer " + store.state.user.token, // 任何需要登录才能显示的都要加这个验证 @@ -178,7 +178,7 @@ export default { const add_bot = () => { new_bot.error_msg = ""; $.ajax({ - url: "http://localhost:3000/user/bot/add/", + url: "https://kob.bnblogs.cc/api/user/bot/add/", type: "POST", data: { title: new_bot.title, @@ -207,7 +207,7 @@ export default { // 点击更新bot按钮触发的事件 const update_bot = (bot) => { $.ajax({ - url: "http://localhost:3000/user/bot/update/", + url: "https://kob.bnblogs.cc/api/user/bot/update/", type: "POST", data: { bot_id: bot.id, @@ -233,7 +233,7 @@ export default { // 点击删除bot按钮触发的事件 const remove_bot = (bot) => { $.ajax({ - url: "http://localhost:3000/user/bot/remove/", + url: "https://kob.bnblogs.cc/api/user/bot/remove/", type: "POST", data: { bot_id: bot.id