Skip to content

同步代码 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added APIJSON.NET.zip
Binary file not shown.
Binary file added APIJSON.NET/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added APIJSON.NET/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added APIJSON.NET/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions APIJSON.NET/APIJSON.NET.Test/APIJSON.NET.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="RestSharp" Version="106.3.1" />
</ItemGroup>

</Project>
53 changes: 53 additions & 0 deletions APIJSON.NET/APIJSON.NET.Test/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using RestSharp;
using System;

namespace APIJSON.NET.Test
{
class Program
{
static void Main(string[] args)
{
var client = new RestClient("http://localhost:5000/");

var login = new RestRequest("token", Method.POST);
login.AddJsonBody(new TokenInput() { username = "admin1", password = "123456" });
IRestResponse<TokenData> token = client.Execute<TokenData>(login);

Console.WriteLine(token.Data.data.AccessToken);

var request = new RestRequest("get", Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer " + token.Data.data.AccessToken);
request.AddJsonBody(@"{
'User': {
'id': 38710
}
}
");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);




Console.ReadLine();
}
}
public class TokenInput
{
public string username { get; set; }
public string password { get; set; }
}
public class TokenData
{
public AuthenticateResultModel data { get; set; }
}
public class AuthenticateResultModel
{
public string AccessToken { get; set; }

public int ExpireInSeconds { get; set; }


}
}
8 changes: 7 additions & 1 deletion APIJSON.NET/APIJSON.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIJSON.NET", "APIJSON.NET\APIJSON.NET.csproj", "{FF647576-A104-4D54-954D-3547B4FDCDB2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIJSON.NET", "APIJSON.NET\APIJSON.NET.csproj", "{FF647576-A104-4D54-954D-3547B4FDCDB2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APIJSON.NET.Test", "APIJSON.NET.Test\APIJSON.NET.Test.csproj", "{0828346E-207E-49F8-AD57-E1AB6B6E4077}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +17,10 @@ Global
{FF647576-A104-4D54-954D-3547B4FDCDB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF647576-A104-4D54-954D-3547B4FDCDB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF647576-A104-4D54-954D-3547B4FDCDB2}.Release|Any CPU.Build.0 = Release|Any CPU
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0828346E-207E-49F8-AD57-E1AB6B6E4077}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 12 additions & 2 deletions APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
<None Remove="Dockerfile" />
</ItemGroup>

<ItemGroup>
<Content Include="Dockerfile">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="AspectCore.Extensions.Reflection" Version="0.7.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0" />
<PackageReference Include="MySql.Data" Version="8.0.11" />
<PackageReference Include="sqlSugarCore" Version="4.6.4.9" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="3.0.0" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JSONSchema="http://json.schemastore.org/config" /></VisualStudio></ProjectExtensions>

</Project>
16 changes: 16 additions & 0 deletions APIJSON.NET/APIJSON.NET/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace APIJSON.NET.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return Redirect("index.html");
}
}
}
Loading