diff --git a/Application/Base/Service/GameSourceService.class.php b/Application/Base/Service/GameSourceService.class.php index 4af55713c..f26eb0b6f 100644 --- a/Application/Base/Service/GameSourceService.class.php +++ b/Application/Base/Service/GameSourceService.class.php @@ -351,20 +351,27 @@ class GameSourceService { 'base_uri' => C('PACKAGE_CHUNK_URL'), 'timeout' => 30.0, ]); - $response = $client->post('/upload', [ - 'verify' => false, - 'form_params' => [ - 'file' => $localFilePath, - 'dest' => $distFilePath, - 'is_delete_local' => ($isDeleteLocal ? 1 : 0), - ] - ]); - $result = (string)$response->getBody(); - $result = json_decode($result, true); - if (!$result) { + try { + $response = $client->post('/upload', [ + 'verify' => false, + 'form_params' => [ + 'file' => $localFilePath, + 'dest' => $distFilePath, + 'is_delete_local' => ($isDeleteLocal ? 1 : 0), + ] + ]); + $result = (string)$response->getBody(); + $result = json_decode($result, true); + if (!$result) { + return [ + 'status' => false, + 'message' => '请求异常', + ]; + } + } catch (\Exception $e) { return [ 'status' => false, - 'message' => '请求打包失败', + 'message' => '请求异常: ' . $e->getMessage(), ]; } return $result;