@@ -23,6 +23,7 @@ import { readAppCache, saveAppCache, type AppCacheInfo } from '../../core/utils/
2323import { logger } from '../../core/utils/logger.js' ;
2424import { resolveWorkPath } from '../../core/utils/pathResolver.js' ;
2525import { EnvConfig } from '../../core/utils/env.js' ;
26+ import type { ResolvedContext } from '../../core/types/index.js' ;
2627
2728/**
2829 * 临时文件根目录(独立于 workspace)
@@ -143,7 +144,7 @@ async function confirmInfo(
143144 developerId ?: number ,
144145 appId ?: number ,
145146 genre ?: string ,
146- context ?: import ( '../../core/types/index.js' ) . RequestContext
147+ ctx ?: ResolvedContext
147148) : Promise < { success : boolean ; message : string ; developerId ?: number ; appId ?: number } > {
148149 // 如果用户提供了开发者身份 ID 和游戏 ID, 直接返回
149150 if ( developerId && appId ) {
@@ -177,7 +178,7 @@ async function confirmInfo(
177178 // 2. 游戏信息确认
178179 let resultMsg = '' ;
179180 if ( ! developerId ) {
180- const response = await getAllDevelopersAndApps ( context ) ;
181+ const response = await getAllDevelopersAndApps ( ctx ) ;
181182 const results = response . list ;
182183
183184 // 2.1. 开发者身份信息存在
@@ -194,11 +195,11 @@ async function confirmInfo(
194195 }
195196 } else {
196197 // 2.2. 开发者身份信息不存在, 创建开发者身份
197- const createDevResult = await createDeveloper ( context ) ;
198+ const createDevResult = await createDeveloper ( ctx ) ;
198199 if ( createDevResult && createDevResult . developer_id ) {
199200 developerId = createDevResult . developer_id ;
200201
201- const appResults = await createAppForDeveloper ( createDevResult . developer_id , undefined , genre , context ) ;
202+ const appResults = await createAppForDeveloper ( createDevResult . developer_id , undefined , genre , ctx ) ;
202203 if ( appResults && appResults . app_id ) {
203204 appId = appResults . app_id ;
204205 resultMsg = MESSAGES . GAME_TYPE_INFO ( appResults . display_app_title ) ;
@@ -217,7 +218,7 @@ async function confirmInfo(
217218
218219 // 如果有 developerId 但没有游戏, 自动创建一个游戏
219220 if ( developerId && ! appId ) {
220- const appResults = await createAppForDeveloper ( developerId , undefined , genre ) ;
221+ const appResults = await createAppForDeveloper ( developerId , undefined , genre , ctx ) ;
221222 if ( appResults && appResults . app_id ) {
222223 appId = appResults . app_id ;
223224 resultMsg = MESSAGES . GAME_TYPE_INFO ( appResults . display_app_title ) ;
@@ -243,10 +244,10 @@ export async function handleGatherGameInfo(
243244 appId ?: number ;
244245 genre ?: string ;
245246 } ,
246- context ?: import ( '../../core/types/index.js' ) . RequestContext
247+ ctx ?: ResolvedContext
247248) : Promise < string > {
248249 // 使用统一路径解析器
249- const gamePath = resolveWorkPath ( args . gamePath , context ) ;
250+ const gamePath = resolveWorkPath ( args . gamePath , ctx ) ;
250251
251252 // 确保目录存在且包含 index.html 文件
252253 if ( ! fs . existsSync ( gamePath ) || ! fs . existsSync ( path . join ( gamePath , 'index.html' ) ) ) {
@@ -259,7 +260,7 @@ export async function handleGatherGameInfo(
259260 args . developerId ,
260261 args . appId ,
261262 args . genre ,
262- context
263+ ctx
263264 ) ;
264265
265266 if ( ! confirmResult . success ) {
@@ -306,10 +307,10 @@ export async function handleUploadGame(
306307 appName ?: string ;
307308 genre ?: string ;
308309 } ,
309- context ?: import ( '../../core/types/index.js' ) . RequestContext
310+ ctx ?: ResolvedContext
310311) : Promise < string > {
311312 // 使用统一路径解析器
312- const gamePath = resolveWorkPath ( args . gamePath , context ) ;
313+ const gamePath = resolveWorkPath ( args . gamePath , ctx ) ;
313314
314315 // 从缓存读取或使用传入的参数
315316 let cacheInfo = readAppCache ( gamePath ) || { } ;
@@ -346,7 +347,7 @@ export async function handleUploadGame(
346347 // 2. 获取上传参数
347348 let uploadParams : UploadParams ;
348349 try {
349- uploadParams = await getH5PackageUploadParams ( cacheInfo . app_id , context ) ;
350+ uploadParams = await getH5PackageUploadParams ( cacheInfo . app_id , ctx ) ;
350351 await logger . info ( MESSAGES . GET_UPLOAD_PARAMS_SUCCESS ( uploadParams , outputPath ) ) ;
351352 } catch ( error ) {
352353 return MESSAGES . COMPRESSED_GET_PARAMS_FAILED ( archiveSize , String ( error ) ) ;
@@ -375,7 +376,7 @@ export async function handleUploadGame(
375376 undefined , // chatting_label
376377 undefined , // chatting_number
377378 undefined , // screen_orientation
378- context // context
379+ ctx // ctx
379380 ) ;
380381
381382 let msg = MESSAGES . GAME_PUBLISH_SUCCESS ( results . app_title , cacheInfo . app_id ) ;
@@ -403,12 +404,12 @@ export async function handleCreateApp(
403404 appName ?: string ;
404405 genre ?: string ;
405406 } ,
406- context ?: import ( '../../core/types/index.js' ) . RequestContext
407+ ctx ?: ResolvedContext
407408) : Promise < string > {
408409 let developerId = args . developerId ;
409410
410411 if ( ! developerId ) {
411- const response = await getAllDevelopersAndApps ( context ) ;
412+ const response = await getAllDevelopersAndApps ( ctx ) ;
412413 const results = response . list ;
413414
414415 // 开发者身份信息存在
@@ -421,7 +422,7 @@ export async function handleCreateApp(
421422 }
422423 } else {
423424 // 开发者身份信息不存在,创建开发者身份
424- const createDevResult = await createDeveloper ( context ) ;
425+ const createDevResult = await createDeveloper ( ctx ) ;
425426 if ( createDevResult && createDevResult . developer_id ) {
426427 developerId = createDevResult . developer_id ;
427428 }
@@ -433,7 +434,7 @@ export async function handleCreateApp(
433434 return MESSAGES . DEVELOPER_ID_NOT_EXISTS ;
434435 }
435436
436- const results = await createAppForDeveloper ( developerId , args . appName , args . genre , context ) ;
437+ const results = await createAppForDeveloper ( developerId , args . appName , args . genre , ctx ) ;
437438 if ( results && results . app_id ) {
438439 return MESSAGES . CREATE_GAME_SUCCESS (
439440 developerId ,
@@ -460,7 +461,7 @@ export async function handleEditApp(
460461 chattingNumber ?: string ;
461462 screenOrientation ?: number ;
462463 } ,
463- context ?: import ( '../../core/types/index.js' ) . RequestContext
464+ ctx ?: ResolvedContext
464465) : Promise < string > {
465466 if ( ! args . developerId || ! args . appId ) {
466467 return MESSAGES . EDIT_GAME_INFO_CONFIRMATION ;
@@ -476,7 +477,7 @@ export async function handleEditApp(
476477 args . chattingLabel ,
477478 args . chattingNumber ,
478479 args . screenOrientation ,
479- context // context
480+ ctx // ctx
480481 ) ;
481482
482483 return MESSAGES . EDIT_GAME_INFO_SUCCESS ;
0 commit comments