|
|
|
@ -13840,28 +13840,32 @@ class RouteCollector {
@@ -13840,28 +13840,32 @@ class RouteCollector {
|
|
|
|
|
console.log('📊 directRouteMappings是否为undefined:', _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings === undefined) |
|
|
|
|
|
|
|
|
|
// 从生成的路由映射文件收集
|
|
|
|
|
if (!_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings || !_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.pageMappings) { |
|
|
|
|
if (!_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings || !_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.routes) { |
|
|
|
|
console.warn('⚠️ 生成的路由映射文件格式不正确') |
|
|
|
|
console.log('🔍 调试信息:') |
|
|
|
|
console.log(' - directRouteMappings:', _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings) |
|
|
|
|
console.log(' - pageMappings:', _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings?.pageMappings) |
|
|
|
|
console.log(' - routes:', _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings?.routes) |
|
|
|
|
console.log(' - 导入是否成功:', _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings !== undefined) |
|
|
|
|
return [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log(`📊 找到 ${_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.pageMappings.length} 个页面映射`) |
|
|
|
|
console.log(`📊 找到 ${_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.routes.length} 个路由配置`) |
|
|
|
|
|
|
|
|
|
// 从页面映射中提取路由信息
|
|
|
|
|
const frontendRoutes = _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.pageMappings.map(mapping => { |
|
|
|
|
console.log(`📋 处理页面映射: ${mapping.route} (${mapping.component})`) |
|
|
|
|
// 从路由配置中提取路由信息,并关联API映射
|
|
|
|
|
const frontendRoutes = _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.routes.map(route => { |
|
|
|
|
console.log(`📋 处理路由: ${route.path} (${route.component})`) |
|
|
|
|
|
|
|
|
|
// 查找该路由对应的API调用
|
|
|
|
|
const apiCalls = this._findApiCallsForRoute(route) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
path: mapping.route, |
|
|
|
|
name: mapping.routeName, |
|
|
|
|
module: mapping.module, |
|
|
|
|
description: `${mapping.routeName}页面`, |
|
|
|
|
path: route.path, |
|
|
|
|
name: route.name, |
|
|
|
|
module: route.module, |
|
|
|
|
description: route.description || `${route.name || route.component}页面`, |
|
|
|
|
type: 'list', |
|
|
|
|
component: mapping.component, |
|
|
|
|
apiCalls: mapping.apiCalls |
|
|
|
|
component: route.component, |
|
|
|
|
apiCalls: apiCalls |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -13875,6 +13879,40 @@ class RouteCollector {
@@ -13875,6 +13879,40 @@ class RouteCollector {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查找路由对应的API调用
|
|
|
|
|
_findApiCallsForRoute(route) { |
|
|
|
|
const apiCalls = [] |
|
|
|
|
|
|
|
|
|
if (!_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.apiMappings) { |
|
|
|
|
return apiCalls |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 遍历API映射,找到与当前路由相关的调用
|
|
|
|
|
_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_0__.directRouteMappings.apiMappings.forEach(moduleMapping => { |
|
|
|
|
if (moduleMapping.module === route.module) { |
|
|
|
|
moduleMapping.apiMappings.forEach(apiMapping => { |
|
|
|
|
// 检查API调用是否与当前路由相关
|
|
|
|
|
const isRelated = apiMapping.callingComponents.some(component =>
|
|
|
|
|
component.component === route.component ||
|
|
|
|
|
component.path === route.path |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if (isRelated) { |
|
|
|
|
apiCalls.push({ |
|
|
|
|
type: 'api', |
|
|
|
|
method: apiMapping.method, |
|
|
|
|
path: apiMapping.path, |
|
|
|
|
methodName: apiMapping.methodName, |
|
|
|
|
serviceName: moduleMapping.serviceName |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return apiCalls |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取菜单路由
|
|
|
|
|
getMenuRoutes() { |
|
|
|
|
return this.routes.filter(route => route.name && route.name !== '') |
|
|
|
@ -14110,9 +14148,10 @@ class RouteMapper {
@@ -14110,9 +14148,10 @@ class RouteMapper {
|
|
|
|
|
http_method: apiCall.method, |
|
|
|
|
module: module, |
|
|
|
|
operation: `${apiCall.method} ${apiCall.path}`, |
|
|
|
|
service: 'direct', |
|
|
|
|
service: apiCall.serviceName || 'direct', |
|
|
|
|
method: apiCall.method, |
|
|
|
|
path: apiCall.path |
|
|
|
|
path: apiCall.path, |
|
|
|
|
methodName: apiCall.methodName |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -14155,12 +14194,14 @@ class RouteMapper {
@@ -14155,12 +14194,14 @@ class RouteMapper {
|
|
|
|
|
_getSubRouteMapping(routePath) { |
|
|
|
|
try { |
|
|
|
|
// 从新的直接映射文件中查找
|
|
|
|
|
if (_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings && _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.pageMappings) { |
|
|
|
|
const pageMapping = _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.pageMappings.find(p => p.route === routePath) |
|
|
|
|
if (pageMapping && pageMapping.apiCalls) { |
|
|
|
|
if (_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings && _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.routes) { |
|
|
|
|
const route = _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.routes.find(r => r.path === routePath) |
|
|
|
|
if (route) { |
|
|
|
|
// 查找该路由对应的API调用
|
|
|
|
|
const apiCalls = this._findApiCallsForRoute(route) |
|
|
|
|
return { |
|
|
|
|
route: routePath, |
|
|
|
|
apiCalls: pageMapping.apiCalls |
|
|
|
|
apiCalls: apiCalls |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -14170,24 +14211,56 @@ class RouteMapper {
@@ -14170,24 +14211,56 @@ class RouteMapper {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查找路由对应的API调用(与RouteCollector中的方法相同)
|
|
|
|
|
_findApiCallsForRoute(route) { |
|
|
|
|
const apiCalls = [] |
|
|
|
|
|
|
|
|
|
if (!_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.apiMappings) { |
|
|
|
|
return apiCalls |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 遍历API映射,找到与当前路由相关的调用
|
|
|
|
|
_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.apiMappings.forEach(moduleMapping => { |
|
|
|
|
if (moduleMapping.module === route.module) { |
|
|
|
|
moduleMapping.apiMappings.forEach(apiMapping => { |
|
|
|
|
// 检查API调用是否与当前路由相关
|
|
|
|
|
const isRelated = apiMapping.callingComponents.some(component =>
|
|
|
|
|
component.component === route.component ||
|
|
|
|
|
component.path === route.path |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if (isRelated) { |
|
|
|
|
apiCalls.push({ |
|
|
|
|
type: 'api', |
|
|
|
|
method: apiMapping.method, |
|
|
|
|
path: apiMapping.path, |
|
|
|
|
methodName: apiMapping.methodName, |
|
|
|
|
serviceName: moduleMapping.serviceName |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return apiCalls |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取模块的API配置 - 基于直接映射关系
|
|
|
|
|
_getApiConfigForModule(module) { |
|
|
|
|
let apiConfig = null |
|
|
|
|
|
|
|
|
|
// 从直接映射文件中获取API调用信息
|
|
|
|
|
try { |
|
|
|
|
if (_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings && _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.pageMappings) { |
|
|
|
|
const moduleMappings = _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.pageMappings.filter(p => p.module === module) |
|
|
|
|
if (moduleMappings.length > 0) { |
|
|
|
|
if (_direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings && _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.apiMappings) { |
|
|
|
|
const moduleMapping = _direct_route_mappings_js__WEBPACK_IMPORTED_MODULE_1__.directRouteMappings.apiMappings.find(m => m.module === module) |
|
|
|
|
if (moduleMapping && moduleMapping.apiMappings) { |
|
|
|
|
const operations = {} |
|
|
|
|
moduleMappings.forEach(mapping => { |
|
|
|
|
mapping.apiCalls.forEach(apiCall => { |
|
|
|
|
const operationKey = `${apiCall.type}_${apiCall.service || apiCall.method}_${apiCall.method || apiCall.path}` |
|
|
|
|
operations[operationKey] = { |
|
|
|
|
path: apiCall.path || `/${apiCall.service}/${apiCall.method}`, |
|
|
|
|
method: apiCall.method || 'GET' |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
moduleMapping.apiMappings.forEach(apiMapping => { |
|
|
|
|
const operationKey = `${apiMapping.method}_${apiMapping.methodName}_${apiMapping.path}` |
|
|
|
|
operations[operationKey] = { |
|
|
|
|
path: apiMapping.path, |
|
|
|
|
method: apiMapping.method |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
if (Object.keys(operations).length > 0) { |
|
|
|
@ -14630,7 +14703,7 @@ const directRouteMappings = {
@@ -14630,7 +14703,7 @@ const directRouteMappings = {
|
|
|
|
|
{ |
|
|
|
|
"module": "user-management", |
|
|
|
|
"serviceName": "userService", |
|
|
|
|
"servicePath": "D:\\aigc\\manta\\gofaster\\app\\src\\renderer\\modules\\user-management\\services\\userService.js", |
|
|
|
|
"servicePath": "D:\\manta\\gofaster\\app\\src\\renderer\\modules\\user-management\\services\\userService.js", |
|
|
|
|
"apiMappings": [ |
|
|
|
|
{ |
|
|
|
|
"methodName": "getUsers", |
|
|
|
@ -14769,7 +14842,7 @@ const directRouteMappings = {
@@ -14769,7 +14842,7 @@ const directRouteMappings = {
|
|
|
|
|
{ |
|
|
|
|
"module": "role-management", |
|
|
|
|
"serviceName": "roleService", |
|
|
|
|
"servicePath": "D:\\aigc\\manta\\gofaster\\app\\src\\renderer\\modules\\role-management\\services\\roleService.js", |
|
|
|
|
"servicePath": "D:\\manta\\gofaster\\app\\src\\renderer\\modules\\role-management\\services\\roleService.js", |
|
|
|
|
"apiMappings": [ |
|
|
|
|
{ |
|
|
|
|
"methodName": "getRoles", |
|
|
|
@ -16289,7 +16362,7 @@ __webpack_require__.r(__webpack_exports__);
@@ -16289,7 +16362,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
|
|
/******/
|
|
|
|
|
/******/ /* webpack/runtime/getFullHash */ |
|
|
|
|
/******/ (() => { |
|
|
|
|
/******/ __webpack_require__.h = () => ("26e8aeeb05d3a15a") |
|
|
|
|
/******/ __webpack_require__.h = () => ("8b2021d89ca88b3d") |
|
|
|
|
/******/ })(); |
|
|
|
|
/******/
|
|
|
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
|
|
|