mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-02 03:48:47 +08:00
应用在线安装调试
This commit is contained in:
parent
cdcc4bacee
commit
cd09138b8e
@ -46,6 +46,16 @@ class Index extends Common
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 默认进入页面初始化
|
||||
$to_url = MyUrl('admin/index/init');
|
||||
|
||||
// 是否指定页面地址
|
||||
if(!empty($this->data_request['to_url']))
|
||||
{
|
||||
$to_url = base64_decode(urldecode($this->data_request['to_url']));
|
||||
}
|
||||
|
||||
$this->assign('to_url', $to_url);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
72
application/admin/controller/Packageinstall.php
Normal file
72
application/admin/controller/Packageinstall.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\service\PackageInstallService;
|
||||
|
||||
/**
|
||||
* 软件包安装
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class PackageInstall extends Common
|
||||
{
|
||||
/**
|
||||
* 构造方法
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-28
|
||||
* @desc description
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::__construct();
|
||||
|
||||
// 登录校验
|
||||
$this->IsLogin();
|
||||
|
||||
// 权限校验
|
||||
$this->IsPower();
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能插件安装
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-28
|
||||
* @desc description
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
$data = PackageInstallService::RequestInstallParams($this->data_request);
|
||||
$this->assign('data', $data);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 软件安装
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
*/
|
||||
public function Install()
|
||||
{
|
||||
return PackageInstallService::Install($this->data_post);
|
||||
}
|
||||
}
|
||||
?>
|
@ -77,7 +77,7 @@
|
||||
<div class="am-form-group">
|
||||
<label>{{$data.common_app_weixin_liveplayer_ver.name}}</label>
|
||||
<div class="am-alert am-alert-warning">
|
||||
<p>1. 获取最新组件版本号,默认[ 1.2.7 ]</p>
|
||||
<p>1. 获取最新组件版本号,默认[ 1.2.8 ]</p>
|
||||
<p>2. 登录微信小程序平台,左侧导航[ 直播 ],申请直播权限后等待审核通过方可使用</p>
|
||||
<p>3. 点击左侧导航[ 小程序直播->接入说明 ],找到[ 使用方法说明->1. 【直播组件】如何引入 ],json 代码串[ plugins->live-player-plugin ]参数下的[ version ]的值填入</p>
|
||||
<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/live-player-plugin.html" target="_blank">去获取组件版本号 <i class="am-icon-external-link"></i></a>
|
||||
|
@ -9,7 +9,7 @@
|
||||
{{include file="public/menu" /}}
|
||||
|
||||
<!-- right content -->
|
||||
<iframe id="ifcontent" src="{{:MyUrl('admin/index/init')}}" width="100%" height="100%"></iframe>
|
||||
<iframe id="ifcontent" src="{{$to_url}}" width="100%" height="100%"></iframe>
|
||||
<!-- right content end -->
|
||||
</div>
|
||||
|
||||
|
36
application/admin/view/default/packageinstall/index.html
Normal file
36
application/admin/view/default/packageinstall/index.html
Normal file
@ -0,0 +1,36 @@
|
||||
{{include file="public/header" /}}
|
||||
|
||||
<!-- content start -->
|
||||
<div class="am-padding-sm packageinstall-container" data-url="{{$data.url}}" data-type="{{$data.type}}" data-id="{{$data.id}}" data-admin-url="{{$data.admin_url}}">
|
||||
|
||||
<!-- 进行中 -->
|
||||
<div class="table-no progress-container am-text-center">
|
||||
<p>
|
||||
<i class="am-icon-spinner am-icon-pulse am-icon-lg"></i>
|
||||
</p>
|
||||
<p class="msg-text am-margin-top-sm">正在获取中...</p>
|
||||
</div>
|
||||
|
||||
<!-- 安装成功 -->
|
||||
<div class="table-no success-container am-text-center am-hide">
|
||||
<p>
|
||||
<i class="am-icon-check-circle am-icon-lg am-text-success"></i>
|
||||
</p>
|
||||
<p class="msg-text am-margin-top-sm">安装成功</p>
|
||||
<a class="am-btn am-btn-secondary am-btn-xs am-radius am-margin-top-lg" href="{{$data.admin_url}}">返回后台</a>
|
||||
</div>
|
||||
|
||||
<!-- 错误提示 -->
|
||||
<div class="table-no error-container am-hide">
|
||||
<p>
|
||||
<i class="am-icon-warning am-text-danger"></i>
|
||||
<span class="msg-text am-margin-left-xs am-text-danger">异常错误</span>
|
||||
</p>
|
||||
<a class="am-btn am-btn-secondary am-btn-xs am-radius am-margin-top-lg" href="{{$data.admin_url}}">返回后台</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content end -->
|
||||
|
||||
<!-- footer start -->
|
||||
{{include file="public/footer" /}}
|
||||
<!-- footer end -->
|
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-file">
|
||||
<label class="block">LOGO<span class="am-form-group-label-tips">建议130像素X130像素</span></label>
|
||||
<label class="block">LOGO<span class="am-form-group-label-tips">建议600x600px</span></label>
|
||||
<ul class="plug-file-upload-view plugins-logo-view" data-form-name="logo" data-max-number="1" data-delete="0" data-dialog-type="images">
|
||||
<li>
|
||||
<input type="text" name="logo" value="{{if !empty($data['logo_old'])}}{{$data.logo_old}}{{/if}}" data-validation-message="请上传图片" required />
|
||||
|
@ -990,19 +990,31 @@ function FileSizeByteToUnit($bit)
|
||||
*/
|
||||
function SyncJob($url, $port = 80, $time = 30)
|
||||
{
|
||||
$url_str = str_replace(array('http://', 'https://'), '', $url);
|
||||
$location = strpos($url_str, '/');
|
||||
$host = substr($url_str, 0, $location);
|
||||
$fp = fsockopen($host, $port, $errno, $errstr, $time);
|
||||
if($fp)
|
||||
// curl
|
||||
if(function_exists('curl_init'))
|
||||
{
|
||||
$out = "GET ".str_replace($host, '', $url_str)." HTTP/1.1\r\n";
|
||||
$out .= "Host: ".$host."\r\n";
|
||||
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
|
||||
$out .= "Connection: Close\r\n\r\n";
|
||||
fputs($fp, $out);
|
||||
fclose($fp);
|
||||
CurlGet($url, 1);
|
||||
return true;
|
||||
|
||||
// fsockopen
|
||||
} elseif(function_exists('fsockopen'))
|
||||
{
|
||||
$url_str = str_replace(array('http://', 'https://'), '', $url);
|
||||
$location = strpos($url_str, '/');
|
||||
$host = substr($url_str, 0, $location);
|
||||
$fp = fsockopen($host, $port, $errno, $errstr, $time);
|
||||
if($fp)
|
||||
{
|
||||
$out = "GET ".str_replace($host, '', $url_str)." HTTP/1.1\r\n";
|
||||
$out .= "Host: ".$host."\r\n";
|
||||
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
|
||||
$out .= "Connection: Close\r\n\r\n";
|
||||
fputs($fp, $out);
|
||||
fclose($fp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1597,11 +1609,13 @@ function CurlGet($url, $timeout = 10)
|
||||
* @param [string] $url [请求地址]
|
||||
* @param [array] $post [发送的post数据]
|
||||
* @param [boolean] $is_json [是否使用 json 数据发送]
|
||||
* @param [int] $timeout [超时时间]
|
||||
* @return [mixed] [请求返回的数据]
|
||||
*/
|
||||
function CurlPost($url, $post, $is_json = false)
|
||||
function CurlPost($url, $post, $is_json = false, $timeout = 30)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
|
@ -225,44 +225,6 @@
|
||||
{{/if}}
|
||||
<!-- 订单确认页面地址底部钩子-结束 -->
|
||||
|
||||
<!-- 支付方式 -->
|
||||
{{if $common_order_is_booking neq 1}}
|
||||
<div class="buy-items business-item payment" data-field="payment_id">
|
||||
<h3>选择支付</h3>
|
||||
{{if !empty($payment_list)}}
|
||||
<ul class="payment-list">
|
||||
{{foreach $payment_list as $payment}}
|
||||
<li data-value="{{$payment.id}}" class="{{if isset($params['payment_id']) and $params['payment_id'] eq $payment['id']}}selected{{/if}}">
|
||||
{{if !empty($payment.logo)}}
|
||||
<img src="{{$payment.logo}}" />
|
||||
{{/if}}
|
||||
<span>{{$payment.name}}</span>
|
||||
<i class="icon-active"></i>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{if empty($payment_list)}}
|
||||
<div class="table-no"><i class="am-icon-warning"></i> 没有支付方式</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<!-- 订单确认页面支付方式底部钩子-开始 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_buy_payment_bottom</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_buy_payment_bottom_data) and is_array($plugins_view_buy_payment_bottom_data)}}
|
||||
{{foreach $plugins_view_buy_payment_bottom_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
<!-- 订单确认页面支付方式底部钩子-结束 -->
|
||||
|
||||
<!-- 商品分组订单信息 -->
|
||||
<div class="buy-items">
|
||||
<h3>订单信息</h3>
|
||||
@ -549,9 +511,47 @@
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
<!-- 订单确认页面分组商品底部钩子-结束 -->
|
||||
|
||||
<!-- 支付方式 -->
|
||||
{{if $common_order_is_booking neq 1}}
|
||||
<div class="buy-items business-item payment" data-field="payment_id">
|
||||
<h3>选择支付</h3>
|
||||
{{if !empty($payment_list)}}
|
||||
<ul class="payment-list">
|
||||
{{foreach $payment_list as $payment}}
|
||||
<li data-value="{{$payment.id}}" class="{{if isset($params['payment_id']) and $params['payment_id'] eq $payment['id']}}selected{{/if}}">
|
||||
{{if !empty($payment.logo)}}
|
||||
<img src="{{$payment.logo}}" />
|
||||
{{/if}}
|
||||
<span>{{$payment.name}}</span>
|
||||
<i class="icon-active"></i>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{if empty($payment_list)}}
|
||||
<div class="table-no"><i class="am-icon-warning"></i> 没有支付方式</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<!-- 订单确认页面支付方式底部钩子-开始 -->
|
||||
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
|
||||
<div class="plugins-tag">
|
||||
<span>plugins_view_buy_payment_bottom</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if !empty($plugins_view_buy_payment_bottom_data) and is_array($plugins_view_buy_payment_bottom_data)}}
|
||||
{{foreach $plugins_view_buy_payment_bottom_data as $hook}}
|
||||
{{if is_string($hook) or is_int($hook)}}
|
||||
{{$hook|raw}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
<!-- 订单确认页面支付方式底部钩子-结束 -->
|
||||
|
||||
<!-- 留言 -->
|
||||
<div class="buy-message am-margin-top-lg">
|
||||
<div class="buy-message am-margin-top-sm">
|
||||
<div class="order-extra">
|
||||
<label>买家留言</label>
|
||||
<input type="text" class="memo-input" title="选填,对本次交易的说明(建议填写已经和卖家达成一致的说明)" placeholder="选填,建议填写和卖家达成一致的说明" />
|
||||
|
@ -89,17 +89,17 @@
|
||||
</a> {{$Think.APPLICATION_VERSION}}
|
||||
</p>
|
||||
{{if !empty($home_site_icp)}}
|
||||
<p>
|
||||
<p class="footer-icp">
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank">
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-icp-icon.png" width="20" height="20" alt="ICP备案" />
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-icp-icon.png" alt="ICP备案" />
|
||||
{{$home_site_icp}}
|
||||
</a>
|
||||
</p>
|
||||
{{/if}}
|
||||
{{if !empty($home_site_security_record_name)}}
|
||||
<p>
|
||||
<p class="footer-icp">
|
||||
<a {{if empty($home_site_security_record_url)}}href="javascript:;"{{else /}}href="{{$home_site_security_record_url}}" target="_blank"{{/if}}>
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-gongan-icon.png" width="20" height="20" alt="公安备案" />
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-gongan-icon.png" alt="公安备案" />
|
||||
{{$home_site_security_record_name}}
|
||||
</a>
|
||||
</p>
|
||||
|
@ -622,7 +622,7 @@ class AppMiniService
|
||||
if(is_array($config) && isset($config['plugins']))
|
||||
{
|
||||
$config['plugins']['live-player-plugin'] = [
|
||||
'version' => MyC('common_app_weixin_liveplayer_ver', '1.2.7', true),
|
||||
'version' => MyC('common_app_weixin_liveplayer_ver', '1.2.8', true),
|
||||
'provider' => 'wx2b03c6e691cd7370',
|
||||
];
|
||||
if(file_put_contents($file, JsonFormat($config)) === false)
|
||||
|
308
application/service/PackageInstallService.php
Normal file
308
application/service/PackageInstallService.php
Normal file
@ -0,0 +1,308 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use app\service\PluginsAdminService;
|
||||
|
||||
/**
|
||||
* 软件安装服务层
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2020-09-12
|
||||
* @desc description
|
||||
*/
|
||||
class PackageInstallService
|
||||
{
|
||||
/**
|
||||
* 获取安装参数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function RequestInstallParams($params = [])
|
||||
{
|
||||
// 商店商品id
|
||||
$id = empty($params['id']) ? 0 : intval($params['id']);
|
||||
|
||||
// 类型
|
||||
$type = empty($params['type']) ? '' : $params['type'];
|
||||
|
||||
return [
|
||||
'id' => $id,
|
||||
'type' => $type,
|
||||
'url' => MyUrl('admin/packageinstall/install'),
|
||||
'admin_url' => MyUrl('admin/index/index', ['to_url'=>urldecode(base64_encode(MyUrl('admin/pluginsadmin/index')))]),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 软件安装
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function Install($params = [])
|
||||
{
|
||||
// 参数校验
|
||||
$ret = self::ParamsCheck($params);
|
||||
if($ret['code'] != 0)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 操作类型
|
||||
switch($params['opt'])
|
||||
{
|
||||
// 获取url地址
|
||||
case 'url' :
|
||||
$ret = self::UrlHandle($params['id']);
|
||||
break;
|
||||
|
||||
// 下载软件包
|
||||
case 'download' :
|
||||
$ret = self::DownloadHandle($params['key']);
|
||||
break;
|
||||
|
||||
// 安装软件包
|
||||
case 'install' :
|
||||
$ret = self::InstallHandle($params);
|
||||
break;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装软件包
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function InstallHandle($params)
|
||||
{
|
||||
// 获取目录文件
|
||||
$res = self::DirFileData($params['key']);
|
||||
if(!file_exists($res['url']))
|
||||
{
|
||||
return DataReturn('软件包不存在、请重新安装', -1);
|
||||
}
|
||||
|
||||
// 根据插件类型调用安装程序
|
||||
switch($params['type'])
|
||||
{
|
||||
// 功能插件
|
||||
case 'plugins' :
|
||||
$ret = PluginsAdminService::PluginsUploadHandle($res['url'], $params);
|
||||
break;
|
||||
|
||||
// 默认
|
||||
default :
|
||||
$ret = DataReturn('插件操作类型有误', -1);
|
||||
}
|
||||
|
||||
// 移除session
|
||||
session($params['key'], null);
|
||||
|
||||
// 删除本地文件
|
||||
\base\FileUtil::UnlinkFile($res['url']);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载软件包
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [string] $key [缓存key]
|
||||
*/
|
||||
public static function DownloadHandle($key)
|
||||
{
|
||||
// 获取下载地址
|
||||
$url = session($key);
|
||||
if(empty($url))
|
||||
{
|
||||
return DataReturn('下载地址为空', -1);
|
||||
}
|
||||
|
||||
// 获取目录文件
|
||||
$res = self::DirFileData($key);
|
||||
|
||||
// 目录不存在则创建
|
||||
\base\FileUtil::CreateDir($res['dir'].$res['path']);
|
||||
|
||||
// 下载保存
|
||||
if(@file_put_contents($res['url'], RequestGet($url)) !== false)
|
||||
{
|
||||
return DataReturn('success', 0, $key);
|
||||
}
|
||||
return DataReturn('插件下载失败', -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载地址
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [int] $goods_id [商品id]
|
||||
*/
|
||||
public static function UrlHandle($goods_id)
|
||||
{
|
||||
// 获取下载地址
|
||||
$url = config('shopxo.store_download_url');
|
||||
$data = [
|
||||
'goods_id' => $goods_id,
|
||||
'url' => __MY_URL__,
|
||||
'host' => __MY_HOST__,
|
||||
'ip' => __MY_ADDR__,
|
||||
'ver' => APPLICATION_VERSION,
|
||||
];
|
||||
$ret = self::HttpRequest($url, $data);
|
||||
if(!empty($ret) && isset($ret['code']) && $ret['code'] == 0)
|
||||
{
|
||||
$key = md5($ret['data']);
|
||||
session($key, $ret['data']);
|
||||
$ret['data'] = $key;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取软件存储信息
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [string] $key [缓存key]
|
||||
*/
|
||||
public static function DirFileData($key)
|
||||
{
|
||||
// 将软件包下载到磁盘
|
||||
$dir = ROOT;
|
||||
$path = 'runtime'.DS.'data'.DS.'plugins_package_install'.DS;
|
||||
$filename = $key.'.zip';
|
||||
|
||||
// 目录不存在则创建
|
||||
\base\FileUtil::CreateDir($dir.$path);
|
||||
|
||||
return [
|
||||
'dir' => $dir,
|
||||
'path' => $path,
|
||||
'file' => $filename,
|
||||
'url' => $dir.$path.$filename,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入参数校验
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function ParamsCheck($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'id',
|
||||
'error_msg' => '商品id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'type',
|
||||
'error_msg' => '插件类型有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'in',
|
||||
'key_name' => 'opt',
|
||||
'checked_data' => ['url', 'download', 'install'],
|
||||
'error_msg' => '操作类型有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 下载和安装需要校验key
|
||||
if(in_array($params['opt'], ['download', 'install']) && empty($params['key']))
|
||||
{
|
||||
return DataReturn('操作key有误', -1);
|
||||
}
|
||||
|
||||
return DataReturn('success', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络请求
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param [string] $url [请求url]
|
||||
* @param [array] $data [发送数据]
|
||||
* @return [json] [请求返回数据]
|
||||
*/
|
||||
public static function HttpRequest($url, $data)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$body_string = '';
|
||||
if(is_array($data) && 0 < count($data))
|
||||
{
|
||||
foreach($data as $k => $v)
|
||||
{
|
||||
$body_string .= $k.'='.urlencode($v).'&';
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $body_string);
|
||||
}
|
||||
$headers = [
|
||||
'Content-type: application/x-www-form-urlencoded;charset=UTF-8',
|
||||
'X-Requested-With: XMLHttpRequest',
|
||||
];
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$reponse = curl_exec($ch);
|
||||
$error = curl_errno($ch);
|
||||
curl_close($ch);
|
||||
if($error)
|
||||
{
|
||||
return DataReturn("curl出错,错误码:$error", -1);
|
||||
}
|
||||
return json_decode($reponse, true);
|
||||
}
|
||||
}
|
||||
?>
|
@ -1032,6 +1032,21 @@ php;
|
||||
return DataReturn('文件格式有误,请上传zip压缩包', -2);
|
||||
}
|
||||
|
||||
// 上传处理
|
||||
return self::PluginsUploadHandle($_FILES['file']['tmp_name'], $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用上传处理
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-12-19T00:53:45+0800
|
||||
* @param [string] $package_file [软件包地址]
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function PluginsUploadHandle($package_file, $params = [])
|
||||
{
|
||||
// 权限校验
|
||||
$ret = self::PowerCheck();
|
||||
if($ret['code'] != 0)
|
||||
@ -1055,7 +1070,7 @@ php;
|
||||
$plugins = '';
|
||||
|
||||
// 开始解压文件
|
||||
$resource = zip_open($_FILES['file']['tmp_name']);
|
||||
$resource = zip_open($package_file);
|
||||
if(!is_resource($resource))
|
||||
{
|
||||
return DataReturn('压缩包打开失败['.$resource.']', -10);
|
||||
|
@ -72,7 +72,11 @@ class StoreService
|
||||
*/
|
||||
public static function RequestParamsString($params = [])
|
||||
{
|
||||
return '?ver='.APPLICATION_VERSION.'&url='.urlencode(__MY_URL__).'&host='.urlencode(__MY_HOST__).'&ip='.urlencode(__MY_ADDR__);
|
||||
// 当前管理员后台地址
|
||||
$admin_url = explode('?', __MY_VIEW_URL__);
|
||||
|
||||
// 拼接商店请求参数地址
|
||||
return '?ver='.urldecode(base64_encode(APPLICATION_VERSION)).'&url='.urlencode(base64_encode(__MY_URL__)).'&host='.urlencode(base64_encode(__MY_HOST__)).'&ip='.urlencode(base64_encode(__MY_ADDR__)).'&admin_url='.urlencode(base64_encode($admin_url[0]));
|
||||
}
|
||||
}
|
||||
?>
|
@ -32,109 +32,5 @@ return array (
|
||||
'log_write' =>
|
||||
array (
|
||||
),
|
||||
'plugins_admin_css' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_css' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_js' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_navigation_header_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_users_center_left_menu_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_header_navigation_top_right_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_warehouse_goods_inventory_deduct' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_warehouse_goods_inventory_rollback' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_warehouse_goods_inventory_sync' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_goods_field_status_update' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_goods_delete' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_goods_save_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_editor_path_type_admin_goods_saveinfo' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_right_content_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_base_bottom' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_view_goods_detail_base_buy_nav_min_inside_begin' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_warehouse_handle_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_buy_order_insert_begin' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_buy_order_insert_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_system_begin' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_view_buy_form_inside' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_view_buy_base_confirm_top' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_view_admin_order_list_operate' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_order_status_change_history_success_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_order_aftersale_audit_handle_end' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
'plugins_service_goods_buy_nav_button_handle' =>
|
||||
array (
|
||||
0 => 'app\\plugins\\store\\Hook',
|
||||
),
|
||||
);
|
||||
?>
|
@ -28,7 +28,7 @@ if(substr($cdn_public_host, -1) != DS)
|
||||
// 配置信息
|
||||
return [
|
||||
// 开发模式
|
||||
'is_develop' => false,
|
||||
'is_develop' => true,
|
||||
|
||||
// 默认编码
|
||||
'default_charset' => 'utf-8',
|
||||
@ -85,8 +85,9 @@ return [
|
||||
// 应用商店地址
|
||||
'website_url' => 'https://shopxo.net/',
|
||||
'store_url' => 'https://store.shopxo.net/',
|
||||
'store_payment_url' => 'https://store.shopxo.net/payment.html',
|
||||
'store_theme_url' => 'https://store.shopxo.net/theme.html',
|
||||
'store_payment_url' => 'https://store.shopxo.net/',
|
||||
'store_theme_url' => 'https://store.shopxo.net/',
|
||||
'store_download_url' => 'http://dev.shopxo.net/index.php?s=store-package-onine.html',
|
||||
|
||||
// 开启U带域名
|
||||
'url_domain_deploy' => true,
|
||||
|
@ -1,5 +1,15 @@
|
||||
$(function()
|
||||
{
|
||||
/**
|
||||
* 指定url地址
|
||||
*/
|
||||
var to_url = GetQueryValue('to_url') || null;
|
||||
console.log(to_url)
|
||||
if(to_url != null)
|
||||
{
|
||||
console.log(to_url);
|
||||
}
|
||||
|
||||
/**
|
||||
* url加载
|
||||
*/
|
||||
|
95
public/static/admin/default/js/packageinstall.js
Normal file
95
public/static/admin/default/js/packageinstall.js
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* 异步请求步骤
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param {[string]} key [操作key(仅download和install需要)]
|
||||
* @param {[string]} opt [操作类型(url 获取下载地址, download 下载插件包, install 安装插件包)]
|
||||
* @param {[string]} msg [提示信息]
|
||||
*/
|
||||
function RequestHandle(key, opt, msg)
|
||||
{
|
||||
// 操作容器
|
||||
var $container = $('.packageinstall-container');
|
||||
var $progress = $('.progress-container');
|
||||
var $error = $('.error-container');
|
||||
var $success = $('.success-container');
|
||||
|
||||
// 获取参数值
|
||||
var id = $container.data('id') || 0;
|
||||
var type = $container.data('type') || null;
|
||||
var url = $container.data('url') || null;
|
||||
var admin_url = $container.data('admin-url') || null;
|
||||
if(id == 0 || type == null || url == null)
|
||||
{
|
||||
$progress.addClass('am-hide');
|
||||
$error.removeClass('am-hide');
|
||||
$error.find('.msg-text').text('请求参数有误');
|
||||
return false;
|
||||
}
|
||||
|
||||
// 默认获取地址
|
||||
if((opt || null) == null)
|
||||
{
|
||||
opt = 'url';
|
||||
}
|
||||
|
||||
// 加载提示
|
||||
$progress.find('.msg-text').text(msg || '正在获取中...');
|
||||
|
||||
// ajax
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
timeout: 30000,
|
||||
data: {"id":id, "type":type, "opt":opt, "key":key || ''},
|
||||
success: function(result)
|
||||
{
|
||||
if((result || null) != null && result.code == 0)
|
||||
{
|
||||
switch(opt)
|
||||
{
|
||||
// 获取下载地址
|
||||
case 'url' :
|
||||
RequestHandle(result.data, 'download', '正在下载中...');
|
||||
break;
|
||||
|
||||
// 下载插件包
|
||||
case 'download' :
|
||||
RequestHandle(result.data, 'install', '正在安装中...');
|
||||
break;
|
||||
|
||||
// 安装完成
|
||||
case 'install' :
|
||||
$progress.addClass('am-hide');
|
||||
$error.addClass('am-hide');
|
||||
$success.removeClass('am-hide');
|
||||
setTimeout(function()
|
||||
{
|
||||
window.location.href = admin_url;
|
||||
}, 3000);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$progress.addClass('am-hide');
|
||||
$error.removeClass('am-hide');
|
||||
$error.find('.msg-text').text(((result || null) == null) ? '返回数据格式错误' : (result.msg || '异常错误'));
|
||||
}
|
||||
},
|
||||
error: function(xhr, type)
|
||||
{
|
||||
$progress.addClass('am-hide');
|
||||
$error.removeClass('am-hide');
|
||||
$error.find('.msg-text').text(HtmlToString(xhr.responseText) || '异常错误');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function()
|
||||
{
|
||||
// 请求安装
|
||||
RequestHandle();
|
||||
});
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 2.6 KiB |
@ -1913,6 +1913,30 @@ function HtmlToString(html_str)
|
||||
return ToTxt(html_str).replace(/\<\;br[\&ensp\;|\&emsp\;]*[\/]?\>\;|\r\n|\n/g, '<br/>');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取浏览器参数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2021-02-22
|
||||
* @desc description
|
||||
* @param {[string]} field [参数字段名称]
|
||||
*/
|
||||
function GetQueryValue(field)
|
||||
{
|
||||
var query = window.location.search.substring(1);
|
||||
var vars = query.split('&');
|
||||
for(var i=0;i<vars.length;i++)
|
||||
{
|
||||
var pair = vars[i].split('=');
|
||||
if(pair[0] == field)
|
||||
{
|
||||
return pair[1];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 公共数据操作
|
||||
|
@ -40,7 +40,7 @@ ul.logistics-list li img, ul.payment-list li img { width: 36px; height: 36px; ve
|
||||
|
||||
/*运费、留言、扩展数据*/
|
||||
.td.td-oplist .pay-logis,.td.td-bonus select{position:absolute;top:6px;right:0;}
|
||||
.memo-input {width:calc(100% - 55px);border: 1px solid #f2f2f2;padding: 5px;outline:none;border-radius: 2px;}
|
||||
.memo-input {width:calc(100% - 55px);border: 1px solid #f8f7f7;padding: 5px;outline:none;border-radius: 2px;}
|
||||
@media only screen and (max-width: 1025px) {
|
||||
.buy-message {
|
||||
padding: 0 5px;
|
||||
|
@ -331,6 +331,11 @@ input.add,input.min{width:15px}
|
||||
.am-footer-miscs .powered a span.o {
|
||||
color: #e6000e;
|
||||
}
|
||||
.am-footer-miscs .footer-icp img {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
vertical-align: sub;
|
||||
}
|
||||
@media only screen and (max-width:1025px) {
|
||||
.am-footer-default .am-container {
|
||||
padding: 0 5px;
|
||||
|
@ -454,7 +454,7 @@ flex: 1 1 0%;line-height: 16px;cursor: pointer;}
|
||||
.tb-s40 a { *font-size:35px;}
|
||||
.tb-s40{ height:60px; width:60px; }
|
||||
.tb-booth { border-bottom:1px solid #f5f5f5; position:relative; z-index:1;overflow: hidden; height: 358px; }
|
||||
.tb-booth img { height: 100%; margin: 0 auto; display: block; }
|
||||
.tb-booth img { max-width: 100%;height: 100%; margin: 0 auto; display: block; }
|
||||
.tb-thumb .tb-selected { background:none repeat scroll 0 0 #C30008; height:62px;}
|
||||
.tb-thumb .tb-selected div { background-color:#FFFFFF; border:medium none; }
|
||||
.tb-thumb li div { border:1px solid #eee; overflow: hidden;}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue
Block a user