diff --git a/Application/Base/Service/ApplyService.class.php b/Application/Base/Service/ApplyService.class.php index eda474d25..890d1ee0f 100644 --- a/Application/Base/Service/ApplyService.class.php +++ b/Application/Base/Service/ApplyService.class.php @@ -77,11 +77,13 @@ class ApplyService { return M('Apply', 'tab_')->save($data); } - public function getDownloadUrl($apply) + public function getDownloadUrl($apply, $code = null) { $host = $this->getDownloadDomain(); $host = $host ? $host : Request::getHost(); - $code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_DOWNLOAD); + if (!$code) { + $code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_DOWNLOAD); + } return $host . '/index.php?s=/Home/Package/download/code/' . $code; } diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 15ccb99a2..d003d02fe 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -312,7 +312,7 @@ class HomeController extends Controller if (!$isNewIos && $isIOS13) { $downloadUrl = 'itms-services://?action=download-manifest&url=' . Request::getHost() . ltrim($gameSource['org_plist_url'], '.'); } else { - $downloadUrl = $applyService->getDownloadUrl($apply); + $downloadUrl = $applyService->getDownloadUrl($apply, $code); if ($force) { $downloadUrl .= '/force/' . $force; } diff --git a/Application/Home/Controller/PackageController.class.php b/Application/Home/Controller/PackageController.class.php index 54941fa11..933e00014 100644 --- a/Application/Home/Controller/PackageController.class.php +++ b/Application/Home/Controller/PackageController.class.php @@ -82,16 +82,17 @@ class PackageController extends Controller $game = M('game','tab_')->field(['id', 'game_name', 'sdk_version', 'apply_auth'])->where(['id' => $apply['game_id']])->find(); + $sdkVersion = $game['sdk_version']; + if (Request::isMobile() || Request::isTablet() || $force == 'ios' || $force == 'android') { - if (!(Request::isAndroid() || $force == 'android') && $game['sdk_version'] == 1) { - $this->redirect("package/downloadError", ['message' => '请使用安卓浏览器下载']); - } - if (!(Request::isIOS() || Request::isIPadOS() || $force == 'ios') && $game['sdk_version'] == 2) { - $this->redirect("package/downloadError", ['message' => '请使用ios浏览器下载']); + if (Request::isAndroid() || $force == 'android') { + $sdkVersion = 1; + } elseif (Request::isIOS() || Request::isIPadOS() || $force == 'ios') { + $sdkVersion = 2; } } - $packageUrl = $game['sdk_version'] == 1 ? $apply['pack_url'] : $apply['plist_url']; + $packageUrl = $sdkVersion == 1 ? $apply['pack_url'] : $apply['plist_url']; $apply = M('apply', 'tab_')->where(['promote_id' => $promoteId, 'game_id' => $gameId])->find(); $url = $applyService->getLandingPageUrl($apply);