完成支付功能
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
// 错误处理
|
||||
|
||||
Reference in New Issue
Block a user