feat(tenpayv2): 新增部分接口

This commit is contained in:
RHQYZ
2022-01-25 13:24:49 +08:00
committed by GitHub
parent 122cd5186c
commit 6458d08381
234 changed files with 11734 additions and 891 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
@@ -154,14 +155,13 @@ namespace SKIT.FlurlHttpClient.Wechat
var lstModelType = TestReflectionUtil.GetAllApiModelsTypes(assembly);
var lstError = new List<Exception>();
foreach (Type modelType in lstModelType)
Parallel.ForEach(lstModelType, (modelType) =>
{
string name = modelType.Name.Split('`')[0];
if (!name.EndsWith("Request") && !name.EndsWith("Response"))
{
lstError.Add(new Exception($"[模型] `{name}` 类名结尾应为 \"Request\" 或 \"Response\"。"));
continue;
}
if (name.EndsWith("Request"))
@@ -169,13 +169,11 @@ namespace SKIT.FlurlHttpClient.Wechat
if (!typeof(ICommonRequest).IsAssignableFrom(modelType))
{
lstError.Add(new Exception($"[模型] `{name}` 是请求模型,需实现自 `{nameof(ICommonRequest)}`。"));
continue;
}
if (!lstModelType.Any(e => e.Name == $"{name.Substring(0, name.Length - "Request".Length)}Response"))
{
lstError.Add(new Exception($"[模型] `{name}` 是请求模型,但不存在对应的响应模型。"));
continue;
}
}
@@ -184,16 +182,14 @@ namespace SKIT.FlurlHttpClient.Wechat
if (!typeof(ICommonResponse).IsAssignableFrom(modelType))
{
lstError.Add(new Exception($"[模型] `{name}` 是响应模型,需实现自 `{nameof(ICommonResponse)}`。"));
continue;
}
if (!lstModelType.Any(e => e.Name == $"{name.Substring(0, name.Length - "Response".Length)}Request"))
{
lstError.Add(new Exception($"[模型] `{name}` 是响应模型,但不存在对应的请求模型。"));
continue;
}
}
}
});
if (lstError.Any())
{
@@ -221,7 +217,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(new Exception($"[模型] \"{workdir}\" 下不存在示例文件,请检查配置的扫描路径是否正确。"));
}
foreach (string filePath in lstFilePath)
Parallel.ForEach(lstFilePath, (filePath) =>
{
string name = Path.GetFileNameWithoutExtension(filePath).Split('.')[0];
@@ -229,7 +225,7 @@ namespace SKIT.FlurlHttpClient.Wechat
if (type == null)
{
lstError.Add(new Exception($"[模型] 扫描到示例文件 \"{filePath}\",但类型 `{name}` 不存在。"));
continue;
return;
}
if (string.Equals(Path.GetExtension(filePath), ".json", StringComparison.OrdinalIgnoreCase))
@@ -240,7 +236,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(ex);
}
}
}
});
if (lstError.Any())
{
@@ -271,7 +267,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(new Exception($"[模型] \"{workdir}\" 下不存在示例文件,请检查配置的扫描路径是否正确。"));
}
foreach (string filePath in lstFilePath)
Parallel.ForEach(lstFilePath, (filePath) =>
{
string name = Path.GetFileNameWithoutExtension(filePath).Split('.')[0];
@@ -279,7 +275,7 @@ namespace SKIT.FlurlHttpClient.Wechat
if (type == null)
{
lstError.Add(new Exception($"[模型] 扫描到示例文件 \"{filePath}\",但类型 `{name}` 不存在。"));
continue;
return;
}
if (string.Equals(Path.GetExtension(filePath), ".json", StringComparison.OrdinalIgnoreCase))
@@ -300,7 +296,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(ex);
}
}
}
});
if (lstError.Any())
{
@@ -319,7 +315,7 @@ namespace SKIT.FlurlHttpClient.Wechat
var lstExtType = TestReflectionUtil.GetAllApiExtensionsTypes(assembly);
var lstError = new List<Exception>();
foreach (Type extensionsType in lstExtType)
Parallel.ForEach(lstExtType, (extensionsType) =>
{
MethodInfo[] lstMethod = extensionsType.GetMethods()
.Where(e =>
@@ -372,7 +368,7 @@ namespace SKIT.FlurlHttpClient.Wechat
continue;
}
}
}
});
if (lstError.Any())
{
@@ -406,7 +402,7 @@ namespace SKIT.FlurlHttpClient.Wechat
lstError.Add(new Exception($"[风格] \"{workdir}\" 下不存在源代码文件,请检查配置的扫描路径是否正确。"));
}
foreach (string extCodeFilePath in lstExtensionsCodeFile)
Parallel.ForEach(lstExtensionsCodeFile, (extCodeFilePath) =>
{
string extCodeFileName = Path.GetFileName(extCodeFilePath);
@@ -676,7 +672,7 @@ namespace SKIT.FlurlHttpClient.Wechat
}
}
}
}
});
if (lstError.Any())
{