|
@@ -1,6 +1,7 @@
|
|
|
using DocTools.Entity;
|
|
|
using DocTools.Entity.Doc;
|
|
|
using DocTools.Helper;
|
|
|
+using Newtonsoft.Json;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -284,7 +285,7 @@ namespace DocTools
|
|
|
type = "Text",
|
|
|
field_type = "String",
|
|
|
value = "Upload Fail"
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
success = new ResponseResultEntity()
|
|
@@ -309,15 +310,17 @@ namespace DocTools
|
|
|
type = "Text",
|
|
|
field_type = "String",
|
|
|
value = ""
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
var fileInfo = methodEntity.RequestList?.FirstOrDefault()?.ParamPropertyList?.Find(c => c.Name == "File") ?? new ParamPropertyEntity();
|
|
|
var dafultFieldType = CommonHelper.GetJsonDataTypeByString(fileInfo.TypeFullName);
|
|
|
- var requestBodyEntity = new RequestBodyEntity()
|
|
|
+ var requestBodyEntity = new RequestBodyEntity();
|
|
|
+
|
|
|
+ requestBodyEntity = new RequestBodyEntity()
|
|
|
{
|
|
|
- mode = "form-data",
|
|
|
+ mode = "byte",
|
|
|
parameter = new List<ResponseParameterEntity>()
|
|
|
{
|
|
|
new ResponseParameterEntity()
|
|
@@ -334,6 +337,7 @@ namespace DocTools
|
|
|
raw = "",
|
|
|
raw_para = new List<ResponseParameterEntity>()
|
|
|
};
|
|
|
+
|
|
|
var headerParameterRequest = new List<object>();
|
|
|
var headerParamList = methodEntity.RequestList?.FirstOrDefault()?.ParamPropertyList?.FindAll(c => c.Name != "File") ?? new List<ParamPropertyEntity>();
|
|
|
if (headerParamList?.Count > 0)
|
|
@@ -358,7 +362,7 @@ namespace DocTools
|
|
|
};
|
|
|
childEntity.request = new RequestEntity()
|
|
|
{
|
|
|
- url = url + "存储桶地址/文件名【此请求地址为动态地址,实际值为上传文件权鉴接口返回的StorageUrl字段的值】",
|
|
|
+ url = url + "文件名【此请求地址为动态地址,实际值为上传文件权鉴接口返回的StorageUrl字段的值】",
|
|
|
resful = new RequestParameterEntity(),
|
|
|
query = new RequestParameterEntity(),
|
|
|
header = headerRequest,
|
|
@@ -449,13 +453,10 @@ namespace DocTools
|
|
|
error_result = new List<ExceptionResultEntity>()
|
|
|
};
|
|
|
//计算响应列表枚举
|
|
|
- if (methodEntity.ParaList?.Count > 0)
|
|
|
+ if (!string.IsNullOrEmpty(methodEntity.ErrorCodes))
|
|
|
{
|
|
|
- foreach (var item in methodEntity.ParaList)
|
|
|
- {
|
|
|
- var gere = GetExceptionResultEnum(item);
|
|
|
- successParameter.error_result.Add(gere);
|
|
|
- }
|
|
|
+ var gere = GetExceptionResultEnum(methodEntity.ErrorCodes);
|
|
|
+ successParameter.error_result.Add(gere);
|
|
|
}
|
|
|
var rawResultStr = "";
|
|
|
if (methodEntity.ResponseList?.Count > 0)
|
|
@@ -946,31 +947,50 @@ namespace DocTools
|
|
|
{
|
|
|
var resultEntity = new ExceptionResultEntity();
|
|
|
List<MemberEntity> memberList = LoadData.GetInterfaceConfigToCache();
|
|
|
- var enumInfo = memberList.Find(c => c.ParamName.Contains("T:WingInterfaceLibrary.Enum.RpcExceptionEnum." + enumNamespace) && !string.IsNullOrEmpty(c.Remarks));
|
|
|
+ var enumInfo = memberList.Find(c => c.ParamName.Contains("T:WingInterfaceLibrary.Enum.CustomerRpcCode") && !string.IsNullOrEmpty(c.Remarks));
|
|
|
if (enumInfo != null)
|
|
|
{
|
|
|
- //获取错误枚举、上传文件类型枚举
|
|
|
- var enumList = memberList.FindAll(c => c.ParamName.Contains(enumInfo.ParamName.Replace("T:", "")));
|
|
|
- if (enumList?.Count > 0)
|
|
|
+ var key = enumInfo.ParamName.Replace("T:", "");
|
|
|
+ resultEntity.title = enumInfo.Summary;
|
|
|
+ resultEntity.name = enumInfo.Summary;
|
|
|
+ resultEntity.url = "/" + FileName + "#" + PublicEnumDic[key];
|
|
|
+ resultEntity.header = enumInfo.Remarks.Split('|').ToArray().Select(c => c.Trim()).ToList();
|
|
|
+
|
|
|
+ if (enumNamespace.Split(',').Length > 0)
|
|
|
{
|
|
|
- foreach (var item in enumList)
|
|
|
+ for (var i = 0; i < enumNamespace.Split(',').Length; i++)
|
|
|
{
|
|
|
- if (item.ParamName.Equals(enumInfo.ParamName))
|
|
|
- {
|
|
|
- //title,name,和header
|
|
|
- resultEntity.title = item.Summary;
|
|
|
- resultEntity.name = enumNamespace;
|
|
|
- resultEntity.header = item.Remarks.Split('|').ToArray().Select(c => c.Trim()).ToList();
|
|
|
- }
|
|
|
- else
|
|
|
+ var item = enumNamespace.Split(',')[i];
|
|
|
+ if (!string.IsNullOrEmpty(item) && item.Split('|').Length > 2)
|
|
|
{
|
|
|
var ece = new ExceptionContentEntity();
|
|
|
- ece.content_data = item.Summary.Split('|').ToArray().Select(c => c.Trim()).ToList();
|
|
|
- //content
|
|
|
+ ece.content_data = item.Split('|').ToArray().Select(c => c.Trim()).ToList();
|
|
|
resultEntity.content.Add(ece);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ ////获取错误枚举、上传文件类型枚举
|
|
|
+ //var enumList = memberList.FindAll(c => c.ParamName.Contains(enumInfo.ParamName.Replace("T:", "")));
|
|
|
+ //if (enumList?.Count > 0)
|
|
|
+ //{
|
|
|
+ // foreach (var item in enumList)
|
|
|
+ // {
|
|
|
+ // if (item.ParamName.Equals(enumInfo.ParamName))
|
|
|
+ // {
|
|
|
+ // //title,name,和header
|
|
|
+ // resultEntity.title = item.Summary;
|
|
|
+ // resultEntity.name = enumNamespace;
|
|
|
+ // resultEntity.header = item.Remarks.Split('|').ToArray().Select(c => c.Trim()).ToList();
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // var ece = new ExceptionContentEntity();
|
|
|
+ // ece.content_data = item.Summary.Split('|').ToArray().Select(c => c.Trim()).ToList();
|
|
|
+ // //content
|
|
|
+ // resultEntity.content.Add(ece);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
return resultEntity;
|
|
|
}
|
|
@@ -985,13 +1005,28 @@ namespace DocTools
|
|
|
/// <returns>封装好的实体</returns>
|
|
|
public ChildrenEntity GetSpecialEnum(string enumNamespace, string local_target_id, string formatterDesc = "代码 | 错误描述", int index = 0)
|
|
|
{
|
|
|
+ var strTable = "";
|
|
|
var enumName = string.Empty;
|
|
|
- var errorEnumStr = string.Empty;
|
|
|
List<MemberEntity> memberList = LoadData.GetInterfaceConfigToCache();
|
|
|
//获取错误枚举、上传文件类型枚举
|
|
|
var enumList = memberList.FindAll(c => c.ParamName.Contains(enumNamespace));
|
|
|
if (enumList?.Count > 0)
|
|
|
{
|
|
|
+ strTable = "<table>";
|
|
|
+ if (!string.IsNullOrEmpty(formatterDesc))
|
|
|
+ {
|
|
|
+ var headerList = formatterDesc.Split('|');
|
|
|
+ if (headerList?.Length > 1)
|
|
|
+ {
|
|
|
+ strTable += "<thead><tr>";
|
|
|
+ foreach (var headItem in headerList)
|
|
|
+ {
|
|
|
+ strTable += "<th>" + headItem.Trim() + "</th>";
|
|
|
+ }
|
|
|
+ strTable += "</tr></thead>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ strTable += "<tbody>";
|
|
|
foreach (var item in enumList)
|
|
|
{
|
|
|
if (item.ParamName.Equals("T:" + enumNamespace))
|
|
@@ -1000,9 +1035,22 @@ namespace DocTools
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- errorEnumStr += "\n" + item.Summary;
|
|
|
+ if (!string.IsNullOrEmpty(item.Summary))
|
|
|
+ {
|
|
|
+ var bodyList = item.Summary.Split('|');
|
|
|
+ if (bodyList?.Length > 1)
|
|
|
+ {
|
|
|
+ strTable += "<tr>";
|
|
|
+ foreach (var bodyItem in bodyList)
|
|
|
+ {
|
|
|
+ strTable += "<td>" + bodyItem.Trim() + "</td>";
|
|
|
+ }
|
|
|
+ strTable += "</tr>";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ strTable += "</tbody></table>";
|
|
|
}
|
|
|
var errorEntity = new ChildrenEntity()
|
|
|
{
|
|
@@ -1033,11 +1081,13 @@ namespace DocTools
|
|
|
request = new RequestEntity()
|
|
|
{
|
|
|
url = "",
|
|
|
+ requestId = Guid.NewGuid().ToString(),
|
|
|
resful = new RequestParameterEntity(),
|
|
|
query = new RequestParameterEntity(),
|
|
|
header = new RequestParameterEntity(),
|
|
|
Event = new ScriptEntity(),
|
|
|
- description = formatterDesc + "\n--- | ---" + errorEnumStr,
|
|
|
+ //description = formatterDesc + "\n--- | ---" + errorEnumStr,
|
|
|
+ description = strTable,
|
|
|
cookie = new RequestParameterEntity(),
|
|
|
body = new RequestBodyEntity()
|
|
|
{
|