From 0af353e2dafdb77c6b89c5fca7f2160e30709ee2 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 30 Mar 2021 15:52:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Event/SourceEvent.class.php | 25 ++----------------- .../Base/Service/GameSourceService.class.php | 14 +++++------ 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/Application/Admin/Event/SourceEvent.class.php b/Application/Admin/Event/SourceEvent.class.php index 8c3b0bb37..b6923273d 100644 --- a/Application/Admin/Event/SourceEvent.class.php +++ b/Application/Admin/Event/SourceEvent.class.php @@ -51,18 +51,7 @@ class SourceEvent extends Controller $data['bao_name'] = $packageName; $game = M('game', 'tab_')->where(['id' => $data['game_id']])->find(); $gameSourceService = new GameSourceService(); - - $gameSourceData = array_merge( - $data, - [ - 'plist_url' => '', - 'org_plist_url' => '', - 'file_url' => '', - 'original_url' => '', - ] - ); - - $result = $gameSourceService->sourcePack($gameSourceData, $game); + $result = $gameSourceService->sourcePack($data, $game); if (!$result['status']) { $this->error('添加失败' , U('GameSource/lists', ['type' => $data['type']])); } @@ -127,17 +116,7 @@ class SourceEvent extends Controller $game = M('game', 'tab_')->where(['id' => $data['game_id']])->find(); $gameSourceService = new GameSourceService(); - - $gameSourceData = array_merge( - $data, - [ - 'plist_url' => $game_source['plist_url'], - 'org_plist_url' => $game_source['org_plist_url'], - 'file_url' => $game_source['file_url'], - 'original_url' => $game_source['original_url'], - ] - ); - $result = $gameSourceService->sourcePack($gameSourceData, $game); + $result = $gameSourceService->sourcePack($data, $game, $game_source); if (!$result['status']) { if ($from == "dev") { $this->error('修改失败', U('Developers/source')); diff --git a/Application/Base/Service/GameSourceService.class.php b/Application/Base/Service/GameSourceService.class.php index 7177ebe39..3d534cd47 100644 --- a/Application/Base/Service/GameSourceService.class.php +++ b/Application/Base/Service/GameSourceService.class.php @@ -139,7 +139,7 @@ class GameSourceService { /** * 原包打包 */ - public function sourcePack($gameSource, $game) + public function sourcePack($gameSource, $game, $olderSource = null) { $relativeUrl = $gameSource['file_url']; $localPath = ROOTTT . ltrim($relativeUrl, './'); @@ -160,10 +160,12 @@ class GameSourceService { ]; } - $this->removeOlderFile($gameSource['plist_url']); - $this->removeOlderFile($gameSource['org_plist_url']); - $this->removeOlderFile($gameSource['file_url']); - $this->removeOlderFile($gameSource['original_url']); + if ($olderSource) { + $this->removeOlderFile($olderSource['plist_url']); + $this->removeOlderFile($olderSource['org_plist_url']); + $this->removeOlderFile($olderSource['file_url']); + $this->removeOlderFile($olderSource['original_url']); + } $distFilePath = 'SourcePack/' . $gameSource['file_name']; $result = $this->uploadPackage($localPath, $distFilePath); @@ -319,8 +321,6 @@ class GameSourceService { } $debugTime5 = microtime(true); - - $plistInfo = ['game_id' => $apply['game_id'], 'promote_id' => $apply['promote_id']]; $plistUrl = ''; if ($apply['sdk_version'] == 2) { $params = [