完成支付功能

This commit is contained in:
kron
2025-07-12 17:12:24 +08:00
parent c6e53453fb
commit cae46224a3
7 changed files with 73 additions and 15 deletions

View File

@@ -32,10 +32,11 @@ function createWebSocket(token, onMessage) {
// 接收消息
uni.onSocketMessage((res) => {
const data = JSON.parse(res.data);
if(data.event === 'pong' || !data.data.updates) return;
if (data.event === "pong" || !data.data.updates) return;
if (onMessage) onMessage(data.data.updates);
const msg = data.data.updates[0];
if (msg && msg.constructor === MESSAGETYPES.BackToGame) {
if (!msg) return;
if (msg.constructor === MESSAGETYPES.BackToGame) {
const { battleInfo } = msg;
uni.setStorageSync(`battle-${battleInfo.id}`, battleInfo);
// 约战
@@ -57,6 +58,9 @@ function createWebSocket(token, onMessage) {
}
}
}
if (msg.constructor === MESSAGETYPES.PaySuccess) {
console.log(1111111, msg);
}
});
// 错误处理