From 0a8954c703ece78a20476e405f239e1f5097fadb Mon Sep 17 00:00:00 2001 From: GaoFengAkita Date: Fri, 9 Jul 2021 17:41:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=AF=86=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/honeycluster/honeyclusterSQL.go | 11 +++++++++++ web_manager.go | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/models/honeycluster/honeyclusterSQL.go b/models/honeycluster/honeyclusterSQL.go index baabe9dd..52e19b71 100644 --- a/models/honeycluster/honeyclusterSQL.go +++ b/models/honeycluster/honeyclusterSQL.go @@ -765,6 +765,17 @@ func InsertSign(signtype string, signname string, createtime int64, creator stri return data, msg, comm.SuccessCode } +func SelectSignByName(name string) []orm.Params { + o := orm.NewOrm() + var maps []orm.Params + _, err := o.Raw("SELECT * FROM `signs` where signname=?", name).Values(&maps) + if err != nil { + logs.Error("[SelectHoneyInfoById] select event list error,%s", err) + + } + return maps +} + /** 删除诱饵 */ diff --git a/web_manager.go b/web_manager.go index 0db62b72..dd93c4bb 100644 --- a/web_manager.go +++ b/web_manager.go @@ -2511,7 +2511,11 @@ func CreateSignHandler(w http.ResponseWriter, r *http.Request) { return } if isfalse { - comhttp.SendJSONResponse(w, comm.Response{Code: comm.ErrorCode, Data: "上传失败", Message: "上传类型只支持doc,docx,ppt,pptx,xlsx,xls,pdf"}) + comhttp.SendJSONResponse(w, comm.Response{Code: comm.ErrorCode, Data: "上传失败", Message: "上传类型只支持docx,pptx,xlsx,pdf"}) + return + } + if len(honeycluster.SelectSignByName(signname)) != 0{ + comhttp.SendJSONResponse(w, comm.Response{Code: comm.ErrorCode, Data: "密签文件名称重复", Message: "密签文件名称重复"}) return } createtime := time.Now().Unix()