Skip to content

Commit 1fb1a59

Browse files
authored
Merge pull request liaozb#1 from liaozb/master
同步代码
2 parents b6eb3ab + 54e893e commit 1fb1a59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+13316
-406
lines changed

APIJSON.NET.zip

1.74 MB
Binary file not shown.

APIJSON.NET/1.png

24.9 KB
Loading

APIJSON.NET/2.png

23.4 KB
Loading

APIJSON.NET/3.png

10.5 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="RestSharp" Version="106.3.1" />
10+
</ItemGroup>
11+
12+
</Project>
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using RestSharp;
2+
using System;
3+
4+
namespace APIJSON.NET.Test
5+
{
6+
class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
var client = new RestClient("http://localhost:5000/");
11+
12+
var login = new RestRequest("token", Method.POST);
13+
login.AddJsonBody(new TokenInput() { username = "admin1", password = "123456" });
14+
IRestResponse<TokenData> token = client.Execute<TokenData>(login);
15+
16+
Console.WriteLine(token.Data.data.AccessToken);
17+
18+
var request = new RestRequest("get", Method.POST);
19+
request.AddHeader("Content-Type", "application/json");
20+
request.AddHeader("Authorization", "Bearer " + token.Data.data.AccessToken);
21+
request.AddJsonBody(@"{
22+
'User': {
23+
'id': 38710
24+
}
25+
}
26+
");
27+
IRestResponse response = client.Execute(request);
28+
Console.WriteLine(response.Content);
29+
30+
31+
32+
33+
Console.ReadLine();
34+
}
35+
}
36+
public class TokenInput
37+
{
38+
public string username { get; set; }
39+
public string password { get; set; }
40+
}
41+
public class TokenData
42+
{
43+
public AuthenticateResultModel data { get; set; }
44+
}
45+
public class AuthenticateResultModel
46+
{
47+
public string AccessToken { get; set; }
48+
49+
public int ExpireInSeconds { get; set; }
50+
51+
52+
}
53+
}

APIJSON.NET/APIJSON.NET.sln

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27703.2035
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIJSON.NET", "APIJSON.NET\APIJSON.NET.csproj", "{FF647576-A104-4D54-954D-3547B4FDCDB2}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIJSON.NET", "APIJSON.NET\APIJSON.NET.csproj", "{FF647576-A104-4D54-954D-3547B4FDCDB2}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIJSON.NET.Test", "APIJSON.NET.Test\APIJSON.NET.Test.csproj", "{0828346E-207E-49F8-AD57-E1AB6B6E4077}"
79
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
1517
{FF647576-A104-4D54-954D-3547B4FDCDB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{FF647576-A104-4D54-954D-3547B4FDCDB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{FF647576-A104-4D54-954D-3547B4FDCDB2}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj

+12-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,27 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<Folder Include="wwwroot\" />
8+
<None Remove="Dockerfile" />
99
</ItemGroup>
1010

1111
<ItemGroup>
12+
<Content Include="Dockerfile">
13+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
14+
</Content>
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<PackageReference Include="AspectCore.Extensions.Reflection" Version="0.7.0" />
1219
<PackageReference Include="Microsoft.AspNetCore.App" />
13-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.0" />
20+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
1421
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0" />
1522
<PackageReference Include="MySql.Data" Version="8.0.11" />
1623
<PackageReference Include="sqlSugarCore" Version="4.6.4.9" />
1724
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
25+
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="3.0.0" />
1826
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="3.0.0" />
1927
</ItemGroup>
2028

29+
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JSONSchema="http://json.schemastore.org/config" /></VisualStudio></ProjectExtensions>
30+
2131
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace APIJSON.NET.Controllers
8+
{
9+
public class HomeController : Controller
10+
{
11+
public IActionResult Index()
12+
{
13+
return Redirect("index.html");
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)