Blame view

Yi.Abp.Net8/client/Yi.Abp.Client.Console/Program.cs 922 Bytes
7cb07aab   “wangming”   Update default ad...
1
  using Microsoft.Extensions.DependencyInjection;
515fceeb   “wangming”   框架初始化
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  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();
  
      //登录
7cb07aab   “wangming”   Update default ad...
23
      var data2 = await account.PostLoginAsync(new Yi.Framework.Rbac.Application.Contracts.Dtos.Account.LoginInputVo { UserName = "admin", Password = "123456", Code = string.Empty, Uuid = string.Empty });
515fceeb   “wangming”   框架初始化
24
25
26
27
28
29
30
31
32
33
  
  
      host.Run();
  
  }
  catch (Exception ex)
  {
      Console.WriteLine(ex.Message);
      Console.WriteLine(ex.StackTrace);
  }