From fd9e53cccd4653d332dd0d10140358a0e7830096 Mon Sep 17 00:00:00 2001 From: Devil Date: Thu, 18 Feb 2021 14:15:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E3=80=81=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8B=E8=BD=BD=E8=AE=B0=E5=BD=95=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/AppMiniService.php | 70 +++++++++++++++++---- application/service/PluginsAdminService.php | 21 +++++++ application/service/ThemeService.php | 21 +++++++ 3 files changed, 99 insertions(+), 13 deletions(-) diff --git a/application/service/AppMiniService.php b/application/service/AppMiniService.php index fb0b8ae53..807f5c174 100755 --- a/application/service/AppMiniService.php +++ b/application/service/AppMiniService.php @@ -349,6 +349,13 @@ class AppMiniService } } + // 历史信息更新 + $ret = self::HistoryUpdateHandle($new_dir); + if(isset($ret['code']) && $ret['code'] != 0) + { + return $ret; + } + // 生成压缩包 $zip = new \base\ZipFolder(); if(!$zip->zip($new_dir.'.zip', $new_dir)) @@ -514,6 +521,13 @@ class AppMiniService return $ret; } + // 历史信息更新 + $ret = self::HistoryUpdateHandle($new_dir); + if(isset($ret['code']) && $ret['code'] != 0) + { + return $ret; + } + // 生成压缩包 $zip = new \base\ZipFolder(); if(!$zip->zip($new_dir.'.zip', $new_dir)) @@ -527,6 +541,36 @@ class AppMiniService return DataReturn('生成成功', 0); } + /** + * 历史信息更新 + * @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); + 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); + } + } + /** * 扩展处理 - 微信 * @author Devil @@ -534,7 +578,7 @@ class AppMiniService * @version 1.0.0 * @date 2018-12-21 * @desc description - * @param [string] $new_dir [新得源码包目录] + * @param [string] $new_dir [新源码包目录] */ private static function ExtendHandleWeixin($new_dir) { @@ -543,14 +587,14 @@ class AppMiniService { // app.json $file = $new_dir.DS.'app.json'; - $data = json_decode(file_get_contents($file), true); - if(is_array($data) && isset($data['plugins'])) + $config = json_decode(file_get_contents($file), true); + if(is_array($config) && isset($config['plugins'])) { - $data['plugins']['goodsSharePlugin'] = [ + $config['plugins']['goodsSharePlugin'] = [ 'version' => MyC('common_app_is_good_thing_ver', '4.0.1', true), 'provider' => 'wx56c8f077de74b07c', ]; - if(file_put_contents($file, JsonFormat($data)) === false) + if(file_put_contents($file, JsonFormat($config)) === false) { return DataReturn('好物推荐主配置失败', -50); } @@ -558,11 +602,11 @@ class AppMiniService // goods-detail.json $file = $new_dir.DS.'pages'.DS.'goods-detail'.DS.'goods-detail.json'; - $data = json_decode(file_get_contents($file), true); - if(is_array($data) && isset($data['usingComponents'])) + $config = json_decode(file_get_contents($file), true); + if(is_array($config) && isset($config['usingComponents'])) { - $data['usingComponents']['share-button'] = 'plugin://goodsSharePlugin/share-button'; - if(file_put_contents($file, JsonFormat($data)) === false) + $config['usingComponents']['share-button'] = 'plugin://goodsSharePlugin/share-button'; + if(file_put_contents($file, JsonFormat($config)) === false) { return DataReturn('好物推荐商品配置失败', -51); } @@ -574,14 +618,14 @@ class AppMiniService { // app.json $file = $new_dir.DS.'app.json'; - $data = json_decode(file_get_contents($file), true); - if(is_array($data) && isset($data['plugins'])) + $config = json_decode(file_get_contents($file), true); + if(is_array($config) && isset($config['plugins'])) { - $data['plugins']['live-player-plugin'] = [ + $config['plugins']['live-player-plugin'] = [ 'version' => MyC('common_app_weixin_liveplayer_ver', '1.2.7', true), 'provider' => 'wx2b03c6e691cd7370', ]; - if(file_put_contents($file, JsonFormat($data)) === false) + if(file_put_contents($file, JsonFormat($config)) === false) { return DataReturn('直播配置失败', -50); } diff --git a/application/service/PluginsAdminService.php b/application/service/PluginsAdminService.php index 1130585b4..fb99328d8 100755 --- a/application/service/PluginsAdminService.php +++ b/application/service/PluginsAdminService.php @@ -1292,6 +1292,27 @@ php; } } + // 配置文件历史信息更新 + $new_config_file = $new_dir.DS.'_controller_'.DS.$plugins.DS.'config.json'; + if(!file_exists($new_config_file)) + { + return DataReturn('新配置文件有误', -10); + } + 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($new_config_file, JsonFormat($config)) === false) + { + return DataReturn('新应用配置文件更新失败', -11); + } + // 生成压缩包 $zip = new \base\ZipFolder(); if(!$zip->zip($new_dir.'.zip', $new_dir)) diff --git a/application/service/ThemeService.php b/application/service/ThemeService.php index aa2829c43..bb42e6534 100755 --- a/application/service/ThemeService.php +++ b/application/service/ThemeService.php @@ -332,6 +332,27 @@ class ThemeService } } + // 配置文件历史信息更新 + $new_config_file = $new_dir.DS.'_html_'.DS.'config.json'; + if(!file_exists($new_config_file)) + { + return DataReturn('新配置文件有误', -10); + } + 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($new_config_file, JsonFormat($config)) === false) + { + return DataReturn('新应用配置文件更新失败', -11); + } + // 生成压缩包 $zip = new \base\ZipFolder(); if(!$zip->zip($new_dir.'.zip', $new_dir))