|
@@ -100,7 +100,8 @@ namespace DocTools
|
|
|
body = new List<NullParameterEntity>(),
|
|
|
header = new List<NullParameterEntity>(),
|
|
|
query = new List<NullParameterEntity>(),
|
|
|
- description = "新版杏聆荟RPC接口文档"
|
|
|
+ //description = "新版杏聆荟RPC接口文档"
|
|
|
+ description = null
|
|
|
};
|
|
|
customerAPI.children = GetCustomerChildrenList(customerAPI, apiModuleList[i]);
|
|
|
resultList.Add(customerAPI);
|
|
@@ -108,7 +109,22 @@ namespace DocTools
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ private string CreateFolderHtml(Dictionary<string, string> dic,string apiName)
|
|
|
+ {
|
|
|
+ string allHtml = "";
|
|
|
+ if (dic?.Count > 0)
|
|
|
+ {
|
|
|
+ allHtml = "<div style=\"overflow: hidden;height: 100%;\" class=\"preview-markdown\"><h3 class=\"title\"><a href=\"javascript:;\" class=\"maodian\"></a>" + apiName + "下属服务<i class=\"fa fa-angle-down\"></i></h3>";
|
|
|
+ var tableHtml = "<table><tbody><tr><th>服务名</th><th>查看详情</th></tr>";
|
|
|
+ foreach (var key in dic.Keys)
|
|
|
+ {
|
|
|
+ tableHtml += "<tr><td>" + key + "</td><td><a target=\"_blank\" href=\"/" + FileName + "#" + dic[key] + "\">详情</a></td></tr>";
|
|
|
+ }
|
|
|
+ tableHtml += "</tbody></table>";
|
|
|
+ allHtml += tableHtml + "</div>";
|
|
|
+ }
|
|
|
+ return allHtml;
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 客户端api接口
|
|
@@ -116,9 +132,11 @@ namespace DocTools
|
|
|
/// <returns></returns>
|
|
|
public List<object> GetCustomerChildrenList(FolderChildrenEntity customerAPI, APIModuleEntity apiModuleEntity)
|
|
|
{
|
|
|
+ var dic = new Dictionary<string, string>();
|
|
|
var list = new List<object>();
|
|
|
if (apiModuleEntity.IsShowEnumFolder)
|
|
|
{
|
|
|
+ var dicEnum = new Dictionary<string, string>();
|
|
|
FolderChildrenEntity enumFolderEntity = new FolderChildrenEntity();
|
|
|
enumFolderEntity.is_doc = "0";
|
|
|
enumFolderEntity.local_parent_id = customerAPI.local_target_id;
|
|
@@ -144,8 +162,11 @@ namespace DocTools
|
|
|
}
|
|
|
var enumEntity = GetSpecialEnum(item.ParamName.Replace("T:", ""), enumFolderEntity.local_target_id, item.Remarks, i);
|
|
|
enumFolderEntity.children.Add(enumEntity);
|
|
|
+ dicEnum.Add(enumEntity.name, enumEntity.local_target_id);
|
|
|
}
|
|
|
+ enumFolderEntity.tableHtml = CreateFolderHtml(dicEnum, enumFolderEntity.name);
|
|
|
list.Add(enumFolderEntity);
|
|
|
+ dic.Add(enumFolderEntity.name, enumFolderEntity.local_target_id);
|
|
|
}
|
|
|
//定义api下属文件夹
|
|
|
//这里可以是多个文件夹
|
|
@@ -169,7 +190,9 @@ namespace DocTools
|
|
|
folderEntity.request = new FoldRequestEntity();
|
|
|
folderEntity.children = GetInterfaceChildrenList(folderEntity, interfaceItem.Url, interfaceItem.InterfaceList);
|
|
|
list.Add(folderEntity);
|
|
|
+ dic.Add(folderEntity.name, folderEntity.local_target_id);
|
|
|
}
|
|
|
+ customerAPI.tableHtml = CreateFolderHtml(dic, customerAPI.name);
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -179,10 +202,12 @@ namespace DocTools
|
|
|
/// <returns></returns>
|
|
|
public List<object> GetInterfaceChildrenList(FolderChildrenEntity folderEntity, string url, List<InterfaceBasicInfoEntity> interfaceList)
|
|
|
{
|
|
|
+ var dicInterface = new Dictionary<string, string>();
|
|
|
var exclusiveList = new List<string>() { "IClientLogService", "IEmailService", "ISMSService" };
|
|
|
List<object> resultList = new List<object>();
|
|
|
for (int i = 0; i < interfaceList.Count; i++)
|
|
|
{
|
|
|
+ var dicMethod = new Dictionary<string, string>();
|
|
|
var interfaceEntity = interfaceList[i];
|
|
|
if (exclusiveList.Contains(interfaceEntity.InterfaceName))
|
|
|
{
|
|
@@ -211,7 +236,7 @@ namespace DocTools
|
|
|
childEntity.is_doc = "0";
|
|
|
childEntity.index = 5;
|
|
|
childEntity.local_parent_id = folderChildEntity.local_target_id;
|
|
|
- childEntity.local_target_id = folderChildEntity.local_target_id + "-" + i;
|
|
|
+ childEntity.local_target_id = Guid.NewGuid().ToString();
|
|
|
childEntity.mark = "complated";
|
|
|
childEntity.method = methodEntity.SubmitType;
|
|
|
childEntity.name = methodEntity.Summary;
|
|
@@ -276,6 +301,7 @@ namespace DocTools
|
|
|
}
|
|
|
};
|
|
|
var fileInfo = methodEntity.RequestList?.FirstOrDefault()?.ParamPropertyList?.Find(c => c.Name == "File") ?? new ParamPropertyEntity();
|
|
|
+ var dafultFieldType = CommonHelper.GetJsonDataTypeByString(fileInfo.TypeFullName);
|
|
|
var requestBodyEntity = new RequestBodyEntity()
|
|
|
{
|
|
|
mode = "form-data",
|
|
@@ -286,9 +312,9 @@ namespace DocTools
|
|
|
description = fileInfo.Desc,
|
|
|
is_checked = 1,
|
|
|
key = fileInfo.Name,
|
|
|
- type = fileInfo.TypeFullName,
|
|
|
+ type = dafultFieldType,
|
|
|
not_null = "1",
|
|
|
- field_type = "",
|
|
|
+ field_type = dafultFieldType,
|
|
|
value = fileInfo.DefaultValue
|
|
|
}
|
|
|
},
|
|
@@ -508,7 +534,7 @@ namespace DocTools
|
|
|
not_null = "1",
|
|
|
type = "Text",
|
|
|
field_type = "Array",
|
|
|
- value = methodEntity.ParamText
|
|
|
+ value = ""//methodEntity.ParamText
|
|
|
};
|
|
|
requestRawPara.Add(paramObject);
|
|
|
if (methodEntity.RequestList?.Count > 0)
|
|
@@ -553,9 +579,13 @@ namespace DocTools
|
|
|
};
|
|
|
}
|
|
|
folderChildEntity.children.Add(childEntity);
|
|
|
+ dicMethod.Add(childEntity.name, childEntity.local_target_id);
|
|
|
}
|
|
|
+ folderChildEntity.tableHtml = CreateFolderHtml(dicMethod, folderChildEntity.name);
|
|
|
resultList.Add(folderChildEntity);
|
|
|
+ dicInterface.Add(folderChildEntity.name, folderChildEntity.local_target_id);
|
|
|
}
|
|
|
+ folderEntity.tableHtml = CreateFolderHtml(dicInterface, folderEntity.name);
|
|
|
return resultList;
|
|
|
}
|
|
|
|