From ab6b41705fd0edee33179c9c2d24fbd1414ddee2 Mon Sep 17 00:00:00 2001 From: Devil Date: Mon, 26 Jul 2021 03:04:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Plugins.php | 18 +++++++++++------- app/common.php | 1 + app/index/controller/Plugins.php | 18 +++++++++++------- app/service/PluginsUpgradeService.php | 2 +- app/service/StoreService.php | 8 ++++---- app/service/SystemUpgradeService.php | 2 +- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/app/admin/controller/Plugins.php b/app/admin/controller/Plugins.php index 36802fa27..78354cb7f 100755 --- a/app/admin/controller/Plugins.php +++ b/app/admin/controller/Plugins.php @@ -10,6 +10,7 @@ // +---------------------------------------------------------------------- namespace app\admin\controller; +use app\service\ApiService; use app\service\PluginsService; use app\service\ResourcesService; @@ -96,19 +97,22 @@ class Plugins extends Common // 调用 $ret = PluginsService::PluginsControlCall($pluginsname, $pluginscontrol, $pluginsaction, 'admin', $params); + + // ajax 返回的都是数组、使用统一api返回处理 + if(IS_AJAX) + { + return ApiService::ApiDataReturn($ret['data']); + } + if($ret['code'] == 0) { + // 默认则是视图内容 return $ret['data']; } // 调用失败 - if(IS_AJAX) - { - return $ret; - } else { - MyViewAssign('msg', $ret['msg']); - return MyView(); - } + MyViewAssign('msg', $ret['msg']); + return MyView(); } /** diff --git a/app/common.php b/app/common.php index 29547b5f2..2ef41f6ee 100755 --- a/app/common.php +++ b/app/common.php @@ -1988,6 +1988,7 @@ function CurlPost($url, $post, $is_json = false, $timeout = 30) curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_URL, $url); // 是否 json diff --git a/app/index/controller/Plugins.php b/app/index/controller/Plugins.php index de4a2ba71..73af1079c 100755 --- a/app/index/controller/Plugins.php +++ b/app/index/controller/Plugins.php @@ -10,6 +10,7 @@ // +---------------------------------------------------------------------- namespace app\index\controller; +use app\service\ApiService; use app\service\PluginsService; use app\service\ResourcesService; @@ -84,19 +85,22 @@ class Plugins extends Common // 调用 $ret = PluginsService::PluginsControlCall($pluginsname, $pluginscontrol, $pluginsaction, 'index', $params); + + // ajax 返回的都是数组、使用统一api返回处理 + if(IS_AJAX) + { + return ApiService::ApiDataReturn($ret['data']); + } + if($ret['code'] == 0) { + // 默认则是视图内容 return $ret['data']; } // 调用失败 - if(IS_AJAX) - { - return $ret; - } else { - MyViewAssign('msg', $ret['msg']); - return MyView('public/tips_error'); - } + MyViewAssign('msg', $ret['msg']); + return MyView(); } /** diff --git a/app/service/PluginsUpgradeService.php b/app/service/PluginsUpgradeService.php index 35419ea69..4e4e03c01 100644 --- a/app/service/PluginsUpgradeService.php +++ b/app/service/PluginsUpgradeService.php @@ -30,7 +30,7 @@ class PluginsUpgradeService public static $params; // 远程插件更新接口 - public static $store_plugins_upgrade_url = 'https://store.shopxo.net/index.php?s=/api/plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeurl'; + public static $store_plugins_upgrade_url = 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeurl'; /** * 更新入口 diff --git a/app/service/StoreService.php b/app/service/StoreService.php index 3b9fa3f20..f96574687 100644 --- a/app/service/StoreService.php +++ b/app/service/StoreService.php @@ -22,16 +22,16 @@ use app\service\ConfigService; class StoreService { // 远程信息接口 - public static $store_site_info_url = 'https://store.shopxo.net/index.php?s=/api/plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=siteinfo'; + public static $store_site_info_url = 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=siteinfo'; // 远程检查更新接口 - public static $store_inspect_upgrade_url = 'https://store.shopxo.net/index.php?s=/api/plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=inspectupgrade'; + public static $store_inspect_upgrade_url = 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=inspectupgrade'; // 远程插件安全合法校验接口 - public static $store_plugins_legal_check_url = 'https://store.shopxo.net/index.php?s=/api/plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginslegalcheck'; + public static $store_plugins_legal_check_url = 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginslegalcheck'; // 远程插件更新信息接口 - public static $store_plugins_upgrade_info_url = 'https://store.shopxo.net/index.php?s=/api/plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeinfo'; + public static $store_plugins_upgrade_info_url = 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeinfo'; // 站点商店数据缓存key public static $site_store_info_key = 'admin_site_store_info_data'; diff --git a/app/service/SystemUpgradeService.php b/app/service/SystemUpgradeService.php index 59fc0be90..4157db12e 100644 --- a/app/service/SystemUpgradeService.php +++ b/app/service/SystemUpgradeService.php @@ -26,7 +26,7 @@ class SystemUpgradeService public static $params; // 远程系统更新接口 - public static $store_plugins_upgrade_url = 'https://store.shopxo.net/index.php?s=/api/plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=systemsupgradeurl'; + public static $store_plugins_upgrade_url = 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=systemsupgradeurl'; // session key public static $package_url_key = 'package_url_key';