|
@@ -2,7 +2,7 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-04-11 10:16:41
|
|
* @Date: 2025-04-11 10:16:41
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-04-16 11:59:51
|
|
|
|
|
|
|
+ * @LastEditTime: 2025-04-16 15:01:15
|
|
|
* @Description:
|
|
* @Description:
|
|
|
*/
|
|
*/
|
|
|
// ServerHandler.ts
|
|
// ServerHandler.ts
|
|
@@ -81,6 +81,8 @@ export class ServerHandler {
|
|
|
game.curLevelConfig = data.currentLevelConf;
|
|
game.curLevelConfig = data.currentLevelConf;
|
|
|
game.costInfo = data.handlingChargeConf;
|
|
game.costInfo = data.handlingChargeConf;
|
|
|
game.eventType = data.currentLevelConf.eventType;
|
|
game.eventType = data.currentLevelConf.eventType;
|
|
|
|
|
+ account.wxCoin = this.formatNumber(data.props['1005'], 1000);
|
|
|
|
|
+ account.hbCoin = this.formatNumber(data.props['1004'], 100);
|
|
|
oops.message.dispatchEvent(GameEvent.UserLogin);
|
|
oops.message.dispatchEvent(GameEvent.UserLogin);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -98,7 +100,7 @@ export class ServerHandler {
|
|
|
onDailyReward(str: string) {
|
|
onDailyReward(str: string) {
|
|
|
console.log('[服务器] 每日奖励返回', str);
|
|
console.log('[服务器] 每日奖励返回', str);
|
|
|
let result = JSON.parse(str);
|
|
let result = JSON.parse(str);
|
|
|
- smc.account.AccountModel.hbCoin = result.props["1004"] / 100;
|
|
|
|
|
|
|
+ smc.account.AccountModel.hbCoin = this.formatNumber(result.props["1004"], 100);
|
|
|
smc.account.AccountModel.xcCount = result.props["1007"]; //消除次数
|
|
smc.account.AccountModel.xcCount = result.props["1007"]; //消除次数
|
|
|
smc.account.AccountModel.goldCoin = result.props["1006"] //金砖数量
|
|
smc.account.AccountModel.goldCoin = result.props["1006"] //金砖数量
|
|
|
smc.game.GameModel.wxCash = result.money;
|
|
smc.game.GameModel.wxCash = result.money;
|
|
@@ -122,7 +124,7 @@ export class ServerHandler {
|
|
|
onHbTxInfo(str: string) {
|
|
onHbTxInfo(str: string) {
|
|
|
console.log('[服务器] 获取红包页面信息返回', str);
|
|
console.log('[服务器] 获取红包页面信息返回', str);
|
|
|
let result = JSON.parse(str);
|
|
let result = JSON.parse(str);
|
|
|
- smc.account.AccountModel.hbCoin = result.props["1004"] / 100;
|
|
|
|
|
|
|
+ smc.account.AccountModel.hbCoin = this.formatNumber(result.props["1004"], 100);
|
|
|
smc.account.AccountModel.xcCount = result.props["1007"]; //消除次数
|
|
smc.account.AccountModel.xcCount = result.props["1007"]; //消除次数
|
|
|
smc.account.AccountModel.goldCoin = result.props["1006"] //金砖数量
|
|
smc.account.AccountModel.goldCoin = result.props["1006"] //金砖数量
|
|
|
//要根据taskList的status排序,可领取再在前边,领取完在最后0 进行中 1 可领取 2已经领取
|
|
//要根据taskList的status排序,可领取再在前边,领取完在最后0 进行中 1 可领取 2已经领取
|
|
@@ -130,6 +132,7 @@ export class ServerHandler {
|
|
|
if (a.status === 1 && b.status !== 1) return -1; // a 在前
|
|
if (a.status === 1 && b.status !== 1) return -1; // a 在前
|
|
|
})
|
|
})
|
|
|
smc.game.GameModel.taskList = taskList;
|
|
smc.game.GameModel.taskList = taskList;
|
|
|
|
|
+ smc.game.GameModel.wxCash = result.money;
|
|
|
oops.message.dispatchEvent(GameEvent.openView, "openRedBagView");
|
|
oops.message.dispatchEvent(GameEvent.openView, "openRedBagView");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -147,10 +150,11 @@ export class ServerHandler {
|
|
|
const props = result.data.props;
|
|
const props = result.data.props;
|
|
|
const account = smc.account.AccountModel;
|
|
const account = smc.account.AccountModel;
|
|
|
const game = smc.game.GameModel;
|
|
const game = smc.game.GameModel;
|
|
|
- account.wxCoin = props['1005'];
|
|
|
|
|
- account.hbCoin = props['1004'];
|
|
|
|
|
|
|
+ account.wxCoin = this.formatNumber(props['1005'], 1000);
|
|
|
|
|
+ account.hbCoin = this.formatNumber(props['1004'], 100);
|
|
|
account.goldCoin = props['1006'];
|
|
account.goldCoin = props['1006'];
|
|
|
- game.handlingCharge = props['1009'];
|
|
|
|
|
|
|
+ game.handlingCharge = this.formatNumber(props['1009'], 1000);
|
|
|
|
|
+ //返回成功才登录
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//获取提现记录
|
|
//获取提现记录
|
|
@@ -202,7 +206,9 @@ export class ServerHandler {
|
|
|
onRebates(str: string) {
|
|
onRebates(str: string) {
|
|
|
console.log('[服务器] 提现返利信息', str);
|
|
console.log('[服务器] 提现返利信息', str);
|
|
|
let result = JSON.parse(str);
|
|
let result = JSON.parse(str);
|
|
|
- smc.game.GameModel.cashNum = result.props["1004"] / 100;
|
|
|
|
|
|
|
+ smc.game.GameModel.cashNum = this.formatNumber(result.props["1004"], 100);
|
|
|
|
|
+ smc.account.AccountModel.hbCoin = this.formatNumber(result.props["1004"], 100);
|
|
|
|
|
+ smc.game.GameModel.changeHbCoin = this.formatNumber(result.changes["1004"], 100);
|
|
|
oops.message.dispatchEvent(GameEvent.openView, "openRebateView")
|
|
oops.message.dispatchEvent(GameEvent.openView, "openRebateView")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -244,10 +250,11 @@ export class ServerHandler {
|
|
|
const changes = result.changes;
|
|
const changes = result.changes;
|
|
|
const account = smc.account.AccountModel;
|
|
const account = smc.account.AccountModel;
|
|
|
const game = smc.game.GameModel;
|
|
const game = smc.game.GameModel;
|
|
|
- account.wxCoin = props['1005'];
|
|
|
|
|
- account.hbCoin = props['1004'];
|
|
|
|
|
- game.changeHbCoin = changes['1004'] / 100;
|
|
|
|
|
- game.changeWxCoin = changes['1005'] / 1000;
|
|
|
|
|
|
|
+ //全部取小数点后两位
|
|
|
|
|
+ account.hbCoin = this.formatNumber(props['1004'], 100);
|
|
|
|
|
+ account.wxCoin = this.formatNumber(props['1005'], 1000);
|
|
|
|
|
+ game.changeHbCoin = this.formatNumber(changes['1004'], 100);
|
|
|
|
|
+ game.changeWxCoin = this.formatNumber(changes['1005'], 1000);
|
|
|
oops.message.dispatchEvent(GameEvent.showCoinAnimation);
|
|
oops.message.dispatchEvent(GameEvent.showCoinAnimation);
|
|
|
//还要知道是不是二倍速的
|
|
//还要知道是不是二倍速的
|
|
|
}
|
|
}
|
|
@@ -285,10 +292,10 @@ export class ServerHandler {
|
|
|
console.log('[服务器] 直接领取通关奖励成功返回', str);
|
|
console.log('[服务器] 直接领取通关奖励成功返回', str);
|
|
|
let result = JSON.parse(str);
|
|
let result = JSON.parse(str);
|
|
|
//全部取小数点后两位
|
|
//全部取小数点后两位
|
|
|
- smc.game.GameModel.changeHbCoin = result.changes["1004"] / 100;
|
|
|
|
|
- smc.game.GameModel.changeHbCoin = result.changes["1005"] / 1000;
|
|
|
|
|
- smc.account.AccountModel.hbCoin = result.props["1004"] / 100;
|
|
|
|
|
- smc.account.AccountModel.wxCoin = result.props["1005"] / 1000;
|
|
|
|
|
|
|
+ smc.game.GameModel.changeHbCoin = this.formatNumber(result.changes['1004'], 100);
|
|
|
|
|
+ smc.game.GameModel.changeWxCoin = this.formatNumber(result.changes['1005'], 1000);
|
|
|
|
|
+ smc.account.AccountModel.hbCoin = this.formatNumber(result.props["1004"], 100);
|
|
|
|
|
+ smc.account.AccountModel.wxCoin = this.formatNumber(result.props["1005"], 1000);
|
|
|
oops.message.dispatchEvent(GameEvent.showCoinAnimation);
|
|
oops.message.dispatchEvent(GameEvent.showCoinAnimation);
|
|
|
//请求下一局
|
|
//请求下一局
|
|
|
this.getNextLevel();
|
|
this.getNextLevel();
|
|
@@ -350,10 +357,10 @@ export class ServerHandler {
|
|
|
const changes = result.changes;
|
|
const changes = result.changes;
|
|
|
const account = smc.account.AccountModel;
|
|
const account = smc.account.AccountModel;
|
|
|
const game = smc.game.GameModel;
|
|
const game = smc.game.GameModel;
|
|
|
- account.wxCoin = props['1005'];
|
|
|
|
|
- account.hbCoin = props['1004'];
|
|
|
|
|
- game.changeHbCoin = changes['1004'] / 100;
|
|
|
|
|
- game.changeWxCoin = changes['1005'] / 1000;
|
|
|
|
|
|
|
+ account.wxCoin = this.formatNumber(props['1005'], 1000);
|
|
|
|
|
+ account.hbCoin = this.formatNumber(props['1004'], 100);
|
|
|
|
|
+ game.changeHbCoin = this.formatNumber(changes['1004'], 100);
|
|
|
|
|
+ game.changeWxCoin = this.formatNumber(changes['1005'], 1000);
|
|
|
oops.message.dispatchEvent(GameEvent.showCoinAnimation);
|
|
oops.message.dispatchEvent(GameEvent.showCoinAnimation);
|
|
|
//还要知道是不是二倍速的
|
|
//还要知道是不是二倍速的
|
|
|
}
|
|
}
|
|
@@ -489,6 +496,17 @@ export class ServerHandler {
|
|
|
onRequestFail(code: number, str: string) {
|
|
onRequestFail(code: number, str: string) {
|
|
|
console.log('[服务器] 请求失败', code, str);
|
|
console.log('[服务器] 请求失败', code, str);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //小数点保留两位小数,返回的还是数字,不是字符串
|
|
|
|
|
+ formatNumber(num: number, type: number) {
|
|
|
|
|
+ num = num / type;
|
|
|
|
|
+ const str = num.toFixed(2);
|
|
|
|
|
+ return parseFloat(str);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
window["ServerHandler"] = ServerHandler;
|
|
window["ServerHandler"] = ServerHandler;
|