缓存schserid
build / build-push (push) Successful in 1m20s

This commit is contained in:
wanghu
2026-09-07 16:38:59 +08:00
parent f711f1c5e5
commit 7112b7ed40
3 changed files with 14 additions and 8 deletions
@@ -77,7 +77,7 @@ namespace YhCore.WebApi.Controllers.Api.Common
/// <summary>添加字典。</summary>
[HttpPost("AddDic")]
public async Task AddDic([FromForm] Common_Dictionary model)
public async Task AddDic([FromBody] Common_Dictionary model)
{
if (model == null) throw new DException("参数错误!");
@@ -94,7 +94,7 @@ namespace YhCore.WebApi.Controllers.Api.Common
/// <summary>更新字典。</summary>
[HttpPost("UpdateDic")]
public async Task UpdateDic([FromForm] Common_Dictionary model)
public async Task UpdateDic([FromBody] Common_Dictionary model)
{
if (model == null) throw new DException("参数有误!");
model.Schserid = SchSerID();
@@ -103,7 +103,7 @@ namespace YhCore.WebApi.Controllers.Api.Common
/// <summary>编辑字典名称。</summary>
[HttpPost("EditDic")]
public async Task EditDic([FromForm] Common_Dictionary model)
public async Task EditDic([FromBody] Common_Dictionary model)
{
if (model == null) throw new DException("参数有误!");
model.Schserid = SchSerID();
@@ -112,7 +112,7 @@ namespace YhCore.WebApi.Controllers.Api.Common
/// <summary>添加发文部门。</summary>
[HttpPost("AddDeptDic")]
public async Task AddDeptDic([FromForm] Common_Dictionary model)
public async Task AddDeptDic([FromBody] Common_Dictionary model)
{
if (model == null) throw new DException("参数有误!");
@@ -129,7 +129,7 @@ namespace YhCore.WebApi.Controllers.Api.Common
/// <summary>更新发文部门。</summary>
[HttpPost("UpdateDeptDic")]
public async Task UpdateDeptDic([FromForm] Common_Dictionary model)
public async Task UpdateDeptDic([FromBody] Common_Dictionary model)
{
if (model == null) throw new DException("参数有误!");
model.Schserid = SchSerID();
@@ -86,7 +86,11 @@ namespace YhCore.WebApi.Controllers.Api.DocPrint
[HttpPost("AddDictionaryType")]
public async Task AddDictionaryType([FromForm] Common_Dictionary model)
{
if (model == null) throw new DException("参数错误!");
// 表单绑定实例不会为 null,但字段名拼错(如 TypelD≠TypeId)时必填列会为 null,
// SaveChanges 才抛"不能将 NULL 插入列"(code:6 无从排查)——在入口显式校验给出可读错误。
if (model == null || string.IsNullOrWhiteSpace(model.typeID)
|| string.IsNullOrWhiteSpace(model.typeName) || string.IsNullOrWhiteSpace(model.Name))
throw new DException("参数错误:typeID、typeName、Name 均不能为空(注意表单字段名拼写,TypeId≠TypelD)");
model.Schserid = SchSerID();
await _dict.AddDicAsync(model);
}
@@ -95,7 +99,9 @@ namespace YhCore.WebApi.Controllers.Api.DocPrint
[HttpPost("EditDictionaryType")]
public async Task EditDictionaryType([FromForm] Common_Dictionary model)
{
if (model == null) throw new DException("参数有误!");
if (model == null || model.SerID <= 0 || string.IsNullOrWhiteSpace(model.typeID)
|| string.IsNullOrWhiteSpace(model.typeName) || string.IsNullOrWhiteSpace(model.Name))
throw new DException("参数错误:SerID、typeID、typeName、Name 均不能为空(注意表单字段名拼写,TypeId≠TypelD)");
model.Schserid = SchSerID();
await _dict.EditDicAsync(model);
}
+1 -1
View File
@@ -36,7 +36,7 @@
"Enabled": true,
"BaseHost": "http://base.yunhaixingtong.com",
"BasePath": "/userbase",
"SchClassPath": "/bschclass",
"SchClassPath": "/userclass",
"AppKey": "100002",
"AppSecret": "2314a3b158b24a838b2b9b69fd3db118"
}