2018-12-28 18:58:37 +08:00
|
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
|
|
|
|
// +----------------------------------------------------------------------
|
2021-03-16 10:34:52 +08:00
|
|
|
|
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
|
2018-12-28 18:58:37 +08:00
|
|
|
|
// +----------------------------------------------------------------------
|
2021-03-16 10:34:52 +08:00
|
|
|
|
// | Licensed ( https://opensource.org/licenses/mit-license.php )
|
2018-12-28 18:58:37 +08:00
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Author: Devil
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
namespace app\service;
|
|
|
|
|
|
2021-02-15 22:45:33 +08:00
|
|
|
|
use app\service\ResourcesService;
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
/**
|
|
|
|
|
* 小程序服务层
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 0.0.1
|
|
|
|
|
* @datetime 2016-12-01T21:51:08+0800
|
|
|
|
|
*/
|
|
|
|
|
class AppMiniService
|
|
|
|
|
{
|
|
|
|
|
// 当前小程序包名称
|
2020-11-21 16:42:35 +08:00
|
|
|
|
public static $application_name;
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
|
|
|
|
// 原包地址/操作地址
|
2020-11-21 16:42:35 +08:00
|
|
|
|
public static $old_root;
|
|
|
|
|
public static $new_root;
|
|
|
|
|
public static $old_path;
|
|
|
|
|
public static $new_path;
|
|
|
|
|
|
|
|
|
|
// 当前默认主题
|
|
|
|
|
public static $default_theme;
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
2021-08-10 20:47:44 +08:00
|
|
|
|
// 排除的文件后缀
|
|
|
|
|
private static $exclude_ext = ['php'];
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
/**
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2018-12-21
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
2019-01-17 00:37:20 +08:00
|
|
|
|
public static function Init($params = [])
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
|
|
|
|
// 当前小程序包名称
|
2020-11-21 16:42:35 +08:00
|
|
|
|
self::$application_name = isset($params['application_name']) ? $params['application_name'] : 'weixin';
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
2021-08-10 20:47:44 +08:00
|
|
|
|
// 小程序类型校验
|
2021-08-14 17:17:45 +08:00
|
|
|
|
if(!array_key_exists(self::$application_name, MyConst('common_appmini_type')))
|
2021-08-10 20:47:44 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('小程序类型有误['.self::$application_name.']', -1);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
// 原包地址/操作地址
|
2020-02-06 16:32:37 +08:00
|
|
|
|
self::$old_root = ROOT.'sourcecode';
|
2020-02-06 16:44:19 +08:00
|
|
|
|
self::$new_root = ROOT.'public'.DS.'download'.DS.'sourcecode';
|
2019-01-17 00:37:20 +08:00
|
|
|
|
self::$old_path = self::$old_root.DS.self::$application_name;
|
|
|
|
|
self::$new_path = self::$new_root.DS.self::$application_name;
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
|
|
|
|
// 默认主题
|
|
|
|
|
self::$default_theme = self::DefaultTheme();
|
2021-08-10 20:47:44 +08:00
|
|
|
|
|
|
|
|
|
return DataReturn('success', 0);
|
2020-11-21 16:42:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 默认主题标识符
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2020-11-20
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function DefaultTheme($params = [])
|
|
|
|
|
{
|
|
|
|
|
return MyC(self::DefaultThemeKey($params), 'default', true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 默认主题标识符数据key
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2020-11-21
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function DefaultThemeKey($params = [])
|
|
|
|
|
{
|
|
|
|
|
if(empty(self::$application_name))
|
|
|
|
|
{
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
// 如果类型错误则使用 weixin 作为默认
|
|
|
|
|
self::$application_name = 'weixin';
|
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 'common_app_mini_'.self::$application_name.'_default_theme';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取模板列表
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 0.0.1
|
|
|
|
|
* @datetime 2017-05-10T10:24:40+0800
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
* @return [array] [模板列表]
|
|
|
|
|
*/
|
|
|
|
|
public static function ThemeList($params = [])
|
|
|
|
|
{
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return [];
|
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
|
|
|
|
// 读取目录
|
|
|
|
|
$result = [];
|
|
|
|
|
$dir = self::$old_path.DS;
|
|
|
|
|
if(is_dir($dir))
|
|
|
|
|
{
|
|
|
|
|
if($dh = opendir($dir))
|
|
|
|
|
{
|
|
|
|
|
$img_obj = \base\Images::Instance();
|
|
|
|
|
$default_preview = __MY_PUBLIC_URL__.'static'.DS.'common'.DS.'images'.DS.'default-preview.jpg';
|
|
|
|
|
while(($temp_file = readdir($dh)) !== false)
|
|
|
|
|
{
|
|
|
|
|
if(substr($temp_file, 0, 1) == '.')
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$config = $dir.$temp_file.DS.'config.json';
|
2021-07-18 23:42:10 +08:00
|
|
|
|
if(is_file($dir.$temp_file) || !is_dir($dir.$temp_file) || !is_file($config) || !file_exists($config))
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 读取配置文件
|
|
|
|
|
$data = json_decode(file_get_contents($config), true);
|
|
|
|
|
if(!empty($data) && is_array($data))
|
|
|
|
|
{
|
|
|
|
|
if(empty($data['name']) || empty($data['ver']) || empty($data['author']))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$preview = $dir.$temp_file.DS.'images'.DS.'preview.jpg';
|
|
|
|
|
$result[] = array(
|
|
|
|
|
'theme' => $temp_file,
|
|
|
|
|
'name' => htmlentities($data['name']),
|
|
|
|
|
'ver' => str_replace(array(',',','), ', ', htmlentities($data['ver'])),
|
|
|
|
|
'author' => htmlentities($data['author']),
|
|
|
|
|
'home' => isset($data['home']) ? $data['home'] : '',
|
|
|
|
|
'preview' => $img_obj->ImageToBase64(file_exists($preview) ? $preview : $default_preview),
|
|
|
|
|
'is_delete' => ($temp_file == 'default') ? 0 : 1,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closedir($dh);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 模板上传
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @datetime 2018-12-19T00:53:45+0800
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function ThemeUpload($params = [])
|
|
|
|
|
{
|
|
|
|
|
// 文件上传校验
|
|
|
|
|
$error = FileUploadError('theme');
|
|
|
|
|
if($error !== true)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn($error, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 文件格式化校验
|
2021-02-15 22:45:33 +08:00
|
|
|
|
$type = ResourcesService::ZipExtTypeList();
|
2020-11-21 16:42:35 +08:00
|
|
|
|
if(!in_array($_FILES['theme']['type'], $type))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('文件格式有误,请上传zip压缩包', -2);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-24 17:34:06 +08:00
|
|
|
|
// 上传处理
|
2021-04-23 16:43:23 +08:00
|
|
|
|
return self::ThemeUploadHandle($_FILES['theme']['tmp_name'], $params);
|
2021-02-24 17:34:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 模板上传处理
|
|
|
|
|
* @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 ThemeUploadHandle($package_file, $params = [])
|
|
|
|
|
{
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2021-02-24 17:34:06 +08:00
|
|
|
|
|
2020-11-21 16:42:35 +08:00
|
|
|
|
// 主题目录
|
|
|
|
|
$dir = self::$old_path.DS;
|
|
|
|
|
|
|
|
|
|
// 目录是否有权限
|
|
|
|
|
if(!is_writable($dir))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('视图目录没权限['.$dir.']', -10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 开始解压文件
|
2021-08-11 17:30:06 +08:00
|
|
|
|
$zip = new \ZipArchive();
|
|
|
|
|
$resource = $zip->open($package_file);
|
|
|
|
|
if($resource != true)
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
2021-08-11 17:30:06 +08:00
|
|
|
|
return DataReturn('压缩包打开失败['.$resource.']', -11);
|
|
|
|
|
}
|
|
|
|
|
for($i=0; $i<$zip->numFiles; $i++)
|
|
|
|
|
{
|
|
|
|
|
// 资源文件
|
|
|
|
|
$file = $zip->getNameIndex($i);
|
|
|
|
|
|
|
|
|
|
// 排除系统.开头的临时文件和目录
|
|
|
|
|
if(strpos($file, '/.') !== false)
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
2021-08-11 17:30:06 +08:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
2021-08-11 17:30:06 +08:00
|
|
|
|
// 排除后缀文件
|
|
|
|
|
$pos = strripos($file, '.');
|
|
|
|
|
if($pos !== false)
|
|
|
|
|
{
|
|
|
|
|
$info = pathinfo($file);
|
|
|
|
|
if(isset($info['extension']) && in_array($info['extension'], self::$exclude_ext))
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2021-08-11 17:30:06 +08:00
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
2021-08-11 17:30:06 +08:00
|
|
|
|
// 截取文件路径
|
|
|
|
|
$file_path = $dir.substr($file, 0, strrpos($file, '/'));
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
2021-08-11 17:30:06 +08:00
|
|
|
|
// 路径不存在则创建
|
|
|
|
|
if(!is_dir($file_path))
|
|
|
|
|
{
|
|
|
|
|
mkdir($file_path, 0777, true);
|
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
2021-08-11 17:30:06 +08:00
|
|
|
|
// 如果不是目录则写入文件
|
|
|
|
|
if(!is_dir($dir.$file))
|
|
|
|
|
{
|
|
|
|
|
// 读取这个文件
|
|
|
|
|
$stream = $zip->getStream($file);
|
|
|
|
|
if($stream !== false)
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
2021-08-11 17:30:06 +08:00
|
|
|
|
$file_content = stream_get_contents($stream);
|
|
|
|
|
if($file_content !== false)
|
|
|
|
|
{
|
|
|
|
|
file_put_contents($dir.$file, $file_content);
|
|
|
|
|
}
|
|
|
|
|
fclose($stream);
|
2020-11-21 16:42:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-11 17:30:06 +08:00
|
|
|
|
// 关闭zip
|
|
|
|
|
$zip->close();
|
|
|
|
|
|
2020-11-21 16:42:35 +08:00
|
|
|
|
return DataReturn('安装成功');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 模板删除
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @datetime 2018-12-19T00:46:02+0800
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function ThemeDelete($params = [])
|
|
|
|
|
{
|
|
|
|
|
// 请求参数
|
|
|
|
|
$p = [
|
|
|
|
|
[
|
|
|
|
|
'checked_type' => 'empty',
|
|
|
|
|
'key_name' => 'id',
|
|
|
|
|
'error_msg' => '模板id有误',
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
$ret = ParamsChecked($params, $p);
|
|
|
|
|
if($ret !== true)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn($ret, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
|
|
|
|
// 防止路径回溯
|
|
|
|
|
$id = htmlentities(str_replace(array('.', '/', '\\', ':'), '', strip_tags($params['id'])));
|
|
|
|
|
if(empty($id))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('主题名称有误', -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// default不能删除
|
|
|
|
|
if($id == 'default')
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('系统模板不能删除', -2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 不能删除正在使用的主题
|
|
|
|
|
if(self::$default_theme == $id)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('不能删除正在使用的主题', -2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 开始删除主题
|
|
|
|
|
if(\base\FileUtil::UnlinkDir(self::$old_path.DS.$id))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('删除成功');
|
|
|
|
|
}
|
|
|
|
|
return DataReturn('删除失败或资源不存在', -100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 主题打包
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2019-03-22
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function ThemeDownload($params = [])
|
|
|
|
|
{
|
|
|
|
|
// 请求参数
|
|
|
|
|
$p = [
|
|
|
|
|
[
|
|
|
|
|
'checked_type' => 'empty',
|
|
|
|
|
'key_name' => 'id',
|
|
|
|
|
'error_msg' => '模板id有误',
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
$ret = ParamsChecked($params, $p);
|
|
|
|
|
if($ret !== true)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn($ret, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
|
|
|
|
// 是否开启开发者模式
|
2021-07-18 23:42:10 +08:00
|
|
|
|
if(MyConfig('shopxo.is_develop') !== true)
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('请先开启开发者模式', -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 防止路径回溯
|
|
|
|
|
$theme = htmlentities(str_replace(array('.', '/', '\\', ':'), '', strip_tags($params['id'])));
|
|
|
|
|
if(empty($theme))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('主题名称有误', -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取配置信息
|
2021-04-23 16:43:23 +08:00
|
|
|
|
$config_res = self::MiniThemeConfig($theme, $params);
|
|
|
|
|
if($config_res['code'] != 0)
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
2021-04-23 16:43:23 +08:00
|
|
|
|
return $config_res;
|
2020-11-21 16:42:35 +08:00
|
|
|
|
}
|
2021-04-23 16:43:23 +08:00
|
|
|
|
$config = $config_res['data'];
|
2020-11-21 16:42:35 +08:00
|
|
|
|
|
|
|
|
|
// 目录不存在则创建
|
|
|
|
|
$new_dir = ROOT.'runtime'.DS.'data'.DS.'theme_appmini_package'.DS.$theme;
|
|
|
|
|
\base\FileUtil::CreateDir($new_dir);
|
|
|
|
|
|
|
|
|
|
// 复制包目录
|
|
|
|
|
$old_dir = self::$old_path.DS.$theme;
|
|
|
|
|
if(is_dir($old_dir))
|
|
|
|
|
{
|
|
|
|
|
if(\base\FileUtil::CopyDir($old_dir, $new_dir) != true)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('项目包复制失败', -2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-18 14:15:42 +08:00
|
|
|
|
// 历史信息更新
|
|
|
|
|
$ret = self::HistoryUpdateHandle($new_dir);
|
|
|
|
|
if(isset($ret['code']) && $ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-21 16:42:35 +08:00
|
|
|
|
// 生成压缩包
|
|
|
|
|
$zip = new \base\ZipFolder();
|
|
|
|
|
if(!$zip->zip($new_dir.'.zip', $new_dir))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('压缩包生成失败', -100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生成成功删除目录
|
|
|
|
|
\base\FileUtil::UnlinkDir($new_dir);
|
|
|
|
|
|
|
|
|
|
// 开始下载
|
2021-08-14 17:17:45 +08:00
|
|
|
|
$appmini_type = MyConst('common_appmini_type');
|
2021-04-23 16:43:23 +08:00
|
|
|
|
$application_name = array_key_exists(self::$application_name, $appmini_type) ? $appmini_type[self::$application_name]['name'].'-' : '';
|
2021-05-06 19:13:09 +08:00
|
|
|
|
if(\base\FileUtil::DownloadFile($new_dir.'.zip', $application_name.$config['name'].'_v'.$config['ver'].'.zip'))
|
2020-11-21 16:42:35 +08:00
|
|
|
|
{
|
|
|
|
|
@unlink($new_dir.'.zip');
|
|
|
|
|
} else {
|
|
|
|
|
return DataReturn('下载失败', -100);
|
|
|
|
|
}
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-04-23 16:43:23 +08:00
|
|
|
|
/**
|
|
|
|
|
* 主题配置信息
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2021-04-22
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [string] $theme [主题标识]
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function MiniThemeConfig($theme, $params)
|
|
|
|
|
{
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2021-04-23 16:43:23 +08:00
|
|
|
|
|
|
|
|
|
// 获取配置信息
|
|
|
|
|
$config_file = self::$old_path.DS.$theme.DS.'config.json';
|
|
|
|
|
if(!file_exists($config_file))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('小程序主题配置文件不存在', -1);
|
|
|
|
|
}
|
|
|
|
|
$config = json_decode(file_get_contents($config_file), true);
|
|
|
|
|
if(empty($config))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('主小程序题配置信息有误', -1);
|
|
|
|
|
}
|
|
|
|
|
return DataReturn('success', 0, $config);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
/**
|
2020-11-21 16:42:35 +08:00
|
|
|
|
* 获取小程序下载包数据列表
|
2018-12-28 18:58:37 +08:00
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 0.0.1
|
|
|
|
|
* @datetime 2017-05-10T10:24:40+0800
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
2020-11-21 16:42:35 +08:00
|
|
|
|
public static function DownloadDataList($params = [])
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
|
|
|
|
// 获取包列表
|
|
|
|
|
$result = [];
|
2019-01-17 00:37:20 +08:00
|
|
|
|
if(is_dir(self::$new_path))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
2019-01-17 00:37:20 +08:00
|
|
|
|
if($dh = opendir(self::$new_path))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
|
|
|
|
while(($temp_file = readdir($dh)) !== false)
|
|
|
|
|
{
|
|
|
|
|
if($temp_file != '.' && $temp_file != '..')
|
|
|
|
|
{
|
2019-01-17 00:37:20 +08:00
|
|
|
|
$file_path = self::$new_path.DS.$temp_file;
|
2020-02-06 16:44:19 +08:00
|
|
|
|
$url = __MY_PUBLIC_URL__.'download'.DS.'sourcecode'.DS.self::$application_name.DS.$temp_file;
|
2018-12-28 18:58:37 +08:00
|
|
|
|
$result[] = [
|
2020-06-22 23:21:23 +08:00
|
|
|
|
'name' => (substr($temp_file, -4) === '.zip') ? substr($temp_file, 0, strlen($temp_file)-4) : $temp_file,
|
2018-12-28 18:58:37 +08:00
|
|
|
|
'url' => substr($url, -4) == '.zip' ? $url : '',
|
|
|
|
|
'size' => FileSizeByteToUnit(filesize($file_path)),
|
|
|
|
|
'time' => date('Y-m-d H:i:s', filectime($file_path)),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closedir($dh);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-22 23:21:23 +08:00
|
|
|
|
return DataReturn('success', 0, $result);
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 源码包生成
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2018-12-21
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
2019-01-17 00:37:20 +08:00
|
|
|
|
public static function Created($params = [])
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
2019-01-18 17:38:41 +08:00
|
|
|
|
// 是否https
|
2021-07-18 23:42:10 +08:00
|
|
|
|
if(MyConfig('shopxo.is_develop') !== true)
|
2019-01-18 17:38:41 +08:00
|
|
|
|
{
|
2019-04-29 11:42:37 +08:00
|
|
|
|
if(__MY_HTTP__ != 'https')
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('请使用https协议', -1);
|
|
|
|
|
}
|
2019-01-18 17:38:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
|
|
|
|
// 配置内容
|
2020-11-21 16:42:35 +08:00
|
|
|
|
$title = MyC('common_app_mini_'.self::$application_name.'_title');
|
|
|
|
|
$describe = MyC('common_app_mini_'.self::$application_name.'_describe');
|
|
|
|
|
if(empty($title) || empty($describe))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('配置信息不能为空', -1);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 12:44:38 +08:00
|
|
|
|
// 源码目录不存在则创建
|
|
|
|
|
\base\FileUtil::CreateDir(self::$new_root);
|
|
|
|
|
|
|
|
|
|
// 源码目标目录是否存在
|
2019-01-17 00:37:20 +08:00
|
|
|
|
if(!is_dir(self::$new_root))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
2020-04-07 12:44:38 +08:00
|
|
|
|
return DataReturn('源码目标目录不存在['.self::$new_root.']', -1);
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 12:44:38 +08:00
|
|
|
|
// 源码目标目录没有权限
|
2019-01-17 00:37:20 +08:00
|
|
|
|
if(!is_writable(self::$new_root))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
2020-04-07 12:44:38 +08:00
|
|
|
|
return DataReturn('源码目标目录没有权限['.self::$new_root.']', -1);
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 目录不存在则创建
|
2019-01-17 00:37:20 +08:00
|
|
|
|
\base\FileUtil::CreateDir(self::$new_path);
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
|
|
|
|
// 复制包目录
|
2020-11-21 16:42:35 +08:00
|
|
|
|
$old_dir = self::$old_path.DS.self::$default_theme;
|
2019-01-17 00:37:20 +08:00
|
|
|
|
$new_dir = self::$new_path.DS.date('YmdHis');
|
2020-11-21 16:42:35 +08:00
|
|
|
|
if(\base\FileUtil::CopyDir($old_dir, $new_dir) != true)
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('项目包复制失败', -2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校验基础文件是否存在
|
|
|
|
|
if(!file_exists($new_dir.DS.'app.js') || !file_exists($new_dir.DS.'app.json'))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('包基础文件不存在,请重新生成', -3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 替换内容
|
|
|
|
|
// app.js
|
2020-02-04 17:18:14 +08:00
|
|
|
|
$search = [
|
|
|
|
|
'{{request_url}}',
|
|
|
|
|
'{{application_title}}',
|
|
|
|
|
'{{application_describe}}',
|
2020-09-17 22:22:37 +08:00
|
|
|
|
'{{currency_symbol}}',
|
2020-02-04 17:18:14 +08:00
|
|
|
|
];
|
|
|
|
|
$replace = [
|
|
|
|
|
__MY_URL__,
|
2020-11-21 16:42:35 +08:00
|
|
|
|
$title,
|
|
|
|
|
$describe,
|
2021-07-18 23:42:10 +08:00
|
|
|
|
MyConfig('shopxo.currency_symbol'),
|
2020-02-04 17:18:14 +08:00
|
|
|
|
];
|
|
|
|
|
$status = file_put_contents($new_dir.DS.'app.js', str_replace($search, $replace, file_get_contents($new_dir.DS.'app.js')));
|
2018-12-28 18:58:37 +08:00
|
|
|
|
if($status === false)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('基础配置替换失败', -4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// app.json
|
2020-11-21 16:42:35 +08:00
|
|
|
|
$status = file_put_contents($new_dir.DS.'app.json', str_replace(['{{application_title}}'], [$title], file_get_contents($new_dir.DS.'app.json')));
|
2018-12-28 18:58:37 +08:00
|
|
|
|
if($status === false)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('基础配置替换失败', -4);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 22:11:03 +08:00
|
|
|
|
// 小程序额外处理
|
|
|
|
|
switch(self::$application_name)
|
|
|
|
|
{
|
|
|
|
|
// 微信
|
|
|
|
|
case 'weixin' :
|
|
|
|
|
$ret = self::ExtendHandleWeixin($new_dir);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
// 默认
|
|
|
|
|
default :
|
|
|
|
|
$ret = DataReturn('无需处理', 0);
|
|
|
|
|
}
|
|
|
|
|
if(isset($ret['code']) && $ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-18 14:15:42 +08:00
|
|
|
|
// 历史信息更新
|
|
|
|
|
$ret = self::HistoryUpdateHandle($new_dir);
|
|
|
|
|
if(isset($ret['code']) && $ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
// 生成压缩包
|
|
|
|
|
$zip = new \base\ZipFolder();
|
|
|
|
|
if(!$zip->zip($new_dir.'.zip', $new_dir))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('压缩包生成失败', -100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生成成功删除目录
|
|
|
|
|
\base\FileUtil::UnlinkDir($new_dir);
|
|
|
|
|
|
|
|
|
|
return DataReturn('生成成功', 0);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-18 14:15:42 +08:00
|
|
|
|
/**
|
|
|
|
|
* 历史信息更新
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2021-02-18
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [string] $new_dir [新源码包目录]
|
|
|
|
|
*/
|
|
|
|
|
public static function HistoryUpdateHandle($new_dir)
|
|
|
|
|
{
|
|
|
|
|
// 配置信息
|
|
|
|
|
$file = $new_dir.DS.'app.json';
|
|
|
|
|
$config = json_decode(file_get_contents($file), true);
|
2021-03-17 12:16:54 +08:00
|
|
|
|
|
|
|
|
|
// 插件配置为空防止成为数组
|
|
|
|
|
if(array_key_exists('plugins', $config) && empty($config['plugins']))
|
|
|
|
|
{
|
|
|
|
|
$config['plugins'] = (object) [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 历史信息
|
2021-02-18 14:15:42 +08:00
|
|
|
|
if(empty($config['history']))
|
|
|
|
|
{
|
|
|
|
|
$config['history'] = [];
|
|
|
|
|
}
|
|
|
|
|
$config['history'][] = [
|
|
|
|
|
'host' => __MY_HOST__,
|
|
|
|
|
'url' => __MY_URL__,
|
|
|
|
|
'ip' => __MY_ADDR__,
|
|
|
|
|
'time' => date('Y-m-d H:i:s'),
|
|
|
|
|
];
|
|
|
|
|
if(@file_put_contents($file, JsonFormat($config)) === false)
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('新应用配置文件更新失败', -11);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 22:11:03 +08:00
|
|
|
|
/**
|
|
|
|
|
* 扩展处理 - 微信
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2018-12-21
|
|
|
|
|
* @desc description
|
2021-02-18 14:15:42 +08:00
|
|
|
|
* @param [string] $new_dir [新源码包目录]
|
2019-08-04 22:11:03 +08:00
|
|
|
|
*/
|
|
|
|
|
private static function ExtendHandleWeixin($new_dir)
|
|
|
|
|
{
|
2020-04-21 13:15:50 +08:00
|
|
|
|
// 启用好物推荐
|
|
|
|
|
if(MyC('common_app_is_good_thing', 0) == 1)
|
2019-08-04 22:11:03 +08:00
|
|
|
|
{
|
|
|
|
|
// app.json
|
|
|
|
|
$file = $new_dir.DS.'app.json';
|
2021-02-18 14:15:42 +08:00
|
|
|
|
$config = json_decode(file_get_contents($file), true);
|
|
|
|
|
if(is_array($config) && isset($config['plugins']))
|
2019-08-04 22:11:03 +08:00
|
|
|
|
{
|
2021-02-18 14:15:42 +08:00
|
|
|
|
$config['plugins']['goodsSharePlugin'] = [
|
2020-06-22 23:21:23 +08:00
|
|
|
|
'version' => MyC('common_app_is_good_thing_ver', '4.0.1', true),
|
2019-08-04 22:11:03 +08:00
|
|
|
|
'provider' => 'wx56c8f077de74b07c',
|
|
|
|
|
];
|
2021-02-18 14:15:42 +08:00
|
|
|
|
if(file_put_contents($file, JsonFormat($config)) === false)
|
2019-08-04 22:11:03 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('好物推荐主配置失败', -50);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// goods-detail.json
|
|
|
|
|
$file = $new_dir.DS.'pages'.DS.'goods-detail'.DS.'goods-detail.json';
|
2021-02-18 14:15:42 +08:00
|
|
|
|
$config = json_decode(file_get_contents($file), true);
|
|
|
|
|
if(is_array($config) && isset($config['usingComponents']))
|
2019-08-04 22:11:03 +08:00
|
|
|
|
{
|
2021-02-18 14:15:42 +08:00
|
|
|
|
$config['usingComponents']['share-button'] = 'plugin://goodsSharePlugin/share-button';
|
|
|
|
|
if(file_put_contents($file, JsonFormat($config)) === false)
|
2019-08-04 22:11:03 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('好物推荐商品配置失败', -51);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-21 13:15:50 +08:00
|
|
|
|
|
|
|
|
|
// 启用直播
|
|
|
|
|
if(MyC('common_app_weixin_liveplayer', 0) == 1)
|
|
|
|
|
{
|
|
|
|
|
// app.json
|
|
|
|
|
$file = $new_dir.DS.'app.json';
|
2021-02-18 14:15:42 +08:00
|
|
|
|
$config = json_decode(file_get_contents($file), true);
|
|
|
|
|
if(is_array($config) && isset($config['plugins']))
|
2020-04-21 13:15:50 +08:00
|
|
|
|
{
|
2021-02-18 14:15:42 +08:00
|
|
|
|
$config['plugins']['live-player-plugin'] = [
|
2021-07-11 23:50:11 +08:00
|
|
|
|
'version' => MyC('common_app_weixin_liveplayer_ver', '1.3.0', true),
|
2020-04-21 13:15:50 +08:00
|
|
|
|
'provider' => 'wx2b03c6e691cd7370',
|
|
|
|
|
];
|
2021-02-18 14:15:42 +08:00
|
|
|
|
if(file_put_contents($file, JsonFormat($config)) === false)
|
2020-04-21 13:15:50 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('直播配置失败', -50);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 22:11:03 +08:00
|
|
|
|
return DataReturn('配置成功', 0);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-28 18:58:37 +08:00
|
|
|
|
/**
|
|
|
|
|
* 源码包删除
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2018-12-21
|
|
|
|
|
* @desc description
|
2019-08-04 22:11:03 +08:00
|
|
|
|
* @param [array] $params [输入参数]
|
2018-12-28 18:58:37 +08:00
|
|
|
|
*/
|
2019-01-17 00:37:20 +08:00
|
|
|
|
public static function Delete($params = [])
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
2020-06-22 23:21:23 +08:00
|
|
|
|
// 参数是否有误
|
|
|
|
|
if(empty($params['ids']))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
2020-06-22 23:21:23 +08:00
|
|
|
|
return DataReturn('操作id有误', -1);
|
|
|
|
|
}
|
|
|
|
|
// 是否数组
|
|
|
|
|
if(!is_array($params['ids']))
|
|
|
|
|
{
|
|
|
|
|
$params['ids'] = explode(',', $params['ids']);
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化
|
2021-08-10 20:47:44 +08:00
|
|
|
|
$ret = self::Init($params);
|
|
|
|
|
if($ret['code'] != 0)
|
|
|
|
|
{
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
2018-12-28 18:58:37 +08:00
|
|
|
|
|
2020-06-22 23:21:23 +08:00
|
|
|
|
// 循环操作
|
|
|
|
|
$sucs = 0;
|
|
|
|
|
$fail = 0;
|
|
|
|
|
foreach($params['ids'] as $id)
|
2019-01-04 18:16:20 +08:00
|
|
|
|
{
|
2020-06-22 23:21:23 +08:00
|
|
|
|
// 目录处理
|
|
|
|
|
$suffix = '';
|
|
|
|
|
if(substr($id, -4) === '.zip')
|
|
|
|
|
{
|
|
|
|
|
$name = substr($id, 0, strlen($id)-4);
|
|
|
|
|
$suffix = '.zip';
|
|
|
|
|
} else {
|
|
|
|
|
$name = $id;
|
|
|
|
|
}
|
2019-01-04 18:16:20 +08:00
|
|
|
|
|
2020-06-22 23:21:23 +08:00
|
|
|
|
// 防止路径回溯
|
|
|
|
|
$path_name = self::$new_path.DS.htmlentities(str_replace(array('.', '/', '\\', ':'), '', strip_tags($id)));
|
|
|
|
|
$path_zip = $path_name.'.zip';
|
2019-01-04 18:16:20 +08:00
|
|
|
|
|
2020-06-22 23:21:23 +08:00
|
|
|
|
// 删除包
|
|
|
|
|
$statusz = \base\FileUtil::UnlinkFile($path_zip);
|
|
|
|
|
$statusf = \base\FileUtil::UnlinkDir($path_name);
|
|
|
|
|
if($statusz || $statusf)
|
|
|
|
|
{
|
|
|
|
|
$sucs++;
|
|
|
|
|
} else {
|
|
|
|
|
$fail++;
|
|
|
|
|
}
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
2020-06-22 23:21:23 +08:00
|
|
|
|
|
|
|
|
|
// 成功
|
|
|
|
|
if($sucs == count($params['ids']))
|
2018-12-28 18:58:37 +08:00
|
|
|
|
{
|
|
|
|
|
return DataReturn('删除成功');
|
|
|
|
|
}
|
2020-06-22 23:21:23 +08:00
|
|
|
|
|
|
|
|
|
// 失败
|
|
|
|
|
if($fail == count($params['ids']))
|
|
|
|
|
{
|
|
|
|
|
return DataReturn('删除失败', -100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataReturn('成功['.$sucs.'],失败['.$fail.']');
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
2021-04-23 16:43:23 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 小程序主题更新信息
|
|
|
|
|
* @author Devil
|
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @date 2021-04-22
|
|
|
|
|
* @desc description
|
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
|
*/
|
|
|
|
|
public static function AppMiniUpgradeInfo($params = [])
|
|
|
|
|
{
|
|
|
|
|
if(!empty($params) && !empty($params['data']) && !empty($params['terminal']))
|
|
|
|
|
{
|
|
|
|
|
// 数据处理
|
|
|
|
|
$data = [];
|
|
|
|
|
foreach($params['data'] as $v)
|
|
|
|
|
{
|
|
|
|
|
if(!empty($v['name']) && !empty($v['ver']) && !empty($v['theme']) && !empty($v['author']))
|
|
|
|
|
{
|
|
|
|
|
$data[] = [
|
|
|
|
|
'plugins' => $v['theme'],
|
|
|
|
|
'name' => $v['name'],
|
|
|
|
|
'ver' => $v['ver'],
|
|
|
|
|
'author' => $v['author'],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!empty($data))
|
|
|
|
|
{
|
|
|
|
|
// 获取更新信息
|
|
|
|
|
$request_params = [
|
|
|
|
|
'plugins_type' => 'minitheme',
|
|
|
|
|
'plugins_data' => $data,
|
|
|
|
|
'plugins_terminal' => $params['terminal'],
|
|
|
|
|
];
|
|
|
|
|
$res = StoreService::PluginsUpgradeInfo($request_params);
|
|
|
|
|
if(!empty($res['data']))
|
|
|
|
|
{
|
|
|
|
|
$res['data'] = array_column($res['data'], null, 'plugins');
|
|
|
|
|
}
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataReturn('无插件数据', 0);
|
|
|
|
|
}
|
2018-12-28 18:58:37 +08:00
|
|
|
|
}
|
|
|
|
|
?>
|