feat: 添加客户端代理层
This commit is contained in:
33
Yi.Abp.Net8/client/Yi.Abp.Client.Console/Program.cs
Normal file
33
Yi.Abp.Net8/client/Yi.Abp.Client.Console/Program.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Yi.Abp.Client.Console;
|
||||
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||
|
||||
try
|
||||
{
|
||||
IHost host = Host.CreateDefaultBuilder()
|
||||
.ConfigureServices(async (host, service) =>
|
||||
{
|
||||
await service.AddApplicationAsync<YiAbpClientConsoleModule>();
|
||||
})
|
||||
.UseAutofac()
|
||||
.Build();
|
||||
|
||||
//控制台直接调用
|
||||
var account = host.Services.GetRequiredService<IAccountService>();
|
||||
|
||||
//获取验证码
|
||||
var data1 = await account.GetCaptchaImageAsync();
|
||||
|
||||
//登录
|
||||
var data2 = await account.PostLoginAsync(new Yi.Framework.Rbac.Application.Contracts.Dtos.Account.LoginInputVo { UserName = "cc", Password = "123456", Code = string.Empty, Uuid = string.Empty });
|
||||
|
||||
|
||||
host.Run();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine(ex.StackTrace);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="8.0.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Abp.HttpApi.Client\Yi.Abp.HttpApi.Client.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Modularity;
|
||||
using Yi.Abp.HttpApi.Client;
|
||||
|
||||
namespace Yi.Abp.Client.Console
|
||||
{
|
||||
[DependsOn(typeof(YiAbpHttpApiClientModule))]
|
||||
public class YiAbpClientConsoleModule:AbpModule
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user