项目上线

master
barney 2 years ago
parent 45013c89df
commit 2c381678af
  1. 19
      backendCloud/backend/pom.xml
  2. 2
      backendCloud/backend/src/main/java/com/kob/backend/config/SecurityConfig.java
  3. 4
      backendCloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java
  4. 2
      backendCloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java
  5. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/ranklist/GetRankListController.java
  6. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/record/GetRecordListController.java
  7. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/InfoServiceController.java
  8. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/LoginController.java
  9. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/account/RegisterController.java
  10. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/AddController.java
  11. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/GetListController.java
  12. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/RemoveController.java
  13. 2
      backendCloud/backend/src/main/java/com/kob/backend/controller/user/bot/UpdateController.java
  14. 2
      backendCloud/backend/src/main/java/com/kob/backend/service/impl/ranklist/GetRankListServiceImpl.java
  15. 2
      backendCloud/backend/src/main/resources/application.properties
  16. 25
      backendCloud/backend/src/test/java/com/kob/backend/BackendApplicationTests.java
  17. 21
      backendCloud/botRunningSystem/pom.xml
  18. 1
      backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/BotRunningServiceImpl.java
  19. 23
      backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/Service/impl/utils/Consumer.java
  20. 19
      backendCloud/botRunningSystem/src/main/java/com/kob/botRunningSystem/utils/Bot.java
  21. 2
      backendCloud/botRunningSystem/src/main/resources/application.properties
  22. 1
      backendCloud/input.txt
  23. 20
      backendCloud/matchingsystem/pom.xml
  24. 3
      backendCloud/matchingsystem/src/main/java/com/kob/matchingsystem/service/impl/utils/MatchingPool.java
  25. 2
      backendCloud/matchingsystem/src/main/resources/application.properties
  26. 2
      web/src/components/MatchGround.vue
  27. 4
      web/src/store/user.js
  28. 2
      web/src/views/pk/PkIndexView.vue
  29. 6
      web/src/views/ranklist/RanklistIndexView.vue
  30. 2
      web/src/views/record/RecordIndexView.vue
  31. 2
      web/src/views/user/account/UserRegisterView.vue
  32. 8
      web/src/views/user/bot/UserBotIndexView.vue

@ -11,6 +11,7 @@
<groupId>com.kob.backend</groupId> <groupId>com.kob.backend</groupId>
<artifactId>backend</artifactId> <artifactId>backend</artifactId>
<packaging>jar</packaging>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
@ -100,4 +101,22 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.kob.backend.BackendApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

@ -43,7 +43,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and() .and()
.authorizeRequests() .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/start/game/").hasIpAddress("127.0.0.1")
.antMatchers("/pk/receive/bot/move/").hasIpAddress("127.0.0.1") .antMatchers("/pk/receive/bot/move/").hasIpAddress("127.0.0.1")
.antMatchers(HttpMethod.OPTIONS).permitAll() .antMatchers(HttpMethod.OPTIONS).permitAll()

