|
|
@@ -59,8 +59,16 @@ namespace Tasks
|
|
|
//解析模板内容
|
|
|
string resultString = Util.Maker.StartMake(jsonObj["data"], templateString);
|
|
|
resultString = Util.Maker.replaceKeyToValue(jsonObj["data"], resultString);
|
|
|
- int serviceId = int.Parse(jsonObj["data"]["projectService"]["id"].ToString());
|
|
|
- int projectId = int.Parse(jsonObj["data"]["projectService"]["projectId"].ToString());
|
|
|
+ int serviceId = 0;
|
|
|
+ if(content.Contains("\"projectService\""))
|
|
|
+ {
|
|
|
+ serviceId = int.Parse(jsonObj["data"]["projectService"]["id"].ToString());
|
|
|
+ }
|
|
|
+ int projectId = 0;
|
|
|
+ if(content.Contains("\"projectService\""))
|
|
|
+ {
|
|
|
+ projectId = int.Parse(jsonObj["data"]["projectService"]["projectId"].ToString());
|
|
|
+ }
|
|
|
int javaVersion = codeVersion(serviceId, versionNo);
|
|
|
//生成文件
|
|
|
string path = template.makePath.Substring(0, template.makePath.LastIndexOf("/") + 1);
|
|
|
@@ -70,7 +78,10 @@ namespace Tasks
|
|
|
Function.WritePage(path, fileName, resultString);
|
|
|
string startPath = Function.getPath(path + fileName);
|
|
|
OssHelper.Instance.Upload(startPath);
|
|
|
- addFile(projectId, serviceId, int.Parse(Function.CheckInt(userId)), versionNo, fileName, path + fileName, path + fileName, fileType, javaVersion, "java");
|
|
|
+ if(serviceId > 0 && projectId > 0)
|
|
|
+ {
|
|
|
+ addFile(projectId, serviceId, int.Parse(Function.CheckInt(userId)), versionNo, fileName, path + fileName, path + fileName, fileType, javaVersion, "java");
|
|
|
+ }
|
|
|
//生成数据入库
|
|
|
int dataId = int.Parse(Function.CheckInt(attach["dataId"].ToString()));
|
|
|
string makeFileType = attach["fileType"].ToString();
|