浏览代码

switch对接

甘艺伟 3 天之前
父节点
当前提交
afc35ec8bb

+ 5 - 5
assets/script/data/model/ChatModel.ts

@@ -145,8 +145,8 @@ export default class ChatModel extends IDataModel {
 
 	//获取聊天需要充值金额
 	getChatCz(bl: boolean = false) {
-		let chatCz = GameDataCenter.sevBack?.switch?.chatCz ?? 0;
-		let chatCzBl = GameDataCenter.sevBack?.switch?.chatCzBl ?? 1;
+		let chatCz = GameDataCenter.login.playerInfo?.switch?.chatCz ?? 0;
+		let chatCzBl = GameDataCenter.login.playerInfo?.switch?.chatCzBl ?? 1;
 		if (bl) {
 			return chatCz * chatCzBl;
 		}
@@ -155,7 +155,7 @@ export default class ChatModel extends IDataModel {
 	//获取用户实付金额
 	getIsCz(bl: boolean = false) {
 		let iscz = GameDataCenter.sevBack?.userInfo?.a?.chatNum ?? 0;
-		let chatCzBl = GameDataCenter.sevBack?.switch?.chatCzBl ?? 1;
+		let chatCzBl = GameDataCenter.login.playerInfo?.switch?.chatCzBl ?? 1;
 		if (bl) {
 			return iscz * chatCzBl;
 		}
@@ -164,8 +164,8 @@ export default class ChatModel extends IDataModel {
 
 	/**获得聊天同服 */
 	getServerList() {
-		let sid = GameDataCenter.sevBack?.userInfo?.a?.sid;
-		let serverList = GameDataCenter.sevBack?.qufuList;
+		let sid = GameDataCenter.user?.userInfo?.sid;
+		let serverList = GameDataCenter.login.playerInfo?.qufuList;
 		let heid = serverList?.[sid]?.heid;
 		let list: string[] = []
 		for (let key in serverList) {

+ 2 - 2
assets/script/data/model/Login/LoginModel.ts

@@ -8,7 +8,7 @@ import ThinkingDataMgr from "../../../utils/ThinkingDataMgr";
 import { GameEvent, LoadEvent, NetworkEvent } from "../../const/EventConst";
 import { DayTipsKey, GameErrCode, PlatformType, ReportRoleType } from "../../const/TypeConst";
 import GameDataCenter from "../../GameDataCenter";
-import { LoginModelData, PlayerInfo } from "./LoginModelData";
+import { LoginModelData } from "./LoginModelData";
 
 
 export default class LoginModel extends LoginModelData {
@@ -69,7 +69,7 @@ export default class LoginModel extends LoginModelData {
         let ret = await GameDataCenter.loginServer.ReqApi("player/PlayerLogin", param);
         if (ret.isSucc) {
             CC_PREVIEW && console.log("玩家登录成功", ret);
-            this.playerInfo = ret.res as PlayerInfo
+            this.playerInfo = ret.res
             GameDataCenter.gameServer.Init(ret.res.wsUrl);
             await GameDataCenter.gameServer.Connect();
             EventMng.emit(GameEvent.LOGIN_ACCOUNT_SUCC);

+ 2 - 13
assets/script/data/model/Login/LoginModelData.ts

@@ -1,21 +1,10 @@
 
-import { qufuInfo, ResLoginList } from "../../../shared/player/PtlLogin";
 import IDataModel from "../../../frameWork/model/IDataModel";
-export interface PlayerInfo {
-    uid: string; //uid
-    sid: string; //最后一次登陆区服
-    list: { [sid: string]: ResLoginList }; //每个区最多一个角色
-    token: string; //账号登陆验证码
-    //区服列表
-    qufuList: {
-        [sid: string]: qufuInfo
-    }
-    wsUrl: string; //ws地址
-}
+import { qufuInfo, ResLoginList, ResPlayerLogin } from "../../../shared/player/PtlPlayerLogin";
 
 /**
  * 定义 Model 的数据
  */
 export class LoginModelData extends IDataModel {
-    playerInfo: PlayerInfo;
+    playerInfo: ResPlayerLogin;
 }

+ 5 - 5
assets/script/data/model/OrderModel.ts

@@ -51,7 +51,7 @@ export default class OrderModel extends IDataModel {
                             sendParam["daibi"] = 0;
                             this.SendCharge(kid, orderList, dcData, sendUrl, sendParam, cb, count);
                         }
-                        else{
+                        else {
                             GameDataCenter.page.openShopVoucher();
                         }
                     }
@@ -116,7 +116,7 @@ export default class OrderModel extends IDataModel {
     }
 
     isCanCharge(kid: string): boolean {
-        if (!gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.djqPay) && kid != "actShopJinTiao") {
+        if (!gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.djqPay) && kid != "actShopJinTiao") {
             //17wan、微信小游戏的安卓不能直接支付
             return false;
         }
@@ -131,17 +131,17 @@ export default class OrderModel extends IDataModel {
     // 是否可以支付 (正常支付或下单直接领奖)
     get canPay(): boolean {
         // 无配置,走正常支付
-        if (gameMethod.isEmpty(GameDataCenter.sevBack?.switch?.openPays?.[Config.pid])) {
+        if (gameMethod.isEmpty(GameDataCenter.login.playerInfo?.switch?.openPays?.[Config.pid])) {
             return true
         }
-        return GameDataCenter.sevBack?.switch?.openPays[Config.pid] == 2
+        return GameDataCenter.login.playerInfo?.switch?.openPays[Config.pid] == 2
     }
 
     //ios是否开启支付
     get isOpenPay(): boolean {
         if (GameDataCenter.plat.instance.deviceOS == PlatFormDevType.ios || GameDataCenter.plat.instance.deviceOS == PlatFormDevType.mac) {
             //审核包关闭ios支付及所有入口
-            if (gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.iosPay)) {
+            if (gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.iosPay)) {
                 return false
             }
         }

+ 5 - 5
assets/script/frameWork/fgui/FguiMgr.ts

@@ -325,7 +325,7 @@ export default class FguiMgr extends Singleton<FguiMgr>() implements IUpdate, IL
         } else {
             this._addPkged.Add(pkgName, 1)
         }
-        if (!gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.clientLog)) {
+        if (!gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.clientLog)) {
             console.log(`${from} ${pkgName} count: ${this._addPkged.Value(pkgName)}`)
         }
     }
@@ -336,12 +336,12 @@ export default class FguiMgr extends Singleton<FguiMgr>() implements IUpdate, IL
             //已存在++
             let pkgCount = this._addPkged.Value(pkgName);
             pkgCount--;
-            if (!gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.clientLog)) {
+            if (!gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.clientLog)) {
                 console.log(`${pkgName} count: ${pkgCount}`, from)
             }
             this._addPkged.Replace(pkgName, pkgCount);
             if (pkgCount <= 0 && pkgName != "Common") {
-                if (!gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.clientLog)) {
+                if (!gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.clientLog)) {
                     console.log(`removePackage:${pkgName}`, from)
                 }
                 fgui.UIPackage.removePackage(pkgName)
@@ -360,14 +360,14 @@ export default class FguiMgr extends Singleton<FguiMgr>() implements IUpdate, IL
                     return;
                 }
                 this.AddPkgCount(pkgName);
-                if (!gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.clientLog)) {
+                if (!gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.clientLog)) {
                     console.log(`${pkgName} count: ${this._addPkged.Value(pkgName)}`)
                 }
                 cb && cb();
             });
         } else {
             this.AddPkgCount(pkgName);
-            if (!gameMethod.isEmpty(GameDataCenter?.sevBack?.switch?.clientLog)) {
+            if (!gameMethod.isEmpty(GameDataCenter?.login.playerInfo?.switch?.clientLog)) {
                 console.log(`${pkgName} count: ${this._addPkged.Value(pkgName)}`)
             }
             cb && cb();

+ 1 - 1
assets/script/logic/ui/scene/UILoading.ts

@@ -192,7 +192,7 @@ export default class UILoading extends cc.Component {
 			this.setLoginSid(GameDataCenter.login.playerInfo.sid)
 		}
 
-		let showPolicy = GameDataCenter.sevBack?.switch?.["showPolicy"]?.[Config.pid] ?? 0;
+		let showPolicy = GameDataCenter.login.playerInfo?.switch?.["showPolicy"]?.[Config.pid] ?? 0;
 		if (this.togglePolicy.isChecked == false && showPolicy == 1) {
 			this.onClickPolicy();
 		}

+ 7 - 7
assets/script/network/HttpRequest.ts

@@ -86,11 +86,11 @@ export default class HttpRequest {
     static POST(path: string, data: { [key: string]: string }, body: Object, callback: Function = () => { }, isLogin: boolean = false) {
         body = body || {}
         if (CC_JSB) {
-            if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch.clientLog)) {
+            if (!gameMethod.isEmpty(GameDataCenter.login.playerInfo?.switch) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo?.switch.clientLog)) {
                 console.warn("C->S:", path, JSON.stringify(body))
             }
         } else {
-            if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch.clientLog)) {
+            if (!gameMethod.isEmpty(GameDataCenter.login.playerInfo?.switch) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo?.switch.clientLog)) {
                 console.warn("C->S:", path, body)
             }
         }
@@ -164,11 +164,11 @@ export default class HttpRequest {
                 // try {
                 if (temp && Object.keys(temp).length > 0) {
                     if (CC_JSB) {
-                        if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch.clientLog)) {
+                        if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch.clientLog)) {
                             console.warn("S->C:", JSON.stringify(temp))
                         }
                     } else {
-                        if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch.clientLog)) {
+                        if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch.clientLog)) {
                             console.warn("S->C:", temp)
                         }
                     }
@@ -240,11 +240,11 @@ export default class HttpRequest {
             try {
                 if (temp && Object.keys(temp).length > 0) {
                     if (CC_JSB) {
-                        if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch.clientLog)) {
+                        if (!gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch.clientLog)) {
                             console.warn("S->C:", JSON.stringify(temp))
                         }
                     } else {
-                        if (!gameMethod.isEmpty(GameDataCenter.sevBack) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch) && !gameMethod.isEmpty(GameDataCenter.sevBack.switch.clientLog)) {
+                        if (!gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch) && !gameMethod.isEmpty(GameDataCenter.login.playerInfo.switch.clientLog)) {
                             console.warn("S->C:", temp)
                         }
                     }
@@ -263,7 +263,7 @@ export default class HttpRequest {
         this.errCount = 0
         let delayTime = new Date().getTime()
         taoBaoCloud().then(res => {
-            if (!gameMethod.isEmpty(GameDataCenter.sevBack?.switch?.clientLog)) {
+            if (!gameMethod.isEmpty(GameDataCenter.login.playerInfo?.switch?.clientLog)) {
                 console.log("net delay time == " + (new Date().getTime() - delayTime))
             }
         });