|
|
@@ -8994,6 +8994,19 @@ class AnimeService
|
|
|
$timeout = 1800; // 30分钟超时
|
|
|
$pollInterval = 10; // 10秒轮询一次
|
|
|
$lastStatus = []; // 记录上次的状态,用于判断是否有变化
|
|
|
+
|
|
|
+ // 流一开始即返回 init 事件(saveScriptProducts 场景下携带任务中心ID)
|
|
|
+ if ($taskCenterId) {
|
|
|
+ $initResponse = [
|
|
|
+ 'type' => 'init',
|
|
|
+ 'script_id' => $script_id,
|
|
|
+ 'script_name' => $script_name,
|
|
|
+ 'timestamp' => date('Y-m-d H:i:s'),
|
|
|
+ 'task_center_id' => (int)$taskCenterId,
|
|
|
+ ];
|
|
|
+
|
|
|
+ yield "data: " . json_encode($initResponse, JSON_UNESCAPED_UNICODE) . "\n\n";
|
|
|
+ }
|
|
|
|
|
|
// 定义类型名称映射
|
|
|
$typeNames = [
|