Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd1f3db

Browse files
committed
#运行错误修复#
1 parent f80ed27 commit bd1f3db

File tree

6 files changed

+16
-19
lines changed

6 files changed

+16
-19
lines changed

‎APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ public ActionResult Add([FromBody]JObject jobject)
134134
ht.Add("msg", "success");
135135
try
136136
{
137-
138-
139-
140137
foreach (var item in jobject)
141138
{
142139
string key = item.Key.Trim();

‎APIJSON.NET/APIJSON.NET/Data/DbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using APIJSON.NET.Models;
1+
using APIJSON.NET.Data.Models;
22
using Microsoft.Extensions.Configuration;
33
using Microsoft.Extensions.Options;
44
using SqlSugar;

‎APIJSON.NET/APIJSON.NET/Data/DbInit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using APIJSON.NET.Models;
1+
using APIJSON.NET.Data.Models;
22
using Microsoft.AspNetCore.Builder;
33
using Microsoft.Extensions.DependencyInjection;
44
using SqlSugar;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
using SqlSugar;
22
using System;
33

4-
namespace APIJSON.NET.Models
4+
namespace APIJSON.NET.Data.Models
55
{
66
public class Login
77
{
88
[SugarColumn(IsNullable = false, IsPrimaryKey = true)]
99
public int userId { get; set; }
10-
[SugarColumn(Length =100,ColumnDescription ="用户名")]
10+
[SugarColumn(Length =100,ColumnDescription ="用户名")]
1111
public string userName { get; set; }
1212
[SugarColumn(Length = 200, ColumnDescription = "密码")]
1313
public string passWord { get; set; }
1414
[SugarColumn(Length = 100, ColumnDescription = "密码盐")]
1515
public string passWordSalt { get; set; }
1616
[SugarColumn(Length = 100, ColumnDescription = "权限组")]
1717
public string roleCode { get; set; }
18-
18+
1919
}
2020
}

‎APIJSON.NET/APIJSON.NET/Program.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
// Add services to the container.
2121

22-
builder.Services.AddControllers();
22+
builder.Services.AddControllers().AddNewtonsoftJson(options =>
23+
{
24+
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
25+
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
26+
});
2327
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
2428
builder.Services.AddEndpointsApiExplorer();
2529

@@ -42,23 +46,18 @@
4246
.AllowAnyHeader()
4347
.AllowAnyMethod().AllowCredentials()
4448
));
45-
builder.Services.AddControllers()
46-
.AddNewtonsoftJson(options =>
47-
{
48-
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
49-
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
50-
}); ;
49+
5150
builder.Services.AddSwaggerGen(c =>
5251
{
5352
c.SwaggerDoc("v1", new OpenApiInfo { Title = "APIJSON.NET", Version = "v1" });
5453
});
5554
builder.Services.AddSingleton<DbContext>();
56-
builder.Services.AddSingleton<SelectTable>();
55+
5756
builder.Services.AddSingleton<TokenAuthConfiguration>();
5857
builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
5958
builder.Services.AddTransient<IIdentityService, IdentityService>();
6059
builder.Services.AddTransient<ITableMapper, TableMapper>();
61-
60+
6261

6362
var app = builder.Build();
6463

@@ -74,6 +73,7 @@
7473
}
7574

7675
app.UseHttpsRedirection();
76+
app.UseDefaultFiles();
7777
app.UseStaticFiles();
7878
app.UseAuthorization();
7979
app.UseCors(_defaultCorsPolicyName);

‎APIJSON.NET/APIJSON.NET/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ConnectionStrings": {
3-
"DbType": 0, //0:MySql,1:SqlServer,2:Sqlite
4-
"ConnectionString": "Server=192.168.2.25;Database=yunwei1.8;Uid=root;Pwd=xmjk;Port=3306;Character Set=utf8;"
3+
"DbType": 1, //0:MySql,1:SqlServer,2:Sqlite
4+
"ConnectionString": "Server=localhost;Database=APIJSON.NET;Uid=sa;Pwd=sa123qwe,;"
55
//"ConnectionString": "Server=119.29.9.25;Port=3306;Database=test;Uid=root;Pwd=1q,2w.3e?;CharSet=UTF8;"
66
},
77
"CorsUrls": "http://localhost:5000,http://localhost5001",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /