Movatterモバイル変換


[0]ホーム

URL:


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

Commitbd1f3db

Browse files
committed
#运行错误修复#
1 parentf80ed27 commitbd1f3db

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(variteminjobject)
141138
{
142139
stringkey=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-
usingAPIJSON.NET.Models;
1+
usingAPIJSON.NET.Data.Models;
22
usingMicrosoft.Extensions.Configuration;
33
usingMicrosoft.Extensions.Options;
44
usingSqlSugar;

‎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-
usingAPIJSON.NET.Models;
1+
usingAPIJSON.NET.Data.Models;
22
usingMicrosoft.AspNetCore.Builder;
33
usingMicrosoft.Extensions.DependencyInjection;
44
usingSqlSugar;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
usingSqlSugar;
22
usingSystem;
33

4-
namespaceAPIJSON.NET.Models
4+
namespaceAPIJSON.NET.Data.Models
55
{
66
publicclassLogin
77
{
88
[SugarColumn(IsNullable=false,IsPrimaryKey=true)]
99
publicintuserId{get;set;}
10-
[SugarColumn(Length=100,ColumnDescription="用户名")]
10+
[SugarColumn(Length=100,ColumnDescription="用户名")]
1111
publicstringuserName{get;set;}
1212
[SugarColumn(Length=200,ColumnDescription="密码")]
1313
publicstringpassWord{get;set;}
1414
[SugarColumn(Length=100,ColumnDescription="密码盐")]
1515
publicstringpassWordSalt{get;set;}
1616
[SugarColumn(Length=100,ColumnDescription="权限组")]
1717
publicstringroleCode{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",newOpenApiInfo{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
varapp=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)

[8]ページ先頭

©2009-2025 Movatter.jp