From c325776b02c1405c8c80686947c64d94469582fb Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:54:04 +0800 Subject: [PATCH] improve the file management module and add some icons --- aspnet-core/database/ApiGateway-Init.sql | 87 +++++- ...ileManagementApplicationContractsModule.cs | 1 + .../Abp/FileManagement/FileCopyOrMoveDto.cs | 1 - .../Abp/FileManagement/FileCreateDto.cs | 1 - .../Abp/FileManagement/FileDeleteDto.cs | 1 - .../FileManagement/FileSystemDownloadDto.cs | 15 + .../Abp/FileManagement/FileSystemGetDto.cs | 1 - .../AbpFileManagementPermissions.cs | 2 +- .../FileManagement/FileSystemAppService.cs | 27 +- .../FileManagement/FileSystemController.cs | 99 ++++--- .../BackendAdminHostModule.cs | 10 + .../AppPlatformHttpApiHostModule.cs | 11 + vueJs/src/App.vue | 4 +- vueJs/src/api/filemanagement.ts | 13 + vueJs/src/api/users.ts | 7 +- vueJs/src/components/LangSelect/index.vue | 33 +-- vueJs/src/icons/components/404.ts | 2 +- vueJs/src/icons/components/admin.ts | 12 + vueJs/src/icons/components/aggregate.ts | 12 + vueJs/src/icons/components/api-gateway.ts | 12 + vueJs/src/icons/components/api.ts | 12 + vueJs/src/icons/components/back-top.ts | 2 +- vueJs/src/icons/components/bug.ts | 2 +- vueJs/src/icons/components/client.ts | 12 + vueJs/src/icons/components/clipboard.ts | 2 +- vueJs/src/icons/components/component.ts | 2 +- vueJs/src/icons/components/dashboard.ts | 2 +- vueJs/src/icons/components/edit.ts | 2 +- vueJs/src/icons/components/email.ts | 2 +- vueJs/src/icons/components/example.ts | 2 +- vueJs/src/icons/components/exit-fullscreen.ts | 2 +- vueJs/src/icons/components/eye-off.ts | 2 +- vueJs/src/icons/components/file-manager.ts | 12 + vueJs/src/icons/components/file-storage.ts | 12 + vueJs/src/icons/components/file.ts | 12 + vueJs/src/icons/components/folder.ts | 12 + vueJs/src/icons/components/form.ts | 2 +- vueJs/src/icons/components/global-setting.ts | 12 + vueJs/src/icons/components/group.ts | 12 + vueJs/src/icons/components/guide-2.ts | 2 +- vueJs/src/icons/components/hamburger.ts | 2 +- vueJs/src/icons/components/icon.ts | 2 +- vueJs/src/icons/components/identity-server.ts | 12 + vueJs/src/icons/components/identity.ts | 12 + vueJs/src/icons/components/index.ts | 20 +- vueJs/src/icons/components/international.ts | 2 +- vueJs/src/icons/components/language.ts | 2 +- vueJs/src/icons/components/like.ts | 2 +- vueJs/src/icons/components/manager.ts | 4 +- vueJs/src/icons/components/nested.ts | 2 +- .../src/icons/components/organization-unit.ts | 12 + vueJs/src/icons/components/pdf.ts | 2 +- vueJs/src/icons/components/people.ts | 2 +- vueJs/src/icons/components/peoples.ts | 2 +- vueJs/src/icons/components/role.ts | 4 +- vueJs/src/icons/components/route.ts | 12 + vueJs/src/icons/components/search.ts | 2 +- vueJs/src/icons/components/shopping.ts | 2 +- vueJs/src/icons/components/skill.ts | 2 +- vueJs/src/icons/components/star.ts | 2 +- vueJs/src/icons/components/tab.ts | 2 +- vueJs/src/icons/components/tenant.ts | 12 + vueJs/src/icons/components/theme.ts | 2 +- vueJs/src/icons/components/tree.ts | 2 +- vueJs/src/icons/components/wechat.ts | 2 +- vueJs/src/icons/components/zip.ts | 2 +- vueJs/src/icons/svg/admin.svg | 1 + vueJs/src/icons/svg/aggregate.svg | 1 + vueJs/src/icons/svg/api-gateway.svg | 1 + vueJs/src/icons/svg/api.svg | 1 + vueJs/src/icons/svg/client.svg | 1 + vueJs/src/icons/svg/file-manager.svg | 1 + vueJs/src/icons/svg/file-storage.svg | 1 + vueJs/src/icons/svg/file.svg | 1 + vueJs/src/icons/svg/folder.svg | 1 + vueJs/src/icons/svg/global-setting.svg | 1 + vueJs/src/icons/svg/group.svg | 1 + vueJs/src/icons/svg/identity-server.svg | 124 ++++++++ vueJs/src/icons/svg/identity.svg | 1 + vueJs/src/icons/svg/organization-unit.svg | 1 + vueJs/src/icons/svg/route.svg | 1 + vueJs/src/icons/svg/tenant.svg | 1 + vueJs/src/lang/zh.ts | 10 +- vueJs/src/permission.ts | 1 - vueJs/src/router/modules/admin.ts | 6 +- vueJs/src/router/modules/apigateway.ts | 6 +- vueJs/src/router/modules/file-management.ts | 8 +- vueJs/src/router/modules/identityServer.ts | 8 +- vueJs/src/store/index.ts | 4 +- vueJs/src/store/modules/abp.ts | 27 +- vueJs/src/store/modules/permission.ts | 4 +- vueJs/src/store/modules/user.ts | 13 +- vueJs/src/utils/request.ts | 69 +++-- .../settings/components/SettingEditForm.vue | 4 +- vueJs/src/views/admin/settings/index.vue | 7 +- vueJs/src/views/file-management/index.vue | 277 ++++++++++++++++-- vueJs/src/views/login/index.vue | 6 +- vueJs/src/views/register/index.vue | 4 +- vueJs/src/views/reset-password/index.vue | 4 +- 99 files changed, 950 insertions(+), 242 deletions(-) create mode 100644 aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemDownloadDto.cs create mode 100644 vueJs/src/icons/components/admin.ts create mode 100644 vueJs/src/icons/components/aggregate.ts create mode 100644 vueJs/src/icons/components/api-gateway.ts create mode 100644 vueJs/src/icons/components/api.ts create mode 100644 vueJs/src/icons/components/client.ts create mode 100644 vueJs/src/icons/components/file-manager.ts create mode 100644 vueJs/src/icons/components/file-storage.ts create mode 100644 vueJs/src/icons/components/file.ts create mode 100644 vueJs/src/icons/components/folder.ts create mode 100644 vueJs/src/icons/components/global-setting.ts create mode 100644 vueJs/src/icons/components/group.ts create mode 100644 vueJs/src/icons/components/identity-server.ts create mode 100644 vueJs/src/icons/components/identity.ts create mode 100644 vueJs/src/icons/components/organization-unit.ts create mode 100644 vueJs/src/icons/components/route.ts create mode 100644 vueJs/src/icons/components/tenant.ts create mode 100644 vueJs/src/icons/svg/admin.svg create mode 100644 vueJs/src/icons/svg/aggregate.svg create mode 100644 vueJs/src/icons/svg/api-gateway.svg create mode 100644 vueJs/src/icons/svg/api.svg create mode 100644 vueJs/src/icons/svg/client.svg create mode 100644 vueJs/src/icons/svg/file-manager.svg create mode 100644 vueJs/src/icons/svg/file-storage.svg create mode 100644 vueJs/src/icons/svg/file.svg create mode 100644 vueJs/src/icons/svg/folder.svg create mode 100644 vueJs/src/icons/svg/global-setting.svg create mode 100644 vueJs/src/icons/svg/group.svg create mode 100644 vueJs/src/icons/svg/identity-server.svg create mode 100644 vueJs/src/icons/svg/identity.svg create mode 100644 vueJs/src/icons/svg/organization-unit.svg create mode 100644 vueJs/src/icons/svg/route.svg create mode 100644 vueJs/src/icons/svg/tenant.svg diff --git a/aspnet-core/database/ApiGateway-Init.sql b/aspnet-core/database/ApiGateway-Init.sql index 878518b50..18927c432 100644 --- a/aspnet-core/database/ApiGateway-Init.sql +++ b/aspnet-core/database/ApiGateway-Init.sql @@ -11,7 +11,7 @@ Target Server Version : 80020 File Encoding : 65001 - Date: 07/08/2020 08:04:44 + Date: 10/08/2020 09:45:50 */ SET NAMES utf8mb4; @@ -89,7 +89,7 @@ CREATE TABLE `appapigatewayauthoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayAuthOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayAuthOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 114 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayauthoptions @@ -174,6 +174,14 @@ INSERT INTO `appapigatewayauthoptions` VALUES (102, 1290849628051124224, '', '') INSERT INTO `appapigatewayauthoptions` VALUES (103, 1290849798553776128, '', ''); INSERT INTO `appapigatewayauthoptions` VALUES (104, 1290849978032238592, '', ''); INSERT INTO `appapigatewayauthoptions` VALUES (105, 1291259822512693248, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (106, 1292620505149145088, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (107, 1292620665505775616, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (108, 1292620843398791168, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (109, 1292621027574874112, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (110, 1292621363161137152, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (111, 1292621494837116928, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (112, 1292621629260365824, '', ''); +INSERT INTO `appapigatewayauthoptions` VALUES (113, 1292622526073864192, '', ''); -- ---------------------------- -- Table structure for appapigatewaybalanceroptions @@ -191,7 +199,7 @@ CREATE TABLE `appapigatewaybalanceroptions` ( UNIQUE INDEX `IX_AppApiGatewayBalancerOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayBalancerOptions_AppApiGatewayGlobalConfiguratio~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayBalancerOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 109 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 117 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaybalanceroptions @@ -277,6 +285,14 @@ INSERT INTO `appapigatewaybalanceroptions` VALUES (105, NULL, 129084962805112422 INSERT INTO `appapigatewaybalanceroptions` VALUES (106, NULL, 1290849798553776128, '', '', 0); INSERT INTO `appapigatewaybalanceroptions` VALUES (107, NULL, 1290849978032238592, '', '', 0); INSERT INTO `appapigatewaybalanceroptions` VALUES (108, NULL, 1291259822512693248, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (109, NULL, 1292620505149145088, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (110, NULL, 1292620665505775616, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (111, NULL, 1292620843398791168, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (112, NULL, 1292621027574874112, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (113, NULL, 1292621363161137152, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (114, NULL, 1292621494837116928, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (115, NULL, 1292621629260365824, '', '', 0); +INSERT INTO `appapigatewaybalanceroptions` VALUES (116, NULL, 1292622526073864192, '', '', 0); -- ---------------------------- -- Table structure for appapigatewaycacheoptions @@ -290,7 +306,7 @@ CREATE TABLE `appapigatewaycacheoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayCacheOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayCacheOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 114 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaycacheoptions @@ -375,6 +391,14 @@ INSERT INTO `appapigatewaycacheoptions` VALUES (102, 1290849628051124224, 0, '') INSERT INTO `appapigatewaycacheoptions` VALUES (103, 1290849798553776128, 0, ''); INSERT INTO `appapigatewaycacheoptions` VALUES (104, 1290849978032238592, 0, ''); INSERT INTO `appapigatewaycacheoptions` VALUES (105, 1291259822512693248, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (106, 1292620505149145088, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (107, 1292620665505775616, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (108, 1292620843398791168, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (109, 1292621027574874112, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (110, 1292621363161137152, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (111, 1292621494837116928, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (112, 1292621629260365824, 0, ''); +INSERT INTO `appapigatewaycacheoptions` VALUES (113, 1292622526073864192, 0, ''); -- ---------------------------- -- Table structure for appapigatewaydiscovery @@ -484,7 +508,7 @@ CREATE TABLE `appapigatewayhttpoptions` ( UNIQUE INDEX `IX_AppApiGatewayHttpOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayHttpOptions_AppApiGatewayGlobalConfiguration_It~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayHttpOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 109 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 117 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayhttpoptions @@ -570,6 +594,14 @@ INSERT INTO `appapigatewayhttpoptions` VALUES (105, NULL, 1290849628051124224, 0 INSERT INTO `appapigatewayhttpoptions` VALUES (106, NULL, 1290849798553776128, 0, 0, 0, 0, 0); INSERT INTO `appapigatewayhttpoptions` VALUES (107, NULL, 1290849978032238592, 0, 0, 0, 0, 0); INSERT INTO `appapigatewayhttpoptions` VALUES (108, NULL, 1291259822512693248, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (109, NULL, 1292620505149145088, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (110, NULL, 1292620665505775616, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (111, NULL, 1292620843398791168, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (112, NULL, 1292621027574874112, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (113, NULL, 1292621363161137152, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (114, NULL, 1292621494837116928, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (115, NULL, 1292621629260365824, 0, 0, 0, 0, 0); +INSERT INTO `appapigatewayhttpoptions` VALUES (116, NULL, 1292622526073864192, 0, 0, 0, 0, 0); -- ---------------------------- -- Table structure for appapigatewayqosoptions @@ -587,7 +619,7 @@ CREATE TABLE `appapigatewayqosoptions` ( UNIQUE INDEX `IX_AppApiGatewayQoSOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayQoSOptions_AppApiGatewayGlobalConfiguration_Ite~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayQoSOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 109 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 117 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayqosoptions @@ -673,6 +705,14 @@ INSERT INTO `appapigatewayqosoptions` VALUES (105, NULL, 1290849628051124224, 50 INSERT INTO `appapigatewayqosoptions` VALUES (106, NULL, 1290849798553776128, 50, 60000, 30000); INSERT INTO `appapigatewayqosoptions` VALUES (107, NULL, 1290849978032238592, 50, 60000, 30000); INSERT INTO `appapigatewayqosoptions` VALUES (108, NULL, 1291259822512693248, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (109, NULL, 1292620505149145088, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (110, NULL, 1292620665505775616, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (111, NULL, 1292620843398791168, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (112, NULL, 1292621027574874112, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (113, NULL, 1292621363161137152, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (114, NULL, 1292621494837116928, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (115, NULL, 1292621629260365824, 50, 60000, 30000); +INSERT INTO `appapigatewayqosoptions` VALUES (116, NULL, 1292622526073864192, 50, 60000, 30000); -- ---------------------------- -- Table structure for appapigatewayratelimitoptions @@ -714,7 +754,7 @@ CREATE TABLE `appapigatewayratelimitrule` ( UNIQUE INDEX `IX_AppApiGatewayRateLimitRule_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewayRateLimitRule_AppApiGatewayDynamicReRoute_Dynam~` FOREIGN KEY (`DynamicReRouteId`) REFERENCES `appapigatewaydynamicreroute` (`DynamicReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT, CONSTRAINT `FK_AppApiGatewayRateLimitRule_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 114 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayratelimitrule @@ -799,6 +839,14 @@ INSERT INTO `appapigatewayratelimitrule` VALUES (102, 1290849628051124224, NULL, INSERT INTO `appapigatewayratelimitrule` VALUES (103, 1290849798553776128, NULL, '', 0, NULL, NULL, NULL); INSERT INTO `appapigatewayratelimitrule` VALUES (104, 1290849978032238592, NULL, '', 0, NULL, NULL, NULL); INSERT INTO `appapigatewayratelimitrule` VALUES (105, 1291259822512693248, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (106, 1292620505149145088, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (107, 1292620665505775616, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (108, 1292620843398791168, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (109, 1292621027574874112, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (110, 1292621363161137152, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (111, 1292621494837116928, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (112, 1292621629260365824, NULL, '', 0, NULL, NULL, NULL); +INSERT INTO `appapigatewayratelimitrule` VALUES (113, 1292622526073864192, NULL, '', 0, NULL, NULL, NULL); -- ---------------------------- -- Table structure for appapigatewayreroute @@ -838,7 +886,7 @@ CREATE TABLE `appapigatewayreroute` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `AK_AppApiGatewayReRoute_ReRouteId`(`ReRouteId`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewayReRoute_AppId_DownstreamPathTemplate_UpstreamPa~`(`AppId`, `DownstreamPathTemplate`, `UpstreamPathTemplate`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 113 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 121 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewayreroute @@ -923,6 +971,14 @@ INSERT INTO `appapigatewayreroute` VALUES (109, '{}', 'e937ff4ea11e4f0ca39d079c7 INSERT INTO `appapigatewayreroute` VALUES (110, '{}', '22212bc751b743678d9c2f095d05ce25', 1290849798553776128, '【平台服务】- 当前用户配置', '/api/settings/by-current-user', '', '', '/api/settings/by-current-user', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30010,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (111, '{}', '8dfa430d752a4b4a869ad401b3802a62', 1290849978032238592, '【平台服务】- 配置管理', '/api/settings', '', '', '/api/settings', 'GET,PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30010,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); INSERT INTO `appapigatewayreroute` VALUES (112, '{}', '9844fed6507844f2ac64bd08649bd3a6', 1291259822512693248, '【身份认证服务】- 查询组织机构根节点', '/api/identity/organization-units/root-node', '', '', '/api/identity/organization-units/root-node', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30010,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (113, '{}', '24d8794cf8f943b4ac45d2bcccf7c128', 1292620505149145088, '【平台服务】- 文件系统', '/api/file-management/file-system', '', '', '/api/file-management/file-system', 'GET,PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (114, '{}', '0acf6762d3af43efb655107e0039f5fc', 1292620665505775616, '【平台服务】- 文件系统 - 目录管理', '/api/file-management/file-system/folders', '', '', '/api/file-management/file-system/folders', 'POST,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (115, '{}', '5442138c816542bbb8b2c7fa51f10a5f', 1292620843398791168, '【平台服务】- 文件系统 - 文件管理', '/api/file-management/file-system/files', '', '', '/api/file-management/file-system/files', 'GET,POST,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (116, '{}', '7eb315567bbc470bbbfd26923c5d0aba', 1292621027574874112, '【平台服务】- 文件系统 - 复制目录', '/api/file-management/file-system/folders/copy', '', '', '/api/file-management/file-system/folders/copy', 'PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (117, '{}', 'af5853680cff454fa66ff6022f18da23', 1292621363161137152, '【平台服务】- 文件系统 - 移动目录', '/api/file-management/file-system/folders/move', '', '', '/api/file-management/file-system/folders/move', 'PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (118, '{}', '6daa6d8c8adb466899988fd8181c29a8', 1292621494837116928, '【平台服务】- 文件系统 - 复制文件', '/api/file-management/file-system/files/copy', '', '', '/api/file-management/file-system/files/copy', 'PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (119, '{}', '9560caaa3bd9424984c44724aa54bfe9', 1292621629260365824, '【平台服务】- 文件系统 - 移动文件', '/api/file-management/file-system/files/move', '', '', '/api/file-management/file-system/files/move', 'PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); +INSERT INTO `appapigatewayreroute` VALUES (120, '{}', 'fc2aaa6035484201b9014912930fb7cb', 1292622526073864192, '【平台服务】- 文件系统 - 详情页', '/api/file-management/file-system/profile', '', '', '/api/file-management/file-system/profile', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30025,', '', '', '', 0, 30000, 1, '', 'TEST-APP'); -- ---------------------------- -- Table structure for appapigatewayroutegroup @@ -966,7 +1022,7 @@ CREATE TABLE `appapigatewaysecurityoptions` ( PRIMARY KEY (`Id`) USING BTREE, UNIQUE INDEX `IX_AppApiGatewaySecurityOptions_ReRouteId`(`ReRouteId`) USING BTREE, CONSTRAINT `FK_AppApiGatewaySecurityOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 106 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 114 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of appapigatewaysecurityoptions @@ -1051,6 +1107,14 @@ INSERT INTO `appapigatewaysecurityoptions` VALUES (102, 1290849628051124224, '', INSERT INTO `appapigatewaysecurityoptions` VALUES (103, 1290849798553776128, '', ''); INSERT INTO `appapigatewaysecurityoptions` VALUES (104, 1290849978032238592, '', ''); INSERT INTO `appapigatewaysecurityoptions` VALUES (105, 1291259822512693248, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (106, 1292620505149145088, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (107, 1292620665505775616, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (108, 1292620843398791168, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (109, 1292621027574874112, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (110, 1292621363161137152, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (111, 1292621494837116928, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (112, 1292621629260365824, '', ''); +INSERT INTO `appapigatewaysecurityoptions` VALUES (113, 1292622526073864192, '', ''); -- ---------------------------- -- Table structure for cap.published @@ -1069,11 +1133,6 @@ CREATE TABLE `cap.published` ( INDEX `IX_ExpiresAt`(`ExpiresAt`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; --- ---------------------------- --- Records of cap.published --- ---------------------------- -INSERT INTO `cap.published` VALUES (1291259823775178752, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1291259823775178752\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/8/6 14:28:27 +08:00\",\"cap-corr-id\":\"1291259823775178752\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-08-06T14:28:27.0879956+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-08-06 14:28:27', '2020-08-07 14:28:27', 'Succeeded'); - -- ---------------------------- -- Table structure for cap.received -- ---------------------------- diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/AbpFileManagementApplicationContractsModule.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/AbpFileManagementApplicationContractsModule.cs index 891ac26a2..b4a0cd686 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/AbpFileManagementApplicationContractsModule.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/AbpFileManagementApplicationContractsModule.cs @@ -4,6 +4,7 @@ using Volo.Abp.Modularity; namespace LINGYUN.Abp.FileManagement { [DependsOn( + typeof(AbpFileManagementDomainSharedModule), typeof(AbpDddApplicationModule))] public class AbpFileManagementApplicationContractsModule : AbpModule { diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCopyOrMoveDto.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCopyOrMoveDto.cs index bbda957fe..d399c5571 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCopyOrMoveDto.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCopyOrMoveDto.cs @@ -4,7 +4,6 @@ namespace LINGYUN.Abp.FileManagement { public class FileCopyOrMoveDto { - [Required] [StringLength(255)] public string Path { get; set; } diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCreateDto.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCreateDto.cs index 5a5096e58..a0d87c28a 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCreateDto.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileCreateDto.cs @@ -8,7 +8,6 @@ namespace LINGYUN.Abp.FileManagement /// /// 文件名 /// - [Required] [StringLength(255)] public string Name { get; set; } /// diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileDeleteDto.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileDeleteDto.cs index f74c4d823..a12f6ff3c 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileDeleteDto.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileDeleteDto.cs @@ -4,7 +4,6 @@ namespace LINGYUN.Abp.FileManagement { public class FileDeleteDto { - [Required] [StringLength(255)] public string Path { get; set; } diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemDownloadDto.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemDownloadDto.cs new file mode 100644 index 000000000..b421dda4a --- /dev/null +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemDownloadDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace LINGYUN.Abp.FileManagement +{ + public class FileSystemDownloadDto : FileSystemGetDto + { + /// + /// 当前字节数 + /// + public int CurrentByte { get; set; } + } +} diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemGetDto.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemGetDto.cs index 421ae1803..8c9619ba6 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemGetDto.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/FileSystemGetDto.cs @@ -4,7 +4,6 @@ namespace LINGYUN.Abp.FileManagement { public class FileSystemGetDto { - [Required] [StringLength(255)] public string Path { get; set; } diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/Permissions/AbpFileManagementPermissions.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/Permissions/AbpFileManagementPermissions.cs index 0b415358f..6f33e940b 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/Permissions/AbpFileManagementPermissions.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application.Contracts/LINGYUN/Abp/FileManagement/Permissions/AbpFileManagementPermissions.cs @@ -2,7 +2,7 @@ { public class AbpFileManagementPermissions { - public const string GroupName = "Abp.FileManagement"; + public const string GroupName = "AbpFileManagement"; /// /// 文件系统 diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs index 68e3b603c..7a9fd2076 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Application/LINGYUN/Abp/FileManagement/FileSystemAppService.cs @@ -126,7 +126,8 @@ namespace LINGYUN.Abp.FileManagement var fileSystemPath = GetFileSystemPath(input.Path); fileSystemPath = Path.Combine(fileSystemPath, input.Name); var blobName = GetFileSystemRelativePath(fileSystemPath); - + // 去除第一个路径标识符 + blobName = blobName.RemovePreFix("/", "\\"); return await BlobContainer.GetAsync(blobName); } @@ -181,10 +182,14 @@ namespace LINGYUN.Abp.FileManagement fileSystemPath = GetFileSystemPath(input.Parent); } var directoryInfo = new DirectoryInfo(fileSystemPath); - // 查询全部 + if (!directoryInfo.Exists) + { + return Task.FromResult(new PagedResultDto(0, fileSystems)); + } + // 查询全部文件系统 var fileSystemInfos = directoryInfo.GetFileSystemInfos(); // 指定搜索条件查询目录 - FileSystemInfo[] fileSystemInfoSearchChildren;// = directoryInfo.GetDirectories(input.Filter ?? "*", SearchOption.TopDirectoryOnly); + FileSystemInfo[] fileSystemInfoSearchChildren; if (!input.Filter.IsNullOrWhiteSpace()) { var searchPattern = $"*{input.Filter}*"; @@ -341,20 +346,22 @@ namespace LINGYUN.Abp.FileManagement // 去除完整路径中的文件系统根目录 var fileSystemConfiguration = GetFileSystemBlobProviderConfiguration(); var blobPath = fileSystemConfiguration.BasePath; - path = path.Replace(blobPath, ""); // 去除租户或宿主目录 if (CurrentTenant.Id == null) { - path = path.Replace("\\host", ""); + blobPath = Path.Combine(blobPath, "host"); } else { - path = path.Replace($"\\tenants\\{CurrentTenant.Id.Value.ToString("D")}", ""); + blobPath = Path.Combine(blobPath, "tenants", CurrentTenant.Id.Value.ToString("D")); } // 去除完整路径中的容器根目录 var containerName = BlobContainerNameAttribute.GetContainerName(); - path = path.Replace($"\\{containerName}", ""); - + if (path.Contains(containerName)) + { + blobPath = Path.Combine(blobPath, containerName); + } + path = path.Replace(blobPath, ""); return path; } @@ -363,8 +370,10 @@ namespace LINGYUN.Abp.FileManagement var fileSystemConfiguration = GetFileSystemBlobProviderConfiguration(); var blobPath = GetFileSystemBashPath(); - if (fileSystemConfiguration.AppendContainerNameToBasePath) + if (!path.IsNullOrWhiteSpace() && fileSystemConfiguration.AppendContainerNameToBasePath) { + // 去除第一个路径标识符 + path = path.RemovePreFix("/", "\\"); blobPath = Path.Combine(blobPath, path); } diff --git a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.HttpApi/LINGYUN/Abp/FileManagement/FileSystemController.cs b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.HttpApi/LINGYUN/Abp/FileManagement/FileSystemController.cs index de8205cf7..8deebdb75 100644 --- a/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.HttpApi/LINGYUN/Abp/FileManagement/FileSystemController.cs +++ b/aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.HttpApi/LINGYUN/Abp/FileManagement/FileSystemController.cs @@ -1,4 +1,5 @@ using LINGYUN.Abp.FileManagement.Settings; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.StaticFiles; using System; @@ -47,7 +48,7 @@ namespace LINGYUN.Abp.FileManagement [HttpPost] [Route("files")] - public virtual async Task CreateFileAsync(FileCreateDto input) + public virtual async Task CreateFileAsync([FromQuery] FileCreateDto input, IFormFile file) { // 检查文件大小 var fileSizeLimited = await SettingProvider @@ -76,17 +77,15 @@ namespace LINGYUN.Abp.FileManagement { throw new UserFriendlyException(L["NotAllowedFileExtensionName", fileExtensionName]); } - // 当前计算机临时目录 - var tempFilePath = Environment.GetFolderPath(Environment.SpecialFolder.Templates); // 以上传的文件名创建一个临时目录 - tempFilePath = Path.Combine(tempFilePath, "lingyun-abp-file-management", Path.GetFileNameWithoutExtension(fileName)); + var tempFilePath = Path.Combine( + Path.GetTempPath(), + "lingyun-abp-file-management", + "upload", + string.Concat(input.Path ?? "", input.Name).ToMd5()); + DirectoryHelper.CreateIfNotExists(tempFilePath); // 以上传的分片索引创建临时文件 var tempSavedFile = Path.Combine(tempFilePath, $"{input.CurrentByte}.{fileExtensionName}"); - if (!Directory.Exists(tempFilePath)) - { - // 临时目录不存在则创建 - Directory.CreateDirectory(tempFilePath); - } try { if (HttpContext.RequestAborted.IsCancellationRequested) @@ -99,7 +98,7 @@ namespace LINGYUN.Abp.FileManagement using (var fs = new FileStream(tempSavedFile, FileMode.Create, FileAccess.Write)) { // 写入当前分片文件 - await Request.Body.CopyToAsync(fs); + await file.CopyToAsync(fs); } if (input.CurrentByte == input.TotalByte) @@ -160,46 +159,66 @@ namespace LINGYUN.Abp.FileManagement [HttpGet] [Route("files")] - public virtual async Task DownloadFileAsync(FileSystemGetDto input) + public virtual async Task DownloadFileAsync(FileSystemDownloadDto input) { - var fileStream = await FileSystemAppService.DownloadFileAsync(input); - - // 得到文件扩展名 - var fileExt = Path.GetExtension(input.Name); - var provider = new FileExtensionContentTypeProvider(); - // Http响应标头的文件类型 - string memi = provider.Mappings[fileExt]; - using (Response.Body) + var tempFileName = string.Concat(input.Path ?? "", input.Name); + tempFileName = tempFileName.ToMd5() + Path.GetExtension(input.Name); + // 以上传的文件名创建一个临时目录 + var tempFilePath = Path.Combine( + Path.GetTempPath(), + "lingyun-abp-file-management", + "download"); + DirectoryHelper.CreateIfNotExists(tempFilePath); + tempFilePath = Path.Combine(tempFilePath, tempFileName); + long contentLength = 0L; + // 单个分块大小 2MB + int bufferSize = 2 * 1024 * 1024; + using (new DisposeAction(() => + { + // 最终下载完毕后,删除临时文件 + if (bufferSize + input.CurrentByte > contentLength) + { + FileHelper.DeleteIfExists(tempFilePath); + } + })) { + if (!System.IO.File.Exists(tempFilePath)) + { + var blobStream = await FileSystemAppService.DownloadFileAsync(input); + using (var tempFileStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write)) + { + blobStream.Position = 0; + await blobStream.CopyToAsync(tempFileStream); + } + } + // 读取缓存文件 + using var fileStream = new FileStream(tempFilePath, FileMode.Open, FileAccess.Read); + // 得到文件扩展名 + var fileExt = Path.GetExtension(input.Name); + var provider = new FileExtensionContentTypeProvider(); // Http响应标头的文件类型 - Response.ContentType = memi; + string memi = provider.Mappings[fileExt]; // 文件大小 - byte[] contentBytes = await fileStream.GetAllBytesAsync(); - long contentLength = contentBytes.Length; - // 指定响应内容大小 - Response.ContentLength = contentLength; - // 单个分块大小 2MB - int bufferSize = 2 * 1024 * 1024; - // 分块总数 - int contentByteCount = Math.DivRem(contentBytes.Length, bufferSize, out int modResult); - for (int index = 0; index < contentByteCount; index++) + contentLength = fileStream.Length; + if (bufferSize > contentLength) + { + var currentTransferBytes = await fileStream.GetAllBytesAsync(); + // 写入响应流 + return File(currentTransferBytes, memi, input.Name); + } + else { // 当前分页传输字节 byte[] currentTransferBytes = new byte[bufferSize]; - if (index == contentByteCount - 1) + if (input.CurrentByte + bufferSize >= contentLength) { - // 最后一个分块和余数大小一起传输 - if (modResult > 0) - { - currentTransferBytes = new byte[bufferSize + modResult]; - } + currentTransferBytes = new byte[contentLength - input.CurrentByte]; } - // 复制文件流中的当前分块区段 - Array.Copy(contentBytes, index * bufferSize, currentTransferBytes, 0, currentTransferBytes.Length); + // 读取文件流中的当前分块区段 + fileStream.Seek(input.CurrentByte, SeekOrigin.Begin); + await fileStream.ReadAsync(currentTransferBytes, 0, currentTransferBytes.Length); // 写入响应流 - await Response.Body.WriteAsync(currentTransferBytes, 0, currentTransferBytes.Length); - // 清空缓冲区 - await Response.Body.FlushAsync(); + return File(currentTransferBytes, memi, input.Name); } } } diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs index 931a5b941..fbccd7cc5 100644 --- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs +++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs @@ -198,6 +198,16 @@ namespace LINGYUN.BackendAdmin options.Resources .Get() .AddVirtualJson("/LINGYUN/BackendAdmin/Identity/Localization"); + options + .AddLanguagesMapOrUpdate( + "vue-admin-element-ui", + new NameValue("zh-Hans", "zh"), + new NameValue("en", "en")); + options + .AddLanguageFilesMapOrUpdate( + "vue-admin-element-ui", + new NameValue("zh-Hans", "zh"), + new NameValue("en", "en")); }); context.Services.AddAuthentication("Bearer") diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs index 5fb3e6d81..f1a4587ff 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs @@ -165,6 +165,17 @@ namespace LINGYUN.Platform { options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); + + options + .AddLanguagesMapOrUpdate( + "vue-admin-element-ui", + new NameValue("zh-Hans", "zh"), + new NameValue("en", "en")); + options + .AddLanguageFilesMapOrUpdate( + "vue-admin-element-ui", + new NameValue("zh-Hans", "zh"), + new NameValue("en", "en")); }); context.Services.AddAuthentication("Bearer") diff --git a/vueJs/src/App.vue b/vueJs/src/App.vue index fa8146b67..2d7738f0e 100644 --- a/vueJs/src/App.vue +++ b/vueJs/src/App.vue @@ -6,7 +6,7 @@ diff --git a/vueJs/src/api/filemanagement.ts b/vueJs/src/api/filemanagement.ts index 83a38a4a3..1063f3e6b 100644 --- a/vueJs/src/api/filemanagement.ts +++ b/vueJs/src/api/filemanagement.ts @@ -73,6 +73,19 @@ export default class FileManagementService { const _url = baseUrl + '/files/copy' return ApiService.Put(_url, payload, serviceUrl) } + + public static downlodFle(name: string, path: string | undefined, currentByte: number | undefined) { + let _url = baseUrl + '/files?name=' + name + if (path) { + _url += '&path=' + path + } + _url += '¤tByte=' + currentByte + return ApiService.HttpRequestWithOriginResponse(({ + url: _url, + method: 'GET', + responseType: 'blob' + })) + } } export enum FileSystemType { diff --git a/vueJs/src/api/users.ts b/vueJs/src/api/users.ts index f7555d49e..f7d018e10 100644 --- a/vueJs/src/api/users.ts +++ b/vueJs/src/api/users.ts @@ -158,11 +158,11 @@ export default class UserApiService { }) } - public static refreshToken(token: string) { + public static refreshToken(token: string, refreshToken: string) { const _url = '/connect/token' const refresh = { grant_type: 'refresh_token', - refresh_token: token, + refresh_token: refreshToken, client_id: process.env.VUE_APP_CLIENT_ID, client_secret: process.env.VUE_APP_CLIENT_SECRET } @@ -172,7 +172,8 @@ export default class UserApiService { method: 'POST', data: qs.stringify(refresh), headers: { - 'Content-Type': 'application/x-www-form-urlencoded' + 'Content-Type': 'application/x-www-form-urlencoded', + 'Authorization': token } }) } diff --git a/vueJs/src/components/LangSelect/index.vue b/vueJs/src/components/LangSelect/index.vue index 7ecc4778b..1701a5dd2 100644 --- a/vueJs/src/components/LangSelect/index.vue +++ b/vueJs/src/components/LangSelect/index.vue @@ -28,9 +28,9 @@ + + diff --git a/vueJs/src/views/login/index.vue b/vueJs/src/views/login/index.vue index d38dbb28f..14566a788 100644 --- a/vueJs/src/views/login/index.vue +++ b/vueJs/src/views/login/index.vue @@ -158,7 +158,7 @@ import TenantBox from '@/components/TenantBox/index.vue' import LangSelect from '@/components/LangSelect/index.vue' import { Component, Vue, Watch } from 'vue-property-decorator' import UserService, { PhoneVerify, VerifyType } from '@/api/users' -import { AbpConfigurationModule } from '@/store/modules/abp' +import { AbpModule } from '@/store/modules/abp' @Component({ name: 'Login', @@ -185,11 +185,11 @@ export default class extends Vue { } get isMultiEnabled() { - return AbpConfigurationModule.configuration?.multiTenancy?.isEnabled + return AbpModule.configuration?.multiTenancy?.isEnabled } get selfRegistration() { - const selfRegister = AbpConfigurationModule.configuration.setting.values['Abp.Account.IsSelfRegistrationEnabled'] + const selfRegister = AbpModule.configuration.setting.values['Abp.Account.IsSelfRegistrationEnabled'] if (selfRegister) { return selfRegister === 'true' } diff --git a/vueJs/src/views/register/index.vue b/vueJs/src/views/register/index.vue index aff866bbd..fc6229b62 100644 --- a/vueJs/src/views/register/index.vue +++ b/vueJs/src/views/register/index.vue @@ -125,7 +125,7 @@ import TenantBox from '@/components/TenantBox/index.vue' import LangSelect from '@/components/LangSelect/index.vue' import { Component, Vue, Watch } from 'vue-property-decorator' import UserService, { PhoneVerify, VerifyType, UserRegisterData } from '@/api/users' -import { AbpConfigurationModule } from '@/store/modules/abp' +import { AbpModule } from '@/store/modules/abp' @Component({ name: 'Register', @@ -151,7 +151,7 @@ export default class extends Vue { } get isMultiEnabled() { - return AbpConfigurationModule.configuration?.multiTenancy?.isEnabled + return AbpModule.configuration?.multiTenancy?.isEnabled } private validatePhoneNumberValue = (rule: any, value: string, callback: any) => { diff --git a/vueJs/src/views/reset-password/index.vue b/vueJs/src/views/reset-password/index.vue index 65e422f23..cd5030340 100644 --- a/vueJs/src/views/reset-password/index.vue +++ b/vueJs/src/views/reset-password/index.vue @@ -113,7 +113,7 @@ import TenantBox from '@/components/TenantBox/index.vue' import LangSelect from '@/components/LangSelect/index.vue' import { Component, Vue, Watch } from 'vue-property-decorator' import UserService, { PhoneVerify, VerifyType, UserResetPasswordData } from '@/api/users' -import { AbpConfigurationModule } from '@/store/modules/abp' +import { AbpModule } from '@/store/modules/abp' @Component({ name: 'Register', @@ -138,7 +138,7 @@ export default class extends Vue { } get isMultiEnabled() { - return AbpConfigurationModule.configuration?.multiTenancy?.isEnabled + return AbpModule.configuration?.multiTenancy?.isEnabled } private validatePhoneNumberValue = (rule: any, value: string, callback: any) => {