From 8d5d9eea0e1a913b8ac7215dcad54062f5a0937a Mon Sep 17 00:00:00 2001 From: jtx Date: Thu, 16 Oct 2025 11:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=B8=E6=88=8F=E5=86=85?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E6=89=93=E7=82=B9=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scripts/Sub/UI/PreloadUI.ts | 13 +++++++++++++ .../Scripts/chat18x/network/services/AuthService.ts | 4 ++++ .../chat18x/network/services/HttpAuthService.ts | 11 +++++++++++ .../chat18x/network/services/IAuthService.ts | 3 +++ .../chat18x/network/services/MockAuthService.ts | 7 +++++++ 5 files changed, 38 insertions(+) diff --git a/assets/Scripts/Sub/UI/PreloadUI.ts b/assets/Scripts/Sub/UI/PreloadUI.ts index e87af428..5fef0a4c 100644 --- a/assets/Scripts/Sub/UI/PreloadUI.ts +++ b/assets/Scripts/Sub/UI/PreloadUI.ts @@ -15,6 +15,7 @@ import { ProgressBar, Sprite, SpriteFrame, + sys, Vec3, VideoPlayer, } from "cc"; @@ -326,8 +327,20 @@ export class PreloadUI extends Component { const deviceId = DeviceIdService.I.id; const os = MachineInfoService.I.getMachineOs(); + // 获取fbCode,如果有则表示从落地页进来的 const qs = new URLSearchParams(window.location.search); const fbCode = qs.get("fbCode"); + // 保存fbCode到本地 + if (fbCode) { + sys.localStorage.setItem("fbCode", fbCode); + + // 上报事件 + const reqData = { + point: 4, // 4: 进入游戏 + fbCode: fbCode, + }; + AuthService.I.pointEvent(reqData); + } const reqData = { platType: "guest", userId: fbCode ? fbCode : deviceId, diff --git a/assets/Scripts/chat18x/network/services/AuthService.ts b/assets/Scripts/chat18x/network/services/AuthService.ts index 3fe2da61..fda0228b 100644 --- a/assets/Scripts/chat18x/network/services/AuthService.ts +++ b/assets/Scripts/chat18x/network/services/AuthService.ts @@ -29,4 +29,8 @@ export class AuthService implements IAuthService { public async login(req: proto.cs.ICSLoginReq): Promise> { return this.impl.login(req); } + /** 上报事件 */ + public async pointEvent(req: proto.cs.ICSPointEventReq): Promise> { + return this.impl.pointEvent(req); + } } diff --git a/assets/Scripts/chat18x/network/services/HttpAuthService.ts b/assets/Scripts/chat18x/network/services/HttpAuthService.ts index 4296940a..8f5145aa 100644 --- a/assets/Scripts/chat18x/network/services/HttpAuthService.ts +++ b/assets/Scripts/chat18x/network/services/HttpAuthService.ts @@ -17,4 +17,15 @@ export class HttpAuthService implements IAuthService { }; return this.api.call(ep, req); } + + /** 上报事件 */ + async pointEvent(req: proto.cs.ICSPointEventReq): Promise> { + const ep: Endpoint = { + path: "api/logic/pointEvent", + method: "POST", + codec: "json", + needsAuth: false, + }; + return this.api.call(ep, req); + } } diff --git a/assets/Scripts/chat18x/network/services/IAuthService.ts b/assets/Scripts/chat18x/network/services/IAuthService.ts index fc60be77..1f5274c5 100644 --- a/assets/Scripts/chat18x/network/services/IAuthService.ts +++ b/assets/Scripts/chat18x/network/services/IAuthService.ts @@ -4,4 +4,7 @@ import proto from "db://assets/Scripts/proto/proto.pb.js"; export interface IAuthService { // 登录 login(req: proto.cs.ICSLoginReq): Promise>; + + // 上报事件 + pointEvent(req: proto.cs.ICSPointEventReq): Promise>; } diff --git a/assets/Scripts/chat18x/network/services/MockAuthService.ts b/assets/Scripts/chat18x/network/services/MockAuthService.ts index 2f28c5aa..06a9c50c 100644 --- a/assets/Scripts/chat18x/network/services/MockAuthService.ts +++ b/assets/Scripts/chat18x/network/services/MockAuthService.ts @@ -40,4 +40,11 @@ export class MockAuthService implements IAuthService { return this.ok(res); } + + /** 上报事件 */ + async pointEvent(req: proto.cs.ICSPointEventReq): Promise> { + // 延时 + await this.delay(150); + return this.ok({}); + } }