diff --git a/niucloud/addon/hello_world/info.json b/niucloud/addon/hello_world/info.json index 666ef504e..7bd3c5b8b 100644 --- a/niucloud/addon/hello_world/info.json +++ b/niucloud/addon/hello_world/info.json @@ -5,5 +5,5 @@ "version": "1.0.1", "author": "niucloud", "type": "addon", - "support_app": "niucloud" -} \ No newline at end of file + "support_app": "" +} diff --git a/niucloud/app/adminapi/controller/addon/Addon.php b/niucloud/app/adminapi/controller/addon/Addon.php index 0b6cd2905..b40eeb57e 100644 --- a/niucloud/app/adminapi/controller/addon/Addon.php +++ b/niucloud/app/adminapi/controller/addon/Addon.php @@ -15,6 +15,7 @@ use app\dict\addon\AddonDict; use app\service\admin\addon\AddonService; use app\service\core\addon\CoreAddonService; use core\base\BaseAdminController; +use think\facade\Cache; use think\Response; @@ -34,17 +35,34 @@ class Addon extends BaseAdminController */ public function install($addon) { - return (new AddonService())->install($addon); + return success((new AddonService())->install($addon)); } /** - * 执行安装 + * 云安装插件 * @param $addon * @return Response */ - public function execute($addon) + public function cloudInstall($addon) { - return (new AddonService())->executeInstall($addon); + return success(data:(new AddonService())->cloudInstall($addon)); + } + + /** + * 获取安装任务 + * @return Response + */ + public function getInstallTask() { + return success(data:(new AddonService())->getInstallTask()); + } + + /** + * 获取云安装日志 + * @param $addon + * @return mixed + */ + public function cloudInstallLog($addon) { + return success(data:(new AddonService())->cloudInstallLog($addon)); } /** @@ -57,17 +75,6 @@ class Addon extends BaseAdminController return (new AddonService())->installCheck($addon); } - /** - * 查询插件安装状态 - * @param $addon - * @param $key - * @return Response - */ - public function getInstallState($addon, $key) - { - return success((new AddonService())->getInstallState($addon, $key)); - } - /** * 卸载插件 * @param string $addon @@ -118,7 +125,10 @@ class Addon extends BaseAdminController * @return Response */ public function download($addon){ - (new AddonService())->download($addon); + $data = $this->request->params([ + ['version', ''] + ]); + (new AddonService())->download($addon, $data['version']); return success('DOWNLOAD_SUCCESS'); } diff --git a/niucloud/app/adminapi/controller/dict/Dict.php b/niucloud/app/adminapi/controller/dict/Dict.php new file mode 100644 index 000000000..801300a53 --- /dev/null +++ b/niucloud/app/adminapi/controller/dict/Dict.php @@ -0,0 +1,121 @@ +request->params([ + ["name",""], + ["key",""] + ]); + return success((new DictService())->getPage($data)); + } + + /** + * 数据字典详情 + * @param int $id + * @return \think\Response + */ + public function info(int $id){ + return success((new DictService())->getInfo($id)); + } + + /** + * 添加数据字典 + * @return \think\Response + */ + public function add(){ + $data = $this->request->params([ + ["name",""], + ["key",""], + ["memo",""], + + ]); +// $this->validate($data, 'app\validate\dict\Dict.add'); + $id = (new DictService())->add($data); + return success('ADD_SUCCESS', ['id' => $id]); + } + + /** + * 数据字典编辑 + * @param $id 数据字典id + * @return \think\Response + */ + public function edit($id){ + $data = $this->request->params([ + ["name",""], + ["key",""], + ["data",""], + ["memo",""], + + ]); +// $this->validate($data, 'app\validate\dict\Dict.edit'); + (new DictService())->edit($id, $data); + return success('EDIT_SUCCESS'); + } + + /** + * 数据字典删除 + * @param $id 数据字典id + * @return \think\Response + */ + public function del(int $id){ + (new DictService())->del($id); + return success('DELETE_SUCCESS'); + } + + /** + * 添加数据字典内容 + */ + public function addDictData($id) + { + $data = $this->request->params([ + ["dictionary",'[]'], + ]); +// $this->validate($data, 'app\validate\dict\Dict.add'); + $data['dictionary'] = json_encode($data['dictionary'], true); + (new DictService())->edit($id,$data); + return success('ADD_SUCCESS'); + } + + /** + * 获取全部数据字典 + * @return \think\Response + */ + public function getAll(){ + return success((new DictService())->getAll()); + } + + /** + * 数据字典详情 + * @param key 数据字典关键字 + * @return \think\Response + */ + public function getKeyInfo(string $type){ + $res = (new DictService())->getKeyInfo($type); + return success($res); + } +} diff --git a/niucloud/app/adminapi/controller/generator/Generator.php b/niucloud/app/adminapi/controller/generator/Generator.php index d0dec460a..861a6f846 100644 --- a/niucloud/app/adminapi/controller/generator/Generator.php +++ b/niucloud/app/adminapi/controller/generator/Generator.php @@ -36,6 +36,7 @@ class Generator extends BaseController $data = $this->request->params([ ['table_name', ''], ['table_content', ''], + ['addon_name',''] ]); return success((new GenerateService())->getPage($data)); } @@ -61,6 +62,7 @@ class Generator extends BaseController public function preview(int $id) { $data = (new GenerateService())->preview(['id' => $id]); +// dd($data); return success('ADD_SUCCESS', $data); } @@ -101,6 +103,7 @@ class Generator extends BaseController ['parent_menu',''], ['relations',[]] ], false); + $this->validate($data, 'app\validate\generator\Generator.edit'); (new GenerateService())->edit($id, $data); return success('MODIFY_SUCCESS'); @@ -125,7 +128,7 @@ class Generator extends BaseController { $data = $this->request->params([ ['id', ''], - ['generate_type', '3'] + ['generate_type', '2'] ]); $data = (new GenerateService())->generate($data); diff --git a/niucloud/app/adminapi/controller/sys/Menu.php b/niucloud/app/adminapi/controller/sys/Menu.php index 7bfd944c6..57d2ffd8c 100644 --- a/niucloud/app/adminapi/controller/sys/Menu.php +++ b/niucloud/app/adminapi/controller/sys/Menu.php @@ -56,13 +56,10 @@ class Menu extends BaseAdminController ['api_url', ''], ['view_path', ''], ['router_path', ''], - ['methods', ''], ['sort', 0], - ['status', MenuDict::ON], ['is_show', 0], - ['addon', ''], ]); $this->validate($data, 'app\validate\sys\Menu.add'); @@ -94,6 +91,7 @@ class Menu extends BaseAdminController ['addon', ''], ]); $this->validate($data, 'app\validate\sys\Menu.edit'); + (new MenuService())->edit($menu_key, $data); return success('EDIT_SUCCESS'); } diff --git a/niucloud/app/adminapi/route/addon.php b/niucloud/app/adminapi/route/addon.php index 5752f771f..632cac092 100644 --- a/niucloud/app/adminapi/route/addon.php +++ b/niucloud/app/adminapi/route/addon.php @@ -30,12 +30,14 @@ Route::group(function () { Route::put('addon/status/:id/:status', 'addon.Addon/setStatus'); //安装插件 Route::post('addon/install/:addon', 'addon.Addon/install'); + //云安装插件 + Route::post('addon/cloudinstall/:addon', 'addon.Addon/cloudInstall'); + // 云编译进度 + Route::get('addon/cloudinstall/:addon', 'addon.Addon/cloudInstallLog'); //插件安装检测安装环境 Route::get('addon/install/check/:addon', 'addon.Addon/installCheck'); - // 执行安装 - Route::post('addon/install/execute/:addon', 'addon.Addon/execute'); - //插件安装状态 - Route::get('addon/install/:addon/status/:key', 'addon.Addon/getInstallState'); + // 获取安装任务 + Route::get('addon/installtask', 'addon.Addon/getInstallTask'); //下载插件 Route::post('addon/download/:addon', 'addon.Addon/download'); //插件类型 @@ -58,8 +60,6 @@ Route::group(function () { //编辑插件 Route::put('addon_develop/:key', 'addon.AddonDevelop/edit'); //删除插件 - Route::delete('addon_develop/:key', 'addon.AddonDevelop/del'); - Route::delete('addon_develop/:key', 'addon.AddonDevelop/del'); //校验是否存在 Route::get('addon_develop/check/:key', 'addon.AddonDevelop/checkKey'); diff --git a/niucloud/app/adminapi/route/dict.php b/niucloud/app/adminapi/route/dict.php new file mode 100644 index 000000000..40ce6401a --- /dev/null +++ b/niucloud/app/adminapi/route/dict.php @@ -0,0 +1,43 @@ +middleware([ + AdminCheckToken::class, + AdminCheckRole::class, + AdminLog::class +]); +// USER_CODE_END -- sys_dict diff --git a/niucloud/app/common.php b/niucloud/app/common.php index 6ae05b1b0..53989e371 100644 --- a/niucloud/app/common.php +++ b/niucloud/app/common.php @@ -50,9 +50,9 @@ function fail($msg = 'FAIL', ?array $data = [], int $code = 0, int $http_code = * @param string $str * @return lang() */ -function get_lang($str) +function get_lang($str,$vars = []) { - return Lang::get($str); + return Lang::get($str,$vars); } @@ -174,8 +174,9 @@ function del_target_dir($path, $delDir) } closedir($handle); if ($delDir) { - return rmdir($path); + @rmdir($path); } + return true; } else { if (file_exists($path)) { return unlink($path); diff --git a/niucloud/app/dict/diy/LinkDict.php b/niucloud/app/dict/diy/LinkDict.php index 68feeab70..72a04ac4f 100644 --- a/niucloud/app/dict/diy/LinkDict.php +++ b/niucloud/app/dict/diy/LinkDict.php @@ -25,7 +25,7 @@ class LinkDict $system_links = [ 'SYSTEM_LINK' => [ 'key' => '', - 'addon_title' => '', + 'addon_title' => get_lang('dict_diy.system_title'), 'title' => get_lang('dict_diy.system_link'), 'child_list' => [ [ @@ -39,7 +39,7 @@ class LinkDict ], 'MEMBER_LINK' => [ 'key' => '', - 'addon_title' => '', + 'addon_title' => get_lang('dict_diy.system_title'), 'title' => get_lang('dict_diy.member_link'), 'child_list' => [ [ diff --git a/niucloud/app/dict/diy/PagesDict.php b/niucloud/app/dict/diy/PagesDict.php index bb6d9d0c2..44b57c3de 100644 --- a/niucloud/app/dict/diy/PagesDict.php +++ b/niucloud/app/dict/diy/PagesDict.php @@ -82,14 +82,7 @@ class PagesDict "componentName" => "AddonList", "componentTitle" => "应用", "ignore" => [], - "list" => [ - [ - "key" => "", - "title" => "", - "url" => "", - "icon" => "", - ] - ], + "list" => [], "textColor" => "#303133", "pageBgColor" => "", "componentBgColor" => "", diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index cd99c5e09..cdd1db70e 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -2,17 +2,18 @@ return [ [ - 'menu_name' => '首页', + 'menu_name' => '应用中心', 'menu_key' => 'overview', 'menu_type' => 0, 'icon' => 'iconfont-icona-shouyediannao', 'api_url' => '', - 'router_path' => 'index', + 'router_path' => 'apply', 'view_path' => '', 'methods' => '', - 'sort' => 100, + 'sort' => 60, 'status' => 1, 'is_show' => 1, + 'menu_attr' => 'system', 'children' => [ [ 'menu_name' => '应用管理', @@ -29,7 +30,7 @@ return ], [ 'menu_name' => '我的星标', - 'menu_key' => 'app_index', + 'menu_key' => 'app_star', 'menu_type' => 1, 'icon' => 'iconfont-iconwodexingbiao', 'api_url' => '', @@ -38,11 +39,11 @@ return 'methods' => '', 'sort' => 100, 'status' => 1, - 'is_show' => 1, + 'is_show' => 0, ], [ 'menu_name' => '历史查看', - 'menu_key' => 'app_index', + 'menu_key' => 'app_record', 'menu_type' => 1, 'icon' => 'iconfont-iconchakanlishi', 'api_url' => '', @@ -51,13 +52,13 @@ return 'methods' => '', 'sort' => 100, 'status' => 1, - 'is_show' => 1, + 'is_show' => 0, ] ] ], [ - 'menu_name' => '网站', + 'menu_name' => '网站装修', 'menu_key' => 'website', 'menu_type' => 0, 'icon' => 'iconfont-iconwangzhan1', @@ -68,6 +69,7 @@ return 'sort' => 90, 'status' => 1, 'is_show' => 1, + 'menu_attr' => 'common', 'children' => [ [ 'menu_name' => '装修管理', @@ -390,7 +392,7 @@ return ] ], [ - 'menu_name' => '会员', + 'menu_name' => '会员管理', 'menu_key' => 'member', 'menu_type' => 0, 'icon' => 'iconfont-iconhuiyuan2', @@ -401,6 +403,7 @@ return 'sort' => 70, 'status' => 1, 'is_show' => 1, + 'menu_attr' => 'system', 'children' => [ [ 'menu_name' => '会员列表', @@ -623,7 +626,7 @@ return ], ], [ - 'menu_name' => '设置', + 'menu_name' => '系统设置', 'menu_key' => 'setting', 'menu_type' => 0, 'icon' => 'iconfont-iconshezhi1', @@ -634,6 +637,7 @@ return 'sort' => 40, 'status' => 1, 'is_show' => 1, + 'menu_attr' => 'common', 'children' => [ [ 'menu_name' => '基础设置', @@ -1210,7 +1214,7 @@ return ] ], [ - 'menu_name' => '云市场', + 'menu_name' => '应用市场', 'menu_key' => 'app', 'menu_type' => 0, 'icon' => 'iconfont-iconyunshichang', @@ -1221,6 +1225,7 @@ return 'sort' => 10, 'status' => 1, 'is_show' => 1, + 'menu_attr' => 'common', 'children' => [ [ 'menu_name' => '应用插件', @@ -1275,6 +1280,7 @@ return 'sort' => 10, 'status' => 1, 'is_show' => 1, + 'menu_attr' => 'common', 'children' => [ [ 'menu_name' => '插件开发', diff --git a/niucloud/app/install/source/database.sql b/niucloud/app/install/source/database.sql index 399837b1d..c91e14b98 100644 --- a/niucloud/app/install/source/database.sql +++ b/niucloud/app/install/source/database.sql @@ -96,7 +96,7 @@ CREATE TABLE `generate_column` ( `query_type` varchar(100) DEFAULT '=' COMMENT '查询类型', `view_type` varchar(100) DEFAULT 'input' COMMENT '显示类型', `dict_type` varchar(255) DEFAULT '' COMMENT '字典类型', - `validate_type` VARCHAR(255) DEFAULT '' COMMENT '验证类型', + `validate_type` varchar(255) DEFAULT '' COMMENT '验证类型', `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', PRIMARY KEY (`id`) @@ -115,8 +115,8 @@ CREATE TABLE `generate_table` ( `edit_type` int(11) NOT NULL DEFAULT '1' COMMENT '编辑方式 1-弹框 2-新页面', `order_type` int NOT NULL DEFAULT 0 COMMENT '排序方式 0-无排序 1-正序 2-倒序', `parent_menu` varchar(255) NOT NULL DEFAULT '' COMMENT '上级菜单', - `relations` text NOT NULL COMMENT '关联配置', - `synchronous_number` INT(11) NOT NULL DEFAULT 0 COMMENT '同步次数', + `relations` text DEFAULT NULL COMMENT '关联配置', + `synchronous_number` int NOT NULL DEFAULT 0 COMMENT '同步次数', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='代码生成表'; @@ -4160,6 +4160,7 @@ CREATE TABLE `sys_config` ( KEY `config_key` (`config_key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统配置表'; + DROP TABLE IF EXISTS `sys_dict`; CREATE TABLE `sys_dict` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', @@ -4172,6 +4173,7 @@ CREATE TABLE `sys_dict` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据字典表'; + DROP TABLE IF EXISTS `sys_menu`; CREATE TABLE `sys_menu` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '菜单ID', diff --git a/niucloud/app/install/view/index/step-4.html b/niucloud/app/install/view/index/step-4.html index 094f05a1b..970429366 100644 --- a/niucloud/app/install/view/index/step-4.html +++ b/niucloud/app/install/view/index/step-4.html @@ -38,12 +38,6 @@ 网站后台 -