@ -45,8 +45,8 @@ public class WebSocketServer {
// 注入RestTemplate // 注入RestTemplate
public static RestTemplate restTemplate; // 可以作用于两个springboot进程间的通信 public static RestTemplate restTemplate; // 可以作用于两个springboot进程间的通信
private static final String addPlayerUrl = "http://127.0.0.1:3001/player/add/"; private static final String addPlayerUrl = "http://127.0.0.1:4001/player/add/";
private static final String removePlayerUrl = "http://127.0.0.1:3001/player/remove/"; private static final String removePlayerUrl = "http://127.0.0.1:4001/player/remove/";
@Autowired @Autowired

@ -34,7 +34,7 @@ public class Game extends Thread {
private String status = "playing"; // playing -> finished private String status = "playing"; // playing -> finished
private String loser = "";// "all": 平局 "A": A输 "B": B输 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) { public Game(Integer rows, Integer cols, Integer inner_walls_count, Integer idA, Integer idB, Bot bot_a,Bot bot_b) {
this.rows = rows; this.rows = rows;

@ -16,7 +16,7 @@ public class GetRankListController {
@Autowired @Autowired
private GetRankListService getRankListService; private GetRankListService getRankListService;
@GetMapping("/ranklist/getlist/") @GetMapping("/api/ranklist/getlist/")
public JSONObject getList(@RequestParam Map<String,String> data) { public JSONObject getList(@RequestParam Map<String,String> data) {
Integer page = Integer.parseInt(data.get("page")); Integer page = Integer.parseInt(data.get("page"));
return getRankListService.getList(page); return getRankListService.getList(page);

@ -15,7 +15,7 @@ public class GetRecordListController {
@Autowired @Autowired
private GetRecordListService getRecordListService; private GetRecordListService getRecordListService;
@GetMapping("/record/list/") @GetMapping("/api/record/list/")
public JSONObject getList(@RequestParam MultiValueMap<String,String> data) { public JSONObject getList(@RequestParam MultiValueMap<String,String> data) {
Integer page = Integer.parseInt(Objects.requireNonNull(data.getFirst("page"))); Integer page = Integer.parseInt(Objects.requireNonNull(data.getFirst("page")));
return getRecordListService.getList(page); return getRecordListService.getList(page);

@ -15,7 +15,7 @@ public class InfoServiceController {
@Autowired @Autowired
private InfoService infoService; private InfoService infoService;
@GetMapping("/user/account/info/") @GetMapping("/api/user/account/info/")
public Map<String, String> getInfo() { public Map<String, String> getInfo() {
return infoService.getInfo(); return infoService.getInfo();
} }

@ -16,7 +16,7 @@ public class LoginController {
@Autowired @Autowired
private LoginService loginService; private LoginService loginService;
@PostMapping("/user/account/token/") @PostMapping("/api/user/account/token/")
// 利用RequestParam注解将用户名和密码存到一个Map中 // 利用RequestParam注解将用户名和密码存到一个Map中
public Map<String ,String> getToken(@RequestParam Map<String,String> map) { public Map<String ,String> getToken(@RequestParam Map<String,String> map) {
String username = map.get("username"); String username = map.get("username");

@ -16,7 +16,7 @@ public class RegisterController{
@Autowired @Autowired
private RegisterService registerService; private RegisterService registerService;
@PostMapping("/user/account/register/") @PostMapping("/api/user/account/register/")
public Map<String,String> register(@RequestParam Map<String,String> map) { public Map<String,String> register(@RequestParam Map<String,String> map) {
String username = map.get("username"); String username = map.get("username");

@ -16,7 +16,7 @@ public class AddController {
@Autowired @Autowired
private AddService addService; private AddService addService;
@PostMapping("/user/bot/add/") @PostMapping("/api/user/bot/add/")
public Map<String, String> add(@RequestParam Map<String,String> data){ public Map<String, String> add(@RequestParam Map<String,String> data){
return addService.add(data); return addService.add(data);
} }

@ -17,7 +17,7 @@ public class GetListController {
@Autowired @Autowired
private GetListService getListService; private GetListService getListService;
@GetMapping("/user/bot/getlist") @GetMapping("/api/user/bot/getlist")
public List<Bot> getList() { public List<Bot> getList() {
return getListService.getList(); return getListService.getList();
} }

@ -16,7 +16,7 @@ public class RemoveController {
@Autowired @Autowired
private RemoveService removeService; private RemoveService removeService;
@PostMapping("/user/bot/remove/") @PostMapping("/api/user/bot/remove/")
public Map<String, String> remove(@RequestParam Map<String, String> data) { public Map<String, String> remove(@RequestParam Map<String, String> data) {
return removeService.remove(data); return removeService.remove(data);
} }

@ -16,7 +16,7 @@ public class UpdateController {
@Autowired @Autowired
private UpdateService updateService; private UpdateService updateService;
@PostMapping("/user/bot/update/") @PostMapping("/api/user/bot/update/")
public Map<String, String> update(@RequestParam Map<String, String> data) { public Map<String, String> update(@RequestParam Map<String, String> data) {
return updateService.update(data); return updateService.update(data);
} }

@ -19,7 +19,7 @@ public class GetRankListServiceImpl implements GetRankListService {
@Override @Override
public JSONObject getList(Integer page) { public JSONObject getList(Integer page) {
JSONObject resp = new JSONObject(); JSONObject resp = new JSONObject();
IPage<User> userIPage = new Page<>(page,3); // 每页展示3 IPage<User> userIPage = new Page<>(page,8); // 每页展示8
QueryWrapper<User> queryWrapper = new QueryWrapper<>(); QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("rating"); // 分值从高到低排序 queryWrapper.orderByDesc("rating"); // 分值从高到低排序
List<User> users = userMapper.selectPage(userIPage,queryWrapper).getRecords();// 返回满足条件的users List<User> users = userMapper.selectPage(userIPage,queryWrapper).getRecords();// 返回满足条件的users

@ -1,4 +1,4 @@
server.port=3000 server.port=4000
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=zfp251217 spring.datasource.password=zfp251217
spring.datasource.url=jdbc:mysql://101.33.213.197:3307/kob?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8 spring.datasource.url=jdbc:mysql://101.33.213.197:3307/kob?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8

@ -2,35 +2,12 @@ package com.kob.backend;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; 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 { class BackendApplicationTests {
@Test @Test
void contextLoads() { 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));
} }

@ -11,6 +11,7 @@
<groupId>com.kob.botRunningSystem</groupId> <groupId>com.kob.botRunningSystem</groupId>
<artifactId>botRunningSystem</artifactId> <artifactId>botRunningSystem</artifactId>
<packaging>jar</packaging>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
@ -57,7 +58,25 @@
<version>0.9.14</version> <version>0.9.14</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.kob.botRunningSystem.BotRunningSystemApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

@ -9,7 +9,6 @@ public class BotRunningServiceImpl implements BotRunningService {
public static final BotPool botpool = new BotPool(); public static final BotPool botpool = new BotPool();
@Override @Override
public String addBot(Integer userId, String botCode, String input) { public String addBot(Integer userId, String botCode, String input) {
System.out.println("add bot: " + userId + " " + botCode + " " + input);
botpool.addBot(userId,botCode,input); botpool.addBot(userId,botCode,input);
return "add bot success"; return "add bot success";
} }

@ -1,13 +1,17 @@
package com.kob.botRunningSystem.Service.impl.utils; package com.kob.botRunningSystem.Service.impl.utils;
import com.kob.botRunningSystem.utils.BotInterface;
import org.joor.Reflect; import org.joor.Reflect;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; 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.UUID;
import java.util.function.Supplier;
@Component @Component
@ -17,7 +21,7 @@ public class Consumer extends Thread{
private static RestTemplate restTemplate; 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 @Autowired
private void setRestTemplate(RestTemplate restTemplate) { private void setRestTemplate(RestTemplate restTemplate) {
@ -37,7 +41,7 @@ public class Consumer extends Thread{
} }
private String addUid(String code,String uid) { // 在Code的bot类名后添加uid 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<Integer>");
return code.substring(0,k) + uid + code.substring(k); return code.substring(0,k) + uid + code.substring(k);
} }
@ -49,10 +53,19 @@ public class Consumer extends Thread{
UUID uuid = UUID.randomUUID(); UUID uuid = UUID.randomUUID();
String uid = uuid.toString().substring(0,8); // 获取8位随机字符串 String uid = uuid.toString().substring(0,8); // 获取8位随机字符串
BotInterface botInterface = Reflect.compile( Supplier<Integer> botInterface = Reflect.compile(
"com.kob.botRunningSystem.utils.Bot" + uid, "com.kob.botRunningSystem.utils.Bot" + uid,
addUid(bot.getBotCode(),uid)).create().get(); 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); System.out.println("move-direction: " + bot.getUserId() + " " + direction);
MultiValueMap<String,String> data = new LinkedMultiValueMap<>(); MultiValueMap<String,String> data = new LinkedMultiValueMap<>();

@ -1,9 +1,25 @@
package com.kob.botRunningSystem.utils; package com.kob.botRunningSystem.utils;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner;
public class Bot implements java.util.function.Supplier<Integer>{
@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{ static class Cell{
public int x,y; public int x,y;
public Cell(int x,int y) { public Cell(int x,int y) {
@ -43,7 +59,6 @@ public class Bot implements com.kob.botRunningSystem.utils.BotInterface{
return res; return res;
} }
@Override
public Integer nextMove(String input) { public Integer nextMove(String input) {
String[] strs = input.split("#"); String[] strs = input.split("#");
int [][] g = new int[13][14]; int [][] g = new int[13][14];

@ -0,0 +1 @@
11111111111111100000011000011000000001000111100000000101101000000000011100000000000110001011010001100000000000111000000000010110100000000111100010000000011000011000000111111111111111#1#12#(2222230030001122222)#11#1#(0000010100001112112)

@ -8,6 +8,7 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<groupId>com.kob.matchingsystem</groupId> <groupId>com.kob.matchingsystem</groupId>
<artifactId>matchingsystem</artifactId> <artifactId>matchingsystem</artifactId>
@ -53,4 +54,23 @@
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.kob.matchingsystem.MatchingSystemApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

@ -18,7 +18,7 @@ public class MatchingPool extends Thread{
private static RestTemplate restTemplate; 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 @Autowired
public void setRestTemplate(RestTemplate restTemplate) { public void setRestTemplate(RestTemplate restTemplate) {
@ -65,7 +65,6 @@ public class MatchingPool extends Thread{
// 尝试匹配玩家 // 尝试匹配玩家
private void matchPlayer() { private void matchPlayer() {
System.out.println("match_players: " + players.toString());
boolean[] used = new boolean[players.size()]; // 记录用户是否已经被匹配 boolean[] used = new boolean[players.size()]; // 记录用户是否已经被匹配
for (int i = 0; i < players.size(); i++) { for (int i = 0; i < players.size(); i++) {

@ -73,7 +73,7 @@ export default {
const refresh_bots = () => { const refresh_bots = () => {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/bot/getlist/", url: "https://kob.bnblogs.cc/api/user/bot/getlist/",
type: "GET", type: "GET",
headers:{ headers:{
"Authorization": "Bearer " + store.state.user.token, // "Authorization": "Bearer " + store.state.user.token, //

@ -35,7 +35,7 @@ export default {
actions: { // 在actions中调用修改全局变量的函数 actions: { // 在actions中调用修改全局变量的函数
login(context,data) { login(context,data) {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/account/token/", url: "https://kob.bnblogs.cc/api/user/account/token/",
type : "POST", type : "POST",
data: { data: {
username: data.username, username: data.username,
@ -61,7 +61,7 @@ export default {
}, },
getInfo(context,data) { getInfo(context,data) {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/account/info/", url: "https://kob.bnblogs.cc/api/user/account/info/",
type: "GET", type: "GET",
headers: { headers: {
Authorization: "Bearer " + context.state.token, Authorization: "Bearer " + context.state.token,

@ -24,7 +24,7 @@ export default {
}, },
setup() { setup() {
const store = useStore(); 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("updateLoser","none");
store.commit("updateIsRecord",false); store.commit("updateIsRecord",false);

@ -57,7 +57,7 @@ export default {
let pages = ref([]); // let pages = ref([]); //
const updatePages = () => { const updatePages = () => {
let max_pages = parseInt(Math.ceil(total_users / 3)); let max_pages = parseInt(Math.ceil(total_users / 8));
let new_pages = []; let new_pages = [];
for (let i = currentPage - 2; i <= currentPage + 2; i++) { for (let i = currentPage - 2; i <= currentPage + 2; i++) {
if (i >= 1 && i <= max_pages) { if (i >= 1 && i <= max_pages) {
@ -73,7 +73,7 @@ export default {
const click_page = page => { const click_page = page => {
if (page === -2) page = currentPage - 1; if (page === -2) page = currentPage - 1;
else if (page === -1) 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) { if (page >= 1 && page <= max_pages) {
pull_page(page); pull_page(page);
@ -85,7 +85,7 @@ export default {
const pull_page = page => { const pull_page = page => {
currentPage = page; currentPage = page;
$.ajax({ $.ajax({
url: "http://localhost:3000/ranklist/getlist/", url: "https://kob.bnblogs.cc/api/ranklist/getlist/",
type: "GET", type: "GET",
data: { data: {
page page

@ -102,7 +102,7 @@ export default {
const pull_page = page => { const pull_page = page => {
currentPage = page; currentPage = page;
$.ajax({ $.ajax({
url: "http://localhost:3000/record/list/", url: "https://kob.bnblogs.cc/api/record/list/",
type: "GET", type: "GET",
data: { data: {
page page

@ -59,7 +59,7 @@ export default {
let error_msg = ref(""); let error_msg = ref("");
const register = () => { const register = () => {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/account/register/", url: "https://kob.bnblogs.cc/api/user/account/register/",
type: "POST", type: "POST",
data: { data: {
username: username.value, username: username.value,

@ -161,7 +161,7 @@ export default {
const refresh_bots = () => { const refresh_bots = () => {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/bot/getlist/", url: "https://kob.bnblogs.cc/api/user/bot/getlist/",
type: "GET", type: "GET",
headers:{ headers:{
"Authorization": "Bearer " + store.state.user.token, // "Authorization": "Bearer " + store.state.user.token, //
@ -178,7 +178,7 @@ export default {
const add_bot = () => { const add_bot = () => {
new_bot.error_msg = ""; new_bot.error_msg = "";
$.ajax({ $.ajax({
url: "http://localhost:3000/user/bot/add/", url: "https://kob.bnblogs.cc/api/user/bot/add/",
type: "POST", type: "POST",
data: { data: {
title: new_bot.title, title: new_bot.title,
@ -207,7 +207,7 @@ export default {
// bot // bot
const update_bot = (bot) => { const update_bot = (bot) => {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/bot/update/", url: "https://kob.bnblogs.cc/api/user/bot/update/",
type: "POST", type: "POST",
data: { data: {
bot_id: bot.id, bot_id: bot.id,
@ -233,7 +233,7 @@ export default {
// bot // bot
const remove_bot = (bot) => { const remove_bot = (bot) => {
$.ajax({ $.ajax({
url: "http://localhost:3000/user/bot/remove/", url: "https://kob.bnblogs.cc/api/user/bot/remove/",
type: "POST", type: "POST",
data: { data: {
bot_id: bot.id bot_id: bot.id

Loading…
Cancel
Save