feat: 集成支付宝支付SDK并添加当面付测试调用,更新CORS配置支持capacitor
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\common.props" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlipayEasySDK" Version="2.1.3" />
|
||||
<PackageReference Include="Azure.AI.OpenAI" Version="2.2.0-beta.4" />
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="$(AbpVersion)" />
|
||||
<PackageReference Include="Volo.Abp.DistributedLocking" Version="$(AbpVersion)" />
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
using Alipay.EasySDK.Factory;
|
||||
using Alipay.EasySDK.Kernel;
|
||||
using Alipay.EasySDK.Kernel.Util;
|
||||
using Alipay.EasySDK.Payment.FaceToFace.Models;
|
||||
using Dm.util;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Volo.Abp.Domain;
|
||||
using Yi.Framework.AiHub.Domain.AiGateWay;
|
||||
@@ -37,16 +42,14 @@ namespace Yi.Framework.AiHub.Domain
|
||||
nameof(AzureOpenAIServiceImageService));
|
||||
|
||||
|
||||
services.AddKeyedTransient<ITextEmbeddingService, SiliconFlowTextEmbeddingService>(nameof(SiliconFlowTextEmbeddingService));
|
||||
|
||||
services.AddKeyedTransient<ITextEmbeddingService, SiliconFlowTextEmbeddingService>(
|
||||
nameof(SiliconFlowTextEmbeddingService));
|
||||
|
||||
//ai模型特殊性兼容处理
|
||||
Configure<SpecialCompatibleOptions>(options =>
|
||||
{
|
||||
options.Handles.add(request =>
|
||||
{
|
||||
request.CompatibleCodeCompletion();
|
||||
});
|
||||
|
||||
options.Handles.add(request => { request.CompatibleCodeCompletion(); });
|
||||
|
||||
options.Handles.Add(request =>
|
||||
{
|
||||
if (request.Model == "o1")
|
||||
@@ -74,11 +77,35 @@ namespace Yi.Framework.AiHub.Domain
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//配置支付宝支付
|
||||
var config = configuration.GetSection("Alipay").Get<Config>();
|
||||
Factory.SetOptions(config);
|
||||
}
|
||||
|
||||
public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
|
||||
{
|
||||
var service = context.ServiceProvider;
|
||||
try
|
||||
{
|
||||
// 2. 发起API调用(以创建当面付收款二维码为例)
|
||||
var response = Factory.Payment.Page()
|
||||
.Pay("YiXin Ai Vip", "2234567234891", "0.01","https://ccnetcore.com/pay/Alipay/test");
|
||||
// 3. 处理响应或异常
|
||||
if (ResponseChecker.Success(response))
|
||||
{
|
||||
Console.WriteLine("调用成功");
|
||||
Console.WriteLine(response.Body);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("调用失败,原因:" + response.Body);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("调用遭遇异常,原因:" + ex.Message);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
//应用启动
|
||||
"App": {
|
||||
"SelfUrl": "http://*:19001",
|
||||
"CorsOrigins": "http://localhost:19001;http://localhost:18000;vscode-file://vscode-app;https://web.chatboxai.app"
|
||||
"CorsOrigins": "http://localhost:19001;http://localhost:18000;vscode-file://vscode-app;https://web.chatboxai.app;capacitor://localhost"
|
||||
},
|
||||
//配置
|
||||
"Settings": {
|
||||
|
||||
Reference in New Issue
Block a user