协议调试

This commit is contained in:
chen wei bo
2025-09-09 00:33:29 +08:00
parent 2545aadcab
commit 8fbbca0e41
4 changed files with 25 additions and 9 deletions
+4 -5
View File
@@ -260,12 +260,12 @@ export class PreloadUI extends Component {
// 游客登录
const deviceId = DeviceIdService.I.id;
const machineIdentifier = MachineInfoService.I.getMachineIdentifier();
const os = MachineInfoService.I.getMachineOs();
const reqData = {
platType: 'guset',
userId: deviceId,
device: deviceId,
os: 3,
os,
};
console.log("登录请求数据:", reqData);
let res = await AuthService.I.login(reqData);
@@ -285,8 +285,8 @@ export class PreloadUI extends Component {
envData.cdn = resData.cdn;
this.loginFinish = true;
// this.reqMyInfo();
// 请求个人信息
this.reqMyInfo();
};
}
@@ -295,7 +295,6 @@ export class PreloadUI extends Component {
const reqData = {
};
console.log("个人信息请求数据:", reqData);
let res = await PlayerDataService.I.reqMyInfo(reqData);
console.log("个人信息响应数据:", res);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
+2 -2
View File
@@ -5,9 +5,9 @@ import { BaseData } from "./BaseData";
export class WalletData extends BaseData {
// 余额
private _balance = 0;
private _balance: number = 0;
// vip失效时间戳
private _vipExpire = 0;
private _vipExpire: number = 0;
public reset(): void {
this._balance = 0;
@@ -108,6 +108,24 @@ export class MachineInfoService {
if (s.length > 64) s = s.slice(0, 64);
return s || "Unknown";
}
/** 获取机器系统标识 1: android 2:ios; 3: windows */
public getMachineOs(): number {
if (EDITOR) {
return 3; // 在 Cocos Creator 编辑器里运行
}
if (sys.platform === sys.Platform.ANDROID) {
return 1;
}
if (sys.platform === sys.Platform.IOS) {
return 2;
}
if (sys.platform === sys.Platform.WIN32) {
return 3;
}
return 3;
}
}
export default MachineInfoService;
@@ -25,9 +25,8 @@ export class ApiClient {
let jsonData: any;
if (ep.needsAuth && this.token) {
headers["Authorization"] = `Bearer ${this.token}`;
headers["Authorization"] = `${this.token}`;
}
// 编码
if (ep.codec === "json") {
jsonData = (ep.method === "GET") ? req : JsonCodec.encode(req);