Add user played work stats for puzzle and big fish
Some checks failed
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-04-28 12:58:31 +08:00
parent bb4100fca4
commit 377d7d0412
21 changed files with 1028 additions and 82 deletions

View File

@@ -0,0 +1,33 @@
import type {
BigFishSessionResponse,
RecordBigFishPlayRequest,
} from '../../../packages/shared/src/contracts/bigFish';
import { type ApiRetryOptions, requestJson } from '../apiClient';
const BIG_FISH_RUNTIME_WRITE_RETRY: ApiRetryOptions = {
maxRetries: 1,
baseDelayMs: 120,
maxDelayMs: 360,
retryUnsafeMethods: true,
};
/**
* 上报大鱼吃小鱼正式游玩。elapsedMs 为 0 时仅标记玩过作品。
*/
export function recordBigFishPlay(
sessionId: string,
payload: RecordBigFishPlayRequest,
) {
return requestJson<BigFishSessionResponse>(
`/api/runtime/big-fish/sessions/${encodeURIComponent(sessionId)}/play`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'记录大鱼吃小鱼游玩失败',
{
retry: BIG_FISH_RUNTIME_WRITE_RETRY,
},
);
}

View File

@@ -2,3 +2,4 @@ export {
advanceLocalBigFishRuntimeRun,
startLocalBigFishRuntimeRun,
} from './bigFishLocalRuntime';
export { recordBigFishPlay } from './bigFishRuntimeClient';