商店连接优化
parent
966cb859e2
commit
dff6e29972
|
|
@ -212,15 +212,19 @@ class Common extends BaseController
|
||||||
MyViewAssign('admin_theme_site_name', MyC('admin_theme_site_name', 'ShopXO', true));
|
MyViewAssign('admin_theme_site_name', MyC('admin_theme_site_name', 'ShopXO', true));
|
||||||
|
|
||||||
// 站点商店信息
|
// 站点商店信息
|
||||||
|
$site_store_error = '';
|
||||||
$site_store_info = StoreService::SiteStoreInfo();
|
$site_store_info = StoreService::SiteStoreInfo();
|
||||||
if(empty($site_store_info))
|
if(empty($site_store_info))
|
||||||
{
|
{
|
||||||
$res = StoreService::SiteStoreAccountsBindHandle();
|
$ret = StoreService::SiteStoreAccountsBindHandle();
|
||||||
if(!empty($res) && isset($res['code']) && $res['code'] == 0)
|
if($ret['code'] == 0)
|
||||||
{
|
{
|
||||||
$site_store_info = StoreService::SiteStoreInfo();
|
$site_store_info = StoreService::SiteStoreInfo();
|
||||||
|
} else {
|
||||||
|
$site_store_error = $ret['msg'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MyViewAssign('site_store_error', $site_store_error);
|
||||||
MyViewAssign('site_store_info', $site_store_info);
|
MyViewAssign('site_store_info', $site_store_info);
|
||||||
|
|
||||||
// 更多链接地址
|
// 更多链接地址
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class Config extends Common
|
||||||
MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list'));
|
MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list'));
|
||||||
MyViewAssign('common_login_type_list', MyConst('common_login_type_list'));
|
MyViewAssign('common_login_type_list', MyConst('common_login_type_list'));
|
||||||
MyViewAssign('common_close_open_list', MyConst('common_close_open_list'));
|
MyViewAssign('common_close_open_list', MyConst('common_close_open_list'));
|
||||||
|
MyViewAssign('common_is_text_list', MyConst('common_is_text_list'));
|
||||||
|
|
||||||
// 配置信息
|
// 配置信息
|
||||||
MyViewAssign('data', ConfigService::ConfigList());
|
MyViewAssign('data', ConfigService::ConfigList());
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,15 @@
|
||||||
<h3 class="am-panel-title">扩展</h3>
|
<h3 class="am-panel-title">扩展</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="am-panel-bd am-padding-vertical-xs">
|
<div class="am-panel-bd am-padding-vertical-xs">
|
||||||
|
<div class="am-form-group">
|
||||||
|
<label>{{$data.common_is_https_connect_store.name}}<span class="am-form-group-label-tips">{{$data.common_is_https_connect_store.describe}}</span></label>
|
||||||
|
<select name="{{$data.common_is_https_connect_store.only_tag}}" class="am-radius chosen-select" data-validation-message="{{$data.common_is_https_connect_store.error_tips}}" required>
|
||||||
|
{{foreach $common_is_text_list as $v}}
|
||||||
|
<option value="{{$v.id}}" {{if isset($data['common_is_https_connect_store']['value']) and $data['common_is_https_connect_store']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
|
||||||
|
{{/foreach}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="am-form-group">
|
<div class="am-form-group">
|
||||||
<label>{{$data.common_baidu_map_ak.name}}<span class="am-form-group-label-tips">{{$data.common_baidu_map_ak.describe}}</span></label>
|
<label>{{$data.common_baidu_map_ak.name}}<span class="am-form-group-label-tips">{{$data.common_baidu_map_ak.describe}}</span></label>
|
||||||
<input type="text" name="{{$data.common_baidu_map_ak.only_tag}}" placeholder="{{$data.common_baidu_map_ak.describe}}" data-validation-message="{{$data.common_baidu_map_ak.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_baidu_map_ak.value}}"{{/if}} />
|
<input type="text" name="{{$data.common_baidu_map_ak.only_tag}}" placeholder="{{$data.common_baidu_map_ak.describe}}" data-validation-message="{{$data.common_baidu_map_ak.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_baidu_map_ak.value}}"{{/if}} />
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@
|
||||||
<a href="javascript:;" class="am-margin-left-xs store-accounts-event">修改</a>
|
<a href="javascript:;" class="am-margin-left-xs store-accounts-event">修改</a>
|
||||||
{{else /}}
|
{{else /}}
|
||||||
<a href="javascript:;" class="am-margin-left-xs store-accounts-event">绑定ShopXO商店账户</a>
|
<a href="javascript:;" class="am-margin-left-xs store-accounts-event">绑定ShopXO商店账户</a>
|
||||||
|
<!-- 连接商店错误信息 --->
|
||||||
|
{{if !empty($site_store_error)}}
|
||||||
|
<span class="am-text-danger am-margin-left-sm">{{$site_store_error}}</span>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<!-- 广告 -->
|
<!-- 广告 -->
|
||||||
|
|
|
||||||
|
|
@ -256,10 +256,20 @@ function GetHttpCode($url, $timeout = 5)
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_exec($ch);
|
|
||||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
// 返回结果
|
||||||
curl_close($ch);
|
$result = curl_exec($ch);
|
||||||
return $code;
|
if($result !== false)
|
||||||
|
{
|
||||||
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
return DataReturn('success', 0, $code);
|
||||||
|
} else {
|
||||||
|
$error_code = curl_errno($ch);
|
||||||
|
$error_msg = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
return DataReturn($error_msg.' ('.$error_code.')', -9999, $error_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2032,7 +2042,6 @@ function CurlGet($url, $timeout = 10)
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
return $result;
|
return $result;
|
||||||
|
|
@ -2087,11 +2096,12 @@ function CurlPost($url, $post, $is_json = false, $timeout = 30)
|
||||||
if($result !== false)
|
if($result !== false)
|
||||||
{
|
{
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
return $result;
|
return DataReturn('success', 0, $result);
|
||||||
} else {
|
} else {
|
||||||
$error = curl_errno($ch);
|
$error_code = curl_errno($ch);
|
||||||
|
$error_msg = curl_error($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
return "curl出错,错误码:$error";
|
return DataReturn($error_msg.' ('.$error_code.')', -9999, $error_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,9 @@ class ConfigService
|
||||||
'home_max_limit_image',
|
'home_max_limit_image',
|
||||||
'home_max_limit_video',
|
'home_max_limit_video',
|
||||||
'home_max_limit_file',
|
'home_max_limit_file',
|
||||||
|
|
||||||
|
// 是否采用https连接商店
|
||||||
|
'common_is_https_connect_store',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -338,17 +338,15 @@ class PackageInstallService
|
||||||
*/
|
*/
|
||||||
public static function HttpRequest($url, $data)
|
public static function HttpRequest($url, $data)
|
||||||
{
|
{
|
||||||
$res = CurlPost($url, $data);
|
$ret = CurlPost($url, $data);
|
||||||
$result = json_decode($res, true);
|
if($ret['code'] != 0)
|
||||||
|
{
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
$result = json_decode($ret['data'], true);
|
||||||
if(empty($result))
|
if(empty($result))
|
||||||
{
|
{
|
||||||
return DataReturn('商店网络不通['.$res.']', -1);
|
return DataReturn('商店返回数据有误'.(empty($ret['data']) ? '' : '('.$ret['data'].')'), -1);
|
||||||
}
|
|
||||||
|
|
||||||
// 是否非数组
|
|
||||||
if(is_string($result))
|
|
||||||
{
|
|
||||||
return DataReturn($result, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求成功
|
// 请求成功
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,7 @@ class PluginsService
|
||||||
$ret = StoreService::PluginsLegalCheck($check_params);
|
$ret = StoreService::PluginsLegalCheck($check_params);
|
||||||
MyCache($key, $ret, 3600);
|
MyCache($key, $ret, 3600);
|
||||||
}
|
}
|
||||||
if($ret['code'] != 0)
|
if(!in_array($ret['code'], [0, -9999]))
|
||||||
{
|
{
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -276,15 +276,16 @@ class StoreService
|
||||||
// http状态验证
|
// http状态验证
|
||||||
$key = 'cache_store_url_http_code';
|
$key = 'cache_store_url_http_code';
|
||||||
$time = 600;
|
$time = 600;
|
||||||
$code = MyCache($key);
|
$ret = MyCache($key);
|
||||||
if($code === null)
|
if(empty($ret))
|
||||||
{
|
{
|
||||||
$code = GetHttpCode(self::StoreUrl(), 2);
|
$ret = GetHttpCode(self::StoreUrl(), 2);
|
||||||
MyCache($key, $code, $time);
|
MyCache($key, $ret, $time);
|
||||||
}
|
}
|
||||||
if(!in_array($code, [200, 301, 302, 307, 308]))
|
if(!in_array($ret['data'], [200, 301, 302, 307, 308]))
|
||||||
{
|
{
|
||||||
return DataReturn('商店网络不通', 0);
|
$ret['msg'] = '商店连接失败[ '.$ret['msg'].' ]';
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 基础数据获取
|
// 基础数据获取
|
||||||
|
|
@ -310,19 +311,26 @@ class StoreService
|
||||||
'php_sapi_name' => php_sapi_name(),
|
'php_sapi_name' => php_sapi_name(),
|
||||||
'client_date' => date('Y-m-d H:i:s'),
|
'client_date' => date('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
$res = CurlPost($url, array_merge($data, $params));
|
$ret = CurlPost($url, array_merge($data, $params));
|
||||||
$result = json_decode($res, true);
|
if($ret['code'] != 0)
|
||||||
|
{
|
||||||
|
// 网络不通
|
||||||
|
MyCache($key, 0, $ret['data']);
|
||||||
|
$ret['msg'] = '商店连接失败[ '.$ret['msg'].' ]';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 数据解析
|
||||||
|
$result = json_decode($ret['data'], true);
|
||||||
if(empty($result))
|
if(empty($result))
|
||||||
{
|
{
|
||||||
// 网络不通、返回非有效json数据则认为网络不通
|
return DataReturn('商店返回数据有误'.(empty($ret['data']) ? '' : '('.$ret['data'].')'), -1);
|
||||||
MyCache($key, 0, $time);
|
|
||||||
return DataReturn('商店网络不通', 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否非数组
|
// 是否非数组
|
||||||
if(is_string($result))
|
if(is_string($result))
|
||||||
{
|
{
|
||||||
return DataReturn($result, -1);
|
return DataReturn('商店返回数据无效[ '.$result.' ]', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求成功
|
// 请求成功
|
||||||
|
|
@ -330,12 +338,12 @@ class StoreService
|
||||||
{
|
{
|
||||||
if(empty($result['data']))
|
if(empty($result['data']))
|
||||||
{
|
{
|
||||||
return DataReturn('无对应数据、请稍后再试!', -1);
|
return DataReturn('商店返回无对应数据、请稍后再试!', -1);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DataReturn(empty($result['msg']) ? '异常错误失败、请稍后再试!' : $result['msg'], -1);
|
return DataReturn(empty($result['msg']) ? '商店返回异常错误、请稍后再试!' : '商店返回[ '.$result['msg'].' ]', -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -25,6 +25,9 @@ if(substr($cdn_public_host, -1) != DS)
|
||||||
$cdn_public_host .= DS;
|
$cdn_public_host .= DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 连接商店是否采用https
|
||||||
|
$store_http = (MyFileConfig('common_is_https_connect_store') == 1) ? 'https://' : 'http://';
|
||||||
|
|
||||||
// 配置信息
|
// 配置信息
|
||||||
return [
|
return [
|
||||||
// 开发模式
|
// 开发模式
|
||||||
|
|
@ -101,32 +104,32 @@ return [
|
||||||
|
|
||||||
|
|
||||||
// 应用商店基础地址
|
// 应用商店基础地址
|
||||||
'website_url' => 'https://shopxo.net/',
|
'website_url' => $store_http.'shopxo.net/',
|
||||||
'store_url' => 'https://store.shopxo.net/',
|
'store_url' => $store_http.'store.shopxo.net/',
|
||||||
'store_payment_url' => 'https://store.shopxo.net/',
|
'store_payment_url' => $store_http.'store.shopxo.net/',
|
||||||
'store_theme_url' => 'https://store.shopxo.net/',
|
'store_theme_url' => $store_http.'store.shopxo.net/',
|
||||||
'store_regster_url' => 'https://store.shopxo.net/regster.html',
|
'store_regster_url' => $store_http.'store.shopxo.net/regster.html',
|
||||||
|
|
||||||
// 插件在线下载地址
|
// 插件在线下载地址
|
||||||
'store_download_url' => 'https://store.shopxo.net/index.php?s=store-package-onine.html',
|
'store_download_url' => $store_http.'store.shopxo.net/index.php?s=store-package-onine.html',
|
||||||
|
|
||||||
// 远程系统更新接口
|
// 远程系统更新接口
|
||||||
'store_system_upgrade_url' => 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=systemsupgradeurl',
|
'store_system_upgrade_url' => $store_http.'store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=systemsupgradeurl',
|
||||||
|
|
||||||
// 远程插件更新接口
|
// 远程插件更新接口
|
||||||
'store_plugins_upgrade_url' => 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeurl',
|
'store_plugins_upgrade_url' => $store_http.'store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeurl',
|
||||||
|
|
||||||
// 远程信息接口
|
// 远程信息接口
|
||||||
'store_site_info_url' => 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=siteinfo',
|
'store_site_info_url' => $store_http.'store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=siteinfo',
|
||||||
|
|
||||||
// 远程检查更新接口
|
// 远程检查更新接口
|
||||||
'store_inspect_upgrade_url' => 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=inspectupgrade',
|
'store_inspect_upgrade_url' => $store_http.'store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=inspectupgrade',
|
||||||
|
|
||||||
// 远程插件安全合法校验接口
|
// 远程插件安全合法校验接口
|
||||||
'store_plugins_legal_check_url' => 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginslegalcheck',
|
'store_plugins_legal_check_url' => $store_http.'store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginslegalcheck',
|
||||||
|
|
||||||
// 远程插件更新信息接口
|
// 远程插件更新信息接口
|
||||||
'store_plugins_upgrade_info_url' => 'https://store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeinfo',
|
'store_plugins_upgrade_info_url' => $store_http.'store.shopxo.net/api.php?s=plugins/index&pluginsname=store&pluginscontrol=index&pluginsaction=pluginsupgradeinfo',
|
||||||
|
|
||||||
|
|
||||||
// 支付业务类型,支付插件根据业务类型自动生成支付入口文件
|
// 支付业务类型,支付插件根据业务类型自动生成支付入口文件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue