Skip to content

Commit

Permalink
fix: 添加密签名称检查
Browse files Browse the repository at this point in the history
  • Loading branch information
GaoFengAkita committed Jul 9, 2021
1 parent db79899 commit 0a8954c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions models/honeycluster/honeyclusterSQL.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
删除诱饵
*/
Expand Down
6 changes: 5 additions & 1 deletion web_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0a8954c

Please sign in to comment.