<?php namespace Base\Service; use Base\Model\PromoteModel; use Base\Model\ApplyModel; class GameSourceService { public function __construct() { } public function getChannelConfigFile($gameSource) { $configUrl = ''; if ($gameSource['sdk_version'] == 1) { $configUrl = "META-INF/mch.properties"; } else { $preUrl = ''; $zipGameSource = zip_open($this->getGameSourceUrl($gameSource)); if ($zipGameSource) { while ($zipEntry = zip_read($zipGameSource)) { if (preg_match("/^Payload.*?\.app/", zip_entry_name($zipEntry), $matches)) { $preUrl = $matches[0]; break; } } zip_close($zipGameSource); } $configUrl = $preUrl . '/_CodeSignature/TXChannel'; } return $configUrl; } public function getGameSourceUrl($gameSource){ $path = ''; if($gameSource['file_type'] == '1'){ $path = './Uploads/SourcePack/'; }else{ $path = './Uploads/Ios/original/'; } $fileUrl = $path . $gameSource['file_name']; return ROOTTT . ltrim($fileUrl, './'); } }