From b217695c3f32e203439a5e6d220a59ff1c959ba0 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 22 Apr 2020 12:36:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E5=8C=85oss?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/GameSourceService.class.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) 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; From c871575e23bc0535dbef12c0381df375f8e222af Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 12 May 2020 12:07:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Service/GameSourceService.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Application/Base/Service/GameSourceService.class.php b/Application/Base/Service/GameSourceService.class.php index f26eb0b6f..17971be6b 100644 --- a/Application/Base/Service/GameSourceService.class.php +++ b/Application/Base/Service/GameSourceService.class.php @@ -229,6 +229,10 @@ class GameSourceService { $gameSourceUrl = $this->getGameSourceUrl($gameSource); if ($gameSource == null || !file_exists($gameSourceUrl)) { M('apply', 'tab_')->where(['id' => $apply['id']])->setField('enable_status', -1); + return [ + 'status' => false, + 'message' => '打包失败,原包或原包路径不存在!', + ]; } /* 检测是否存在投放申请,存在则更改投放申请信息,否则进行渠道打包 */