diff --git a/Application/Admin/Controller/PaymentMerchantController.class.php b/Application/Admin/Controller/PaymentMerchantController.class.php index b8139a14e..dff160844 100644 --- a/Application/Admin/Controller/PaymentMerchantController.class.php +++ b/Application/Admin/Controller/PaymentMerchantController.class.php @@ -505,6 +505,14 @@ class PaymentMerchantController extends ThinkController $weixinMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_WEIXIN); $expressMerchants = $paymentMerchantService->getMerchantsByWay(PaymentMerchantService::WAY_EXPRESS); $companies = $companyService->getCompanies(null, 'id,company_name'); + + $defaultExpress = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_EXPRESS); + $defaultAlipay = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_ALIPAY); + $defaultWeixin = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_WEIXIN); + + $this->assign('defaultExpress', $defaultExpress ? $defaultExpress['name'] . '(' . $defaultExpress['account'] . ')' : '无'); + $this->assign('defaultAlipay', $defaultAlipay ? $defaultAlipay['name'] . '(' . $defaultAlipay['account'] . ')' : '无'); + $this->assign('defaultWeixin', $defaultWeixin ? $defaultWeixin['name'] . '(' . $defaultWeixin['account'] . ')' : '无'); $this->assign('aliMerchants', $aliMerchants); $this->assign('weixinMerchants', $weixinMerchants); $this->assign('expressMerchants', $expressMerchants); @@ -604,6 +612,14 @@ class PaymentMerchantController extends ThinkController $rule ['start_time'] = $rule ['start_time'] == 0 ? '' : date('Y-m-d', $rule ['start_time']); $rule ['end_time'] = $rule ['end_time'] == PaymentRuleService::FOREVER_TIME ? '' : date('Y-m-d', $rule ['end_time']); + $defaultExpress = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_EXPRESS); + $defaultAlipay = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_ALIPAY); + $defaultWeixin = $paymentMerchantService->getDefault(PaymentMerchantService::WAY_WEIXIN); + + $this->assign('defaultExpress', $defaultExpress ? $defaultExpress['name'] . '(' . $defaultExpress['account'] . ')' : '无'); + $this->assign('defaultAlipay', $defaultAlipay ? $defaultAlipay['name'] . '(' . $defaultAlipay['account'] . ')' : '无'); + $this->assign('defaultWeixin', $defaultWeixin ? $defaultWeixin['name'] . '(' . $defaultWeixin['account'] . ')' : '无'); + $this->assign('aliMerchants', $aliMerchants); $this->assign('weixinMerchants', $weixinMerchants); $this->assign('expressMerchants', $expressMerchants); diff --git a/Application/Admin/View/PaymentMerchant/ruleAddForm.html b/Application/Admin/View/PaymentMerchant/ruleAddForm.html index 410c50af0..51097a15e 100644 --- a/Application/Admin/View/PaymentMerchant/ruleAddForm.html +++ b/Application/Admin/View/PaymentMerchant/ruleAddForm.html @@ -150,10 +150,10 @@ *支付宝支付配置: - + - + @@ -161,10 +161,10 @@ *微信支付配置: - + - + @@ -172,10 +172,10 @@ *快捷支付配置: - + - + diff --git a/Application/Admin/View/PaymentMerchant/ruleEditForm.html b/Application/Admin/View/PaymentMerchant/ruleEditForm.html index 6d1c81c66..20f38f005 100644 --- a/Application/Admin/View/PaymentMerchant/ruleEditForm.html +++ b/Application/Admin/View/PaymentMerchant/ruleEditForm.html @@ -150,10 +150,10 @@ *支付宝支付配置: - + - + @@ -161,10 +161,10 @@ *微信支付配置: - + - + @@ -172,10 +172,10 @@ *快捷支付配置: - + - + diff --git a/Application/Base/Service/ApplyService.class.php b/Application/Base/Service/ApplyService.class.php index eda474d25..851dcec70 100644 --- a/Application/Base/Service/ApplyService.class.php +++ b/Application/Base/Service/ApplyService.class.php @@ -77,19 +77,23 @@ 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; } - public function getLandingPageUrl($apply) + public function getLandingPageUrl($apply, $code = null) { $host = $this->getDownloadDomain(); $host = $host ? $host : Request::getHost(); - $code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_LANDING_PAGE); + if (!$code) { + $code = $this->encodeApplyCode($apply, self::ENCRYPT_TYPE_DOWNLOAD); + } return $host . '/index.php?s=/Home/Home/landingPage/code/' . $code; } @@ -171,12 +175,12 @@ class ApplyService { 'message' => '参数异常', ]; } - if ($data['type'] != $type) { + /* if ($data['type'] != $type) { return [ 'status' => false, 'message' => '参数异常', ]; - } + } */ if ($data['expires_in'] > 0 && time() > (strtotime($data['created_at']) + $data['expires_in'])) { return [ 'status' => false, 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..187bdb9c3 100644 --- a/Application/Home/Controller/PackageController.class.php +++ b/Application/Home/Controller/PackageController.class.php @@ -69,36 +69,40 @@ class PackageController extends Controller $this->error('链接已失效'); } + $sdkVersion = 0; + if (Request::isMobile() || Request::isTablet() || $force == 'ios' || $force == 'android') { + if (Request::isAndroid() || $force == 'android') { + $sdkVersion = 1; + } elseif (Request::isIOS() || Request::isIPadOS() || $force == 'ios') { + $sdkVersion = 2; + } + } + + $gameColumns = ['id', 'game_name', 'sdk_version', 'apply_auth', 'relation_game_id']; + $game = M('game','tab_')->field($gameColumns)->where(['id' => $gameId])->find(); + if ($sdkVersion > 0 && $game && $game['sdk_version'] != $sdkVersion) { + $game = M('game','tab_')->field($gameColumns)->where(['sdk_version' => $sdkVersion, 'relation_game_id' => $game['relation_game_id']])->find(); + } + + if (!$game) { + $this->error('游戏不存在'); + } + $map = []; $map['status'] = 1; $map['enable_status'] = 1; - $map['game_id'] = $gameId; + $map['game_id'] = $game['id']; $map['promote_id'] = $promoteId; - $columns = ['game_id', 'promote_id', 'promote_account', 'pack_url', 'plist_url', 'status', 'enable_status']; - $apply = M('apply','tab_')->field($columns)->where($map)->find(); + $apply = M('apply','tab_')->where($map)->find(); if (!$apply) { $this->redirect("package/downloadError", ['message' => '该链接已经停止使用']); } - $game = M('game','tab_')->field(['id', 'game_name', 'sdk_version', 'apply_auth'])->where(['id' => $apply['game_id']])->find(); - - 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浏览器下载']); - } - } - $packageUrl = $game['sdk_version'] == 1 ? $apply['pack_url'] : $apply['plist_url']; - - $apply = M('apply', 'tab_')->where(['promote_id' => $promoteId, 'game_id' => $gameId])->find(); - $url = $applyService->getLandingPageUrl($apply); - + + $url = $applyService->getLandingPageUrl($apply, $code); M('game','tab_')->where(['id' => $game['id']])->setInc('dow_num'); - - $log['game_id'] = $gameId; + $log['game_id'] = $game['id']; $log['game_name'] = $game['game_name']; $log['action'] = $url; $log['type'] = 6; @@ -109,11 +113,14 @@ class PackageController extends Controller M('user_action_log', 'tab_')->data($log)->add(); $downloadDomain = $applyService->getDownloadDomain(); - if (Request::isIOS() || Request::isIPadOS() || $force == 'ios') { + if ($game['sdk_version'] == 2) { + /* if (!Request::getMobileDetect()->is('Safari')) { + return $this->display('open_in_safari'); + } */ $packageDownloadLogService = new PackageDownloadLogService(); $packageDownloadLogService->add([ 'user_id' => 0, - 'game_id' => $gameId, + 'game_id' => $game['id'], 'promote_id' => $promoteId, 'type' => 1, ]); diff --git a/Application/Home/View/default/Package/open_in_safari.html b/Application/Home/View/default/Package/open_in_safari.html new file mode 100644 index 000000000..60cc99b2a --- /dev/null +++ b/Application/Home/View/default/Package/open_in_safari.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + 请在Safari浏览器中打开 + + +
+
+
请选择在“Safari”中打开
+ +
+
+ +
+
该链接只支持Safari
+
请在Safari中打开
+
+
+
+ + \ No newline at end of file