修改api地址

This commit is contained in:
kron
2025-06-14 22:45:16 +08:00
parent 9a051aca20
commit 7ac84a6129
2 changed files with 5 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
const BASE_URL = "http://120.79.241.5:8000/api/shoot"; const BASE_URL = "https://api.shelingxingqiu.com/api/shoot";
function request(method, url, data = {}) { function request(method, url, data = {}) {
const token = uni.getStorageSync("token"); const token = uni.getStorageSync("token");
@@ -207,11 +207,6 @@ export const getBattleListAPI = async (page, battleType) => {
.sort((a, b) => b.totalScore - a.totalScore), .sort((a, b) => b.totalScore - a.totalScore),
}); });
}); });
console.log(1111, result);
return data; return data;
}; };
export const getBattleDetailAPI = (id) => {
return request("POST", "/user/battle/detail", {
id,
});
};

View File

@@ -5,8 +5,9 @@ let heartbeatInterval = null;
* 建立 WebSocket 连接 * 建立 WebSocket 连接
*/ */
function createWebSocket(token, onMessage) { function createWebSocket(token, onMessage) {
const url = `wss://api.shelingxingqiu.com/socket?authorization=${token}`;
socket = uni.connectSocket({ socket = uni.connectSocket({
url: `ws://120.79.241.5:8000/socket?authorization=${token}`, url,
success: () => console.log("websocket 连接成功"), success: () => console.log("websocket 连接成功"),
}); });
@@ -23,7 +24,7 @@ function createWebSocket(token, onMessage) {
uni.onSocketClose((result) => { uni.onSocketClose((result) => {
console.log("WebSocket 已关闭", result); console.log("WebSocket 已关闭", result);
socket = uni.connectSocket({ socket = uni.connectSocket({
url: `ws://120.79.241.5:8000/socket?authorization=${token}`, url,
success: () => console.log("websocket 连接成功"), success: () => console.log("websocket 连接成功"),
}); });
}); });