diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php
index c93717aed730b3dcae5bab82aa949770af94eaa1..41be299bb2b9579a056ad8f533dc14979f13dc47 100755
--- a/application/admin/controller/Index.php
+++ b/application/admin/controller/Index.php
@@ -12,6 +12,7 @@ namespace app\admin\controller;
use app\service\StatisticalService;
use app\service\StoreService;
+use app\service\SystemUpgradeService;
/**
* 首页
@@ -157,5 +158,26 @@ class Index extends Common
$params = $this->data_request;
return StoreService::SiteInspectUpgrade($params);
}
+
+ /**
+ * 检查更新确认
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-16
+ * @desc description
+ */
+ public function InspectUpgradeConfirm()
+ {
+ // 是否ajax请求
+ if(!IS_AJAX)
+ {
+ return $this->error('非法访问');
+ }
+
+ // 开始处理
+ $params = $this->data_request;
+ return SystemUpgradeService::Run($params);
+ }
}
?>
\ No newline at end of file
diff --git a/application/admin/view/default/index/init.html b/application/admin/view/default/index/init.html
index cf6bacb34496da26d1df1fcd5d531af9a8f4bc5e..066d5024e1b8e0ba5840468cb8fd6df96ddbdfe3 100755
--- a/application/admin/view/default/index/init.html
+++ b/application/admin/view/default/index/init.html
@@ -254,7 +254,7 @@
diff --git a/application/lang/zh-cn.php b/application/lang/zh-cn.php
index 41d6869f7cc2d151b27628b4245c03253b4f16e7..874bfa435ca826a45008c6544c6f9cdea9bd6d7d 100755
--- a/application/lang/zh-cn.php
+++ b/application/lang/zh-cn.php
@@ -152,7 +152,6 @@ return [
'ios' => ['value' => 'ios', 'name' => '苹果APP'],
'android' => ['value' => 'android', 'name' => '安卓APP'],
],
-
// 小程序平台
'common_appmini_type' => [
diff --git a/application/service/PluginsAdminService.php b/application/service/PluginsAdminService.php
index 5e5e1c70b6f1939dad5d01c832ce3fc235223633..5b4559be776e3c66562b849217721e745c456f8f 100755
--- a/application/service/PluginsAdminService.php
+++ b/application/service/PluginsAdminService.php
@@ -1048,6 +1048,43 @@ php;
return $ret;
}
+ // 包处理
+ $ret = self::PluginsPackageHandle($package_file, 0);
+ if($ret['code'] != 0)
+ {
+ return $ret;
+ }
+ $plugins = $ret['data'];
+
+ // 附件同步到数据库
+ ResourcesService::AttachmentDiskFilesToDb('plugins_'.$plugins);
+
+ // sql运行
+ $install_sql = APP_PATH.'plugins'.DS.$plugins.DS.'install.sql';
+ if(!empty($plugins) && file_exists($install_sql))
+ {
+ SqlconsoleService::Implement(['sql'=>file_get_contents($install_sql)]);
+ }
+
+ // 插件事件回调
+ PluginsService::PluginsEventCall($plugins, 'Upload', $params);
+
+ return DataReturn('安装成功');
+ }
+
+ /**
+ * 插件包处理
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-24
+ * @desc description
+ * @param [string] $package_file [包地址]
+ * @param [int] $type [类型(0上传, 1更新)]
+ * @param [string] $plugins_old [原插件标识名称]
+ */
+ public static function PluginsPackageHandle($package_file, $type = 0, $plugins_old = '')
+ {
// 资源目录
$dir_list = self::PluginsDirStructureMapping();
@@ -1087,19 +1124,36 @@ php;
return DataReturn('插件包有误', -30);
}
- // 应用不存在则添加
- $ret = self::PluginsVerification($plugins);
- if($ret['code'] != 0)
+ // 业务类型处理
+ switch($type)
{
- zip_entry_close($temp_resource);
- return $ret;
- }
+ // 上传安装
+ case 0 :
+ // 应用不存在则添加
+ $ret = self::PluginsVerification($plugins);
+ if($ret['code'] != 0)
+ {
+ zip_entry_close($temp_resource);
+ return $ret;
+ }
- // 应用是否存在
- if(self::PluginsExist($plugins))
- {
- zip_entry_close($temp_resource);
- return DataReturn('应用名称已存在['.$plugins.']', -1);
+ // 应用是否存在
+ if(self::PluginsExist($plugins))
+ {
+ zip_entry_close($temp_resource);
+ return DataReturn('应用名称已存在['.$plugins.']', -1);
+ }
+ break;
+
+ // 更新
+ case 1 :
+ // 应用是否存在
+ if($plugins != $plugins_old)
+ {
+ zip_entry_close($temp_resource);
+ return DataReturn('应用标识与指定不一致['.$plugins.'<>'.$plugins_old.']', -1);
+ }
+ break;
}
}
@@ -1161,20 +1215,7 @@ php;
}
}
- // 附件同步到数据库
- ResourcesService::AttachmentDiskFilesToDb('plugins_'.$plugins);
-
- // sql运行
- $install_sql = APP_PATH.'plugins'.DS.$plugins.DS.'install.sql';
- if(!empty($plugins) && file_exists($install_sql))
- {
- SqlconsoleService::Implement(['sql'=>file_get_contents($install_sql)]);
- }
-
- // 插件事件回调
- PluginsService::PluginsEventCall($plugins, 'Upload', $params);
-
- return DataReturn('安装成功');
+ return DataReturn('success', 0, $plugins);
}
/**
@@ -1401,114 +1442,16 @@ php;
// 应用是否存在
if(!self::PluginsExist($params['plugins_value']))
{
- return DataReturn('应用不已存在['.$params['plugins_value'].']、请先安装', -1);
- }
-
- // 资源目录
- $dir_list = self::PluginsDirStructureMapping();
-
- // 包名
- $plugins = '';
-
- // 开始解压文件
- $resource = zip_open($package_file);
- if(!is_resource($resource))
- {
- return DataReturn('压缩包打开失败['.$resource.']', -10);
+ return DataReturn('应用不存在['.$params['plugins_value'].']、请先安装', -1);
}
- // 处理文件
- while(($temp_resource = zip_read($resource)) !== false)
+ // 包处理
+ $ret = self::PluginsPackageHandle($package_file, 1, $params['plugins_value']);
+ if($ret['code'] != 0)
{
- if(zip_entry_open($resource, $temp_resource))
- {
- // 当前压缩包中项目名称
- $file = zip_entry_name($temp_resource);
-
- // 获取包名
- if(empty($plugins))
- {
- // 应用名称
- $plugins = substr($file, 0, strpos($file, '/'));
- if(empty($plugins))
- {
- // 应用名称为空、则校验是否为支付插件
- $file_size = zip_entry_filesize($temp_resource);
- $file_content = zip_entry_read($temp_resource, $file_size);
- if(stripos($file_content, 'namespace payment') !== false)
- {
- return DataReturn('支付插件请到[ 网站管理->支付方式 ]模块里面去上传安装', -1);
- }
-
- // 不是支付插件则提示插件包错误
- return DataReturn('插件包有误', -30);
- }
-
- // 应用是否存在
- if($plugins != $params['plugins_value'])
- {
- zip_entry_close($temp_resource);
- return DataReturn('应用标识与指定不一致['.$plugins.'<>'.$params['plugins_value'].']', -1);
- }
- }
-
- // 排除临时文件和临时目录
- if(strpos($file, '/.') === false && strpos($file, '__') === false)
- {
- // 文件包对应系统所在目录
- $is_has_find = false;
- foreach($dir_list as $dir_key=>$dir_value)
- {
- if(strpos($file, $dir_key) !== false)
- {
- // 仅控制器模块支持php文件
- if($dir_key != '_controller_')
- {
- // 排除后缀文件
- $pos = strripos($file, '.');
- if($pos !== false)
- {
- $info = pathinfo($file);
- if(isset($info['extension']) && in_array($info['extension'], self::$exclude_ext))
- {
- continue;
- }
- }
- }
-
- // 匹配成功文件路径处理、跳出循环
- $file = str_replace($plugins.'/'.$dir_key.'/', '', $dir_value.$file);
- $is_has_find = true;
- break;
- }
- }
-
- // 没有匹配到则指定目录跳过
- if($is_has_find == false)
- {
- continue;
- }
-
- // 截取文件路径
- $file_path = substr($file, 0, strrpos($file, '/'));
-
- // 路径不存在则创建
- \base\FileUtil::CreateDir($file_path);
-
- // 如果不是目录则写入文件
- if(!is_dir($file))
- {
- // 读取这个文件
- $file_size = zip_entry_filesize($temp_resource);
- $file_content = zip_entry_read($temp_resource, $file_size);
- @file_put_contents($file, $file_content);
- }
-
- // 关闭目录项
- zip_entry_close($temp_resource);
- }
- }
+ return $ret;
}
+ $plugins = $ret['data'];
// 更新sql
$sql_file = APP_PATH.'plugins'.DS.$plugins.DS.'update.sql';
diff --git a/application/service/PluginsService.php b/application/service/PluginsService.php
index 0c83b177da31214db640ad1ddf1b603a64bdfe47..6f63bd8ca0bc4cb0f7cc270f36af713d861c628d 100755
--- a/application/service/PluginsService.php
+++ b/application/service/PluginsService.php
@@ -320,8 +320,8 @@ class PluginsService
if(config('shopxo.is_develop') === false)
{
$key = 'plugins_legal_check_'.$plugins;
- $status = cache($key);
- if(empty($status))
+ $ret = cache($key);
+ if(empty($ret))
{
$config = PluginsAdminService::GetPluginsConfig($plugins);
if(empty($config) || empty($config['base']))
@@ -337,11 +337,11 @@ class PluginsService
'ver' => $config['base']['version'],
];
$ret = StoreService::PluginsLegalCheck($check_params);
- if($ret['code'] != 0)
- {
- return $ret;
- }
- cache($key, 1, 600);
+ cache($key, $ret, 600);
+ }
+ if($ret['code'] != 0)
+ {
+ return $ret;
}
}
diff --git a/application/service/SystemUpgradeService.php b/application/service/SystemUpgradeService.php
new file mode 100644
index 0000000000000000000000000000000000000000..21fbcb5284157bccab105df8d5a7963ca71f4755
--- /dev/null
+++ b/application/service/SystemUpgradeService.php
@@ -0,0 +1,372 @@
+$file_content]);
+ }
+
+ // 关闭目录项
+ zip_entry_close($temp_resource);
+ }
+ }
+ }
+
+ return DataReturn('success', 0);
+ }
+
+ /**
+ * 系统包处理
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-24
+ * @desc description
+ * @param [string] $package_file [包地址]
+ */
+ public static function SystemPackageHandle($package_file)
+ {
+ // 开始解压文件
+ $resource = zip_open($package_file);
+ if(!is_resource($resource))
+ {
+ return DataReturn('压缩包打开失败['.$resource.']', -10);
+ }
+
+ while(($temp_resource = zip_read($resource)) !== false)
+ {
+ if(zip_entry_open($resource, $temp_resource))
+ {
+ // 当前压缩包中项目名称
+ $file = zip_entry_name($temp_resource);
+
+ // 排除临时文件和临时目录
+ if(!empty($file) && strpos($file, '/.') === false)
+ {
+ // 文件实际位置
+ $file_new = ROOT.$file;
+
+ // 截取文件路径
+ $file_path = substr($file_new, 0, strrpos($file_new, '/'));
+
+ // 路径不存在则创建、根目录文件不创建目录
+ if(strpos($file, '/') !== false)
+ {
+ \base\FileUtil::CreateDir($file_path);
+ }
+
+ // 如果不是目录则写入文件
+ if(!is_dir($file_new))
+ {
+ // 读取这个文件
+ $file_size = zip_entry_filesize($temp_resource);
+ $file_content = zip_entry_read($temp_resource, $file_size);
+ @file_put_contents($file_new, $file_content);
+ }
+
+ // 关闭目录项
+ zip_entry_close($temp_resource);
+ }
+ }
+ }
+
+ return DataReturn('success', 0);
+ }
+
+ /**
+ * 下载软件包
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-22
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function DownloadHandle($params = [])
+ {
+ // 获取下载地址
+ $data = session(self::$package_url_key);
+ if(empty($data) || !is_array($data) || empty($data[$params['opt']]))
+ {
+ return DataReturn('下载地址为空', -1);
+ }
+ $url = $data[$params['opt']];
+
+ // 获取目录文件
+ $key = md5($url);
+ $res = self::DirFileData($key);
+
+ // 目录不存在则创建
+ \base\FileUtil::CreateDir($res['dir'].$res['path']);
+
+ // 下载保存
+ if(@file_put_contents($res['url'], RequestGet($url, 300000)) !== false)
+ {
+ // 存储已下载文件地址session
+ session(self::SaveDirPathUrl($params['opt']), $res['url']);
+ return DataReturn('success', 0);
+ }
+ return DataReturn('包下载失败', -1);
+ }
+
+ /**
+ * 获取存储路径session key
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-23
+ * @desc description
+ * @param [string] $opt [操作类型]
+ */
+ public static function SaveDirPathUrl($opt)
+ {
+ $dir_arr = [
+ 'download_system' => self::$package_system_dir_key,
+ 'download_upgrade' => self::$package_upgrade_dir_key,
+ ];
+ return isset($dir_arr[$opt]) ? $dir_arr[$opt] : '';
+ }
+
+ /**
+ * 获取下载地址
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-22
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function UrlHandle($params = [])
+ {
+ // 帐号信息
+ $accounts = MyC('common_store_accounts');
+ $password = MyC('common_store_password');
+
+ // 获取信息
+ $ret = StoreService::RemoteStoreData($accounts, $password, self::$store_plugins_upgrade_url, $params);
+ if(!empty($ret) && isset($ret['code']) && $ret['code'] == 0)
+ {
+ session(self::$package_url_key, $ret['data']);
+ return DataReturn('获取成功', 0);
+ }
+ return $ret;
+ }
+
+ /**
+ * 获取软件存储信息
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-04-22
+ * @desc description
+ * @param [string] $key [缓存key]
+ */
+ public static function DirFileData($key)
+ {
+ // 将软件包下载到磁盘
+ $dir = ROOT;
+ $path = 'runtime'.DS.'data'.DS.'system_upgrade'.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-04-22
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function ParamsCheck($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'in',
+ 'key_name' => 'opt',
+ 'checked_data' => ['url', 'download_system', 'download_upgrade', 'upgrade'],
+ 'error_msg' => '操作类型有误',
+ ],
+ ];
+ $ret = ParamsChecked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ self::$params = $params;
+ return DataReturn('success', 0);
+ }
+}
+?>
\ No newline at end of file
diff --git a/application/tags.php b/application/tags.php
index 1579739dc58894039dec6cf07c14977fc6b202c5..ef46e24ccf97b8a711385005855d10ab230e1091 100755
--- a/application/tags.php
+++ b/application/tags.php
@@ -35,19 +35,22 @@ return array (
'plugins_css' =>
array (
0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\multilingual\\Hook',
- 2 => 'app\\plugins\\store\\Hook',
+ 1 => 'app\\plugins\\shop\\Hook',
+ 2 => 'app\\plugins\\multilingual\\Hook',
+ 3 => 'app\\plugins\\store\\Hook',
),
'plugins_js' =>
array (
0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\multilingual\\Hook',
- 2 => 'app\\plugins\\store\\Hook',
+ 1 => 'app\\plugins\\shop\\Hook',
+ 2 => 'app\\plugins\\multilingual\\Hook',
+ 3 => 'app\\plugins\\store\\Hook',
),
'plugins_service_navigation_header_handle' =>
array (
0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\store\\Hook',
+ 1 => 'app\\plugins\\shop\\Hook',
+ 2 => 'app\\plugins\\store\\Hook',
),
'plugins_service_quick_navigation_pc' =>
array (
@@ -82,6 +85,7 @@ return array (
'plugins_service_goods_handle_end' =>
array (
0 => 'app\\plugins\\points\\Hook',
+ 1 => 'app\\plugins\\shop\\Hook',
),
'plugins_view_buy_form_inside' =>
array (
@@ -101,117 +105,150 @@ return array (
'plugins_service_buy_order_insert_end' =>
array (
0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\store\\Hook',
+ 1 => 'app\\plugins\\shop\\Hook',
+ 2 => 'app\\plugins\\store\\Hook',
),
'plugins_service_order_status_change_history_success_handle' =>
array (
0 => 'app\\plugins\\points\\Hook',
- 1 => 'app\\plugins\\store\\Hook',
+ 1 => 'app\\plugins\\shop\\Hook',
+ 2 => 'app\\plugins\\store\\Hook',
),
'plugins_service_base_data_return_api_buy_index' =>
array (
0 => 'app\\plugins\\points\\Hook',
),
- 'plugins_common_page_bottom' =>
+ 'plugins_admin_css' =>
array (
- 0 => 'app\\plugins\\multilingual\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\orderpricerevision\\Hook',
+ 2 => 'app\\plugins\\store\\Hook',
+ ),
+ 'plugins_service_users_center_left_menu_handle' =>
+ array (
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
),
'plugins_service_header_navigation_top_right_handle' =>
array (
- 0 => 'app\\plugins\\multilingual\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\multilingual\\Hook',
+ 2 => 'app\\plugins\\store\\Hook',
+ ),
+ 'plugins_service_goods_save_handle' =>
+ array (
+ 0 => 'app\\plugins\\shop\\Hook',
+ ),
+ 'plugins_service_editor_path_type_admin_goods_saveinfo' =>
+ array (
+ 0 => 'app\\plugins\\shop\\Hook',
1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_view_common_top' =>
+ 'plugins_view_goods_detail_right_content_bottom' =>
array (
- 0 => 'app\\plugins\\multilingual\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_view_common_bottom' =>
+ 'plugins_view_goods_detail_base_bottom' =>
array (
- 0 => 'app\\plugins\\multilingual\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_search_goods_list_where' =>
+ 'plugins_view_goods_detail_base_buy_nav_min_inside_begin' =>
array (
- 0 => 'app\\plugins\\multilingual\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_admin_css' =>
+ 'plugins_service_warehouse_handle_end' =>
array (
- 0 => 'app\\plugins\\orderpricerevision\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_admin_js' =>
+ 'plugins_service_buy_handle' =>
array (
- 0 => 'app\\plugins\\orderpricerevision\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
),
- 'plugins_admin_view_common_bottom' =>
+ 'plugins_service_buy_order_insert_begin' =>
array (
- 0 => 'app\\plugins\\orderpricerevision\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_view_admin_order_list_operate' =>
+ 'plugins_service_order_aftersale_audit_handle_end' =>
array (
- 0 => 'app\\plugins\\orderpricerevision\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_users_center_left_menu_handle' =>
+ 'plugins_view_admin_goods_save' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
),
- 'plugins_service_warehouse_goods_inventory_deduct' =>
+ 'plugins_module_form_admin_goods_index' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
),
- 'plugins_service_warehouse_goods_inventory_rollback' =>
+ 'plugins_module_form_admin_goods_detail' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
),
- 'plugins_service_warehouse_goods_inventory_sync' =>
+ 'plugins_service_goods_buy_nav_button_handle' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\shop\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_goods_field_status_update' =>
+ 'plugins_common_page_bottom' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\multilingual\\Hook',
),
- 'plugins_service_goods_delete' =>
+ 'plugins_view_common_top' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\multilingual\\Hook',
),
- 'plugins_service_goods_save_end' =>
+ 'plugins_view_common_bottom' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\multilingual\\Hook',
),
- 'plugins_service_editor_path_type_admin_goods_saveinfo' =>
+ 'plugins_service_search_goods_list_where' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\multilingual\\Hook',
),
- 'plugins_view_goods_detail_right_content_bottom' =>
+ 'plugins_admin_js' =>
array (
- 0 => 'app\\plugins\\store\\Hook',
+ 0 => 'app\\plugins\\orderpricerevision\\Hook',
),
- 'plugins_view_goods_detail_base_bottom' =>
+ 'plugins_admin_view_common_bottom' =>
+ array (
+ 0 => 'app\\plugins\\orderpricerevision\\Hook',
+ ),
+ 'plugins_view_admin_order_list_operate' =>
+ array (
+ 0 => 'app\\plugins\\orderpricerevision\\Hook',
+ 1 => 'app\\plugins\\store\\Hook',
+ ),
+ 'plugins_service_warehouse_goods_inventory_deduct' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
- 'plugins_view_goods_detail_base_buy_nav_min_inside_begin' =>
+ 'plugins_service_warehouse_goods_inventory_rollback' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_warehouse_handle_end' =>
+ 'plugins_service_warehouse_goods_inventory_sync' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_buy_order_insert_begin' =>
+ 'plugins_service_goods_field_status_update' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_system_begin' =>
+ 'plugins_service_goods_delete' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_order_aftersale_audit_handle_end' =>
+ 'plugins_service_goods_save_end' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
- 'plugins_service_goods_buy_nav_button_handle' =>
+ 'plugins_service_system_begin' =>
array (
0 => 'app\\plugins\\store\\Hook',
),
diff --git a/public/static/admin/default/js/index.js b/public/static/admin/default/js/index.js
index 0e10f3ba1b8bd43072b2bf43f5bd345f16ef72f6..881658a8c9b31a51978847618ce0d494233b2d1a 100755
--- a/public/static/admin/default/js/index.js
+++ b/public/static/admin/default/js/index.js
@@ -1,3 +1,85 @@
+/**
+ * 系统更新异步请求步骤
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2021-02-22
+ * @desc description
+ * @param {[string]} url [url地址]
+ * @param {[string]} opt [操作类型(url 获取下载地址, download_system 下载系统包, download_upgrade 下载升级包, upgrade 更新操作)]
+ * @param {[string]} msg [提示信息]
+ */
+function SystemUpgradeRequestHandle(params)
+{
+ // 参数处理
+ if((params || null) == null)
+ {
+ Prompt('操作参数有误');
+ return false;
+ }
+ var url = params.url || null;
+ var opt = params.opt || 'url';
+ var msg = params.msg || '正在获取中...';
+
+ // 加载提示
+ AMUI.dialog.loading({title: msg});
+
+ // ajax
+ $.ajax({
+ url: url,
+ type: 'POST',
+ dataType: 'json',
+ timeout: 305000,
+ data: {"opt":opt},
+ success: function(result)
+ {
+ if((result || null) != null && result.code == 0)
+ {
+ switch(opt)
+ {
+ // 获取下载地址
+ case 'url' :
+ params['opt'] = 'download_system';
+ params['msg'] = '系统包正在下载中...';
+ SystemUpgradeRequestHandle(params);
+ break;
+
+ // 下载系统包
+ case 'download_system' :
+ params['opt'] = 'download_upgrade';
+ params['msg'] = '升级包正在下载中...';
+ SystemUpgradeRequestHandle(params);
+ break;
+
+ // 下载升级包
+ case 'download_upgrade' :
+ params['opt'] = 'upgrade';
+ params['msg'] = '正在更新中...';
+ SystemUpgradeRequestHandle(params);
+ break;
+
+ // 更新完成
+ case 'upgrade' :
+ Prompt(result.msg, 'success');
+ setTimeout(function()
+ {
+ window.location.reload();
+ }, 1500);
+ break;
+ }
+ } else {
+ AMUI.dialog.loading('close');
+ Prompt(((result || null) == null) ? '返回数据格式错误' : (result.msg || '异常错误'));
+ }
+ },
+ error: function(xhr, type)
+ {
+ AMUI.dialog.loading('close');
+ Prompt(HtmlToString(xhr.responseText) || '异常错误');
+ }
+ });
+}
+
$(function()
{
/**
@@ -179,10 +261,10 @@ $(function()
});
// 检查更新
+ var $inspect_upgrade_popup = $('#inspect-upgrade-popup');
$('.inspect-upgrade-submit').on('click', function()
{
// 基础信息
- var $inspect_upgrade_popup = $('#inspect-upgrade-popup');
AMUI.dialog.loading({title: '正在获取最新内容、请稍候...'});
// ajax请求
@@ -260,7 +342,7 @@ $(function()
// 系统更新确认
$('.inspect-upgrade-confirm').on('click', function()
{
- Prompt('开发中...');
+ $inspect_upgrade_popup.modal('close');
+ SystemUpgradeRequestHandle({"url": $(this).data('url')});
});
-
});
\ No newline at end of file