Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jyzb_local_platform
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
赵剑炜
jyzb_local_platform
Commits
6be47d09
Commit
6be47d09
authored
Oct 18, 2023
by
Seniorious
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增照片信息删除接口
parent
b363a310
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
80 行增加
和
0 行删除
+80
-0
BaseInfoController.cs
WebApiNET6-master/APIs/Controllers/BaseInfoController.cs
+74
-0
PictureReq.cs
WebApiNET6-master/APIs/Req/PictureReq.cs
+6
-0
没有找到文件。
WebApiNET6-master/APIs/Controllers/BaseInfoController.cs
View file @
6be47d09
...
...
@@ -8,6 +8,7 @@ using Common.Utility.RabbitMQ;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc.ModelBinding
;
using
Models.SqlModel
;
using
Models.Table
;
using
Models.ToolsModel
;
using
Newtonsoft.Json
;
using
Services
;
...
...
@@ -40,6 +41,79 @@ namespace APIs.Controllers
}
/// <summary>
/// 根据人员id删除照片及照片数据库信息
/// </summary>
/// <param name=""></param>
/// <returns></returns>
[
HttpPost
]
public
async
Task
<
ApiResult
>
DeletePictureById
([
FromForm
]
DelPicReq
req
)
{
try
{
var
police
=
await
_policeService
.
QueryOne
(
p
=>
p
.
id
.
Equals
(
req
.
id
));
if
(
police
==
null
)
{
var
error
=
new
ApiResult
{
code
=
ResultCode
.
POLICE_ERROR
.
Code
,
msg
=
ResultCode
.
POLICE_ERROR
.
Msg
,
};
return
error
;
}
string
delurl
=
police
.
picUrl
;
if
(
string
.
IsNullOrEmpty
(
delurl
))
{
var
error
=
new
ApiResult
{
code
=
ResultCode
.
OPERATE_FAILED
.
Code
,
msg
=
"照片信息不存在"
,
};
return
error
;
}
//删除数据库照片信息
police
.
faceInfo
=
""
;
police
.
picUrl
=
""
;
police
.
picUpdateTime
=
DateTime
.
Now
;
bool
rs
=
await
_policeService
.
Update
(
police
);
if
(!
rs
)
{
var
error
=
new
ApiResult
{
code
=
ResultCode
.
OPERATE_FAILED
.
Code
,
msg
=
"照片信息删除失败"
,
};
return
error
;
}
//删除照片
FileInfo
mypic
=
new
FileInfo
(
delurl
);
mypic
.
Delete
();
var
src
=
new
ApiResult
{
code
=
ResultCode
.
OPERATE_SUCCESS
.
Code
,
msg
=
ResultCode
.
OPERATE_SUCCESS
.
Msg
};
return
src
;
}
catch
(
Exception
ex
)
{
var
error
=
new
ApiResult
{
code
=
ResultCode
.
OPERATE_FAILED
.
Code
,
msg
=
ex
.
Message
,
};
return
error
;
}
}
/// <summary>
/// 人员照片下载
/// </summary>
/// <returns></returns>
...
...
WebApiNET6-master/APIs/Req/PictureReq.cs
View file @
6be47d09
namespace
APIs.Req
{
public
class
DelPicReq
{
public
string
id
{
get
;
set
;
}
}
public
class
PictureReq
{
public
string
policeId
{
get
;
set
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论