-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
多模块上传接口读取配置错误 #119
Comments
77行的break是什么意思?只取第一个激活配置吗? 还有后面真实上传的代码 try {
// 上传
YapiResponse yapiResponse = new UploadYapi().uploadSave(yapiSaveParam, null, project.getBasePath());
if (yapiResponse.getErrcode() != 0) {
Notification error = notificationGroup.createNotification("sorry ,upload api error cause:" + yapiResponse.getErrmsg(), NotificationType.ERROR);
Notifications.Bus.notify(error, project);
} else {
String url = yapiUrl + "/project/" + projectId + "/interface/api/cat_" + yapiResponse.getCatId();
this.setClipboard(url);
Notification error = notificationGroup.createNotification("success ,url: " + url, NotificationType.INFORMATION);
Notifications.Bus.notify(error, project);
}
} catch (Exception e1) { 这里并没有处理moduleList的多值情况。只上传1次。 |
1、先回答 : 77行的break是什么意思?只取第一个激活配置吗? 先看代码: if (modules.length > 1) {
String[] moduleList = modules[1].split("</")[0].split(","); # moduleList值是["cloud","cloud-web"]
PsiFile psiFile = (PsiFile) e.getDataContext().getData(CommonDataKeys.PSI_FILE);
String virtualFile = psiFile.getVirtualFile().getPath(); # 例如:/cloud-web/com/test/DemoController
for (int i = 0; i < moduleList.length; i++) {
if (virtualFile.contains(moduleList[i])) { # 问题出现在这个if判断
projectToken = projectConfig.split(moduleList[i] + "\\.projectToken\">")[1].split("</")[0];
projectId = projectConfig.split(moduleList[i] + "\\.projectId\">")[1].split("</")[0];
yapiUrl = projectConfig.split(moduleList[i] + "\\.yapiUrl\">")[1].split("</")[0];
projectType = projectConfig.split(moduleList[i] + "\\.projectType\">")[1].split("</")[0];
if (projectConfig.split(moduleList[i] + "\\.returnClass\">").length > 1) {
returnClass = projectConfig.split(moduleList[i] + "\\.returnClass\">")[1].split("</")[0];
}
String[] attachs = projectConfig.split(moduleList[i] + "\\.attachUploadUrl\">");
if (attachs.length > 1) {
attachUpload = attachs[1].split("</")[0];
}
break;
}
}
} break; 是在if 中的 ,这里的意思是,当前文件路径是否含有多模块配置中的名称,是就取当前模块的配置,然后跳出循环,这就取到配置后就可以上传接口了 2 、我的问题 多模块样式,项目结构
这种类似的多模式开发,每个模块都是单独的,这样我会在.idea的对应xml配置配置四个模块配置,如下
这时我的模块demo-biz有controller,demo-biz-function模块也有controller
这个判断就会直接获取demo-biz模块的配置,而不是demo-biz-function模块的配置 |
我上面说的是旧代码的问题,现在发现最新代码被重构了 |
版本号
最新版本
什么问题
多模块中一个模块名是另一个模块名的前缀上传接口读取配置错误
如何复现此问题
例如:有cloud和cloud-web两个模块需要上传接口, 配置如下:
这时cloud-web要上传接口时读取的配置是cloud的配置
问题所在的源码
UploadToYapi
类actionPerformed
方法接口定义 (如果可以的话,请上传请求对象和响应对象)
~
idea 版本
The text was updated successfully, but these errors were encountered: