|
|
@ -9,6 +9,7 @@ use Base\Tool\PlistDemo;
|
|
|
|
class GameSourceService {
|
|
|
|
class GameSourceService {
|
|
|
|
|
|
|
|
|
|
|
|
const IS_FIXED_IOS13 = true;
|
|
|
|
const IS_FIXED_IOS13 = true;
|
|
|
|
|
|
|
|
const DEBUG = true;
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -219,6 +220,8 @@ class GameSourceService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function channelPack($gameSource, $game, $apply, $launchCount = 0)
|
|
|
|
public function channelPack($gameSource, $game, $apply, $launchCount = 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$debugTime1 = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
|
$gameSourceUrl = $this->getGameSourceUrl($gameSource);
|
|
|
|
$gameSourceUrl = $this->getGameSourceUrl($gameSource);
|
|
|
|
if ($gameSource == null || !file_exists($gameSourceUrl)) {
|
|
|
|
if ($gameSource == null || !file_exists($gameSourceUrl)) {
|
|
|
|
M('apply', 'tab_')->where(['id' => $apply['id']])->setField('enable_status', -1);
|
|
|
|
M('apply', 'tab_')->where(['id' => $apply['id']])->setField('enable_status', -1);
|
|
|
@ -242,8 +245,13 @@ class GameSourceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$relativePath = './' . $savePath;
|
|
|
|
$relativePath = './' . $savePath;
|
|
|
|
$localPath = ROOTTT . $savePath;
|
|
|
|
$localPath = ROOTTT . $savePath;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$debugTime2 = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
|
copy($gameSourceUrl, $localPath);
|
|
|
|
copy($gameSourceUrl, $localPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$debugTime3 = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
|
$status = $this->packChannel($localPath, $game, $gameSource, $apply);
|
|
|
|
$status = $this->packChannel($localPath, $game, $gameSource, $apply);
|
|
|
|
if (!$status) {
|
|
|
|
if (!$status) {
|
|
|
|
return [
|
|
|
|
return [
|
|
|
@ -251,6 +259,9 @@ class GameSourceService {
|
|
|
|
'message' => '打包失败,加入渠道信息失败!',
|
|
|
|
'message' => '打包失败,加入渠道信息失败!',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$debugTime4 = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
|
$distFilePath = 'GamePack/' . $fileName;
|
|
|
|
$distFilePath = 'GamePack/' . $fileName;
|
|
|
|
$result = $this->uploadPackage($localPath, $distFilePath, false);
|
|
|
|
$result = $this->uploadPackage($localPath, $distFilePath, false);
|
|
|
|
if ($result['status']) {
|
|
|
|
if ($result['status']) {
|
|
|
@ -262,6 +273,9 @@ class GameSourceService {
|
|
|
|
'message' => '打包失败,上传OSS失败!' . $result['message'],
|
|
|
|
'message' => '打包失败,上传OSS失败!' . $result['message'],
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$debugTime5 = microtime(true);
|
|
|
|
|
|
|
|
|
|
|
|
$plistInfo = ['game_id' => $apply['game_id'], 'promote_id' => $apply['promote_id']];
|
|
|
|
$plistInfo = ['game_id' => $apply['game_id'], 'promote_id' => $apply['promote_id']];
|
|
|
|
$plistUrl = '';
|
|
|
|
$plistUrl = '';
|
|
|
|
if ($apply['sdk_version'] == 2) {
|
|
|
|
if ($apply['sdk_version'] == 2) {
|
|
|
@ -286,6 +300,18 @@ class GameSourceService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$applyService = new ApplyService();
|
|
|
|
$applyService = new ApplyService();
|
|
|
|
$applyService->updateAfterPack($apply, $packageUrl, $plistUrl);
|
|
|
|
$applyService->updateAfterPack($apply, $packageUrl, $plistUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$debugTime6 = microtime(true);
|
|
|
|
|
|
|
|
$debugInfo = '';
|
|
|
|
|
|
|
|
if (self::DEBUG) {
|
|
|
|
|
|
|
|
$debugInfo .= '[' .
|
|
|
|
|
|
|
|
'总计:' . ($debugTime6 - $debugTime1) .
|
|
|
|
|
|
|
|
' 复制:' . ($debugTime3 - $debugTime2) .
|
|
|
|
|
|
|
|
' 打包:' . ($debugTime4 - $debugTime3) .
|
|
|
|
|
|
|
|
' 上传:' . ($debugTime5 - $debugTime4) .
|
|
|
|
|
|
|
|
']';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
'status' => true,
|
|
|
|
'status' => true,
|
|
|
|
'message' => '打包成功!',
|
|
|
|
'message' => '打包成功!',
|
|
|
|