Skip to content

Commit 2e4045c

Browse files
authored
Merge branch 'liaozb:master' into master
2 parents 3991593 + bd1f3db commit 2e4045c

File tree

6 files changed

+24
-27
lines changed

6 files changed

+24
-27
lines changed

Diff for: APIJSON.NET/APIJSON.NET/Controllers/JsonController.cs

-3
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();

Diff for: APIJSON.NET/APIJSON.NET/Data/DbContext.cs

+1-1
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;

Diff for: APIJSON.NET/APIJSON.NET/Data/DbInit.cs

+1-1
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;
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
}

Diff for: APIJSON.NET/APIJSON.NET/Program.cs

+9-9
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);

Diff for: APIJSON.NET/APIJSON.NET/appsettings.json

+10-10
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",
@@ -15,21 +15,21 @@
1515
},
1616
"RoleList": [
1717
{
18-
"name": "role1", //Ȩ������ Ψһ
19-
"select": { //��ѯȨ��
20-
"table": [ "*" ], //�ɲ����ı�
21-
"column": [ "*" ], //�ɲ������ֶ�
18+
"name": "role1", //权限名称 唯一
19+
"select": { //查询权限
20+
"table": [ "*" ], //可操作的表
21+
"column": [ "*" ], //可操作的字段
2222
"where": []
2323
},
24-
"update": { //�޸�Ȩ��
24+
"update": { //修改权限
2525
"table": [ "moment", "User", "Comment" ],
2626
"column": [ "*", "*", "*" ]
2727
},
28-
"insert": { //���Ȩ��
28+
"insert": { //添加权限
2929
"table": [ "moment", "User", "Comment" ],
3030
"column": [ "*", "*", "*" ]
3131
},
32-
"delete": { //ɾ��Ȩ��
32+
"delete": { //删除权限
3333
"table": [ "moment", "User", "Comment" ]
3434
}
3535
},
@@ -41,7 +41,7 @@
4141
}
4242
}
4343
],
44-
"tablempper": //������ӳ��
44+
"tablempper": //别名表映射
4545
{
4646
"user": "apijson_user",
4747
"org": "web_organization"

0 commit comments

Comments
 (0)