mirror of
https://github.com/Ed1s0nZ/PrivHunterAI.git
synced 2025-06-22 02:40:31 +00:00
Update index.go
This commit is contained in:
parent
137373a9fe
commit
28aff6e4cb
17
index.go
17
index.go
@ -6,18 +6,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 定义数据结构
|
var Resp []Result // 数据存储在全局切片中
|
||||||
type DataItem struct {
|
|
||||||
Method string `json:"method"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
RespBodyA string `json:"respBodyA"`
|
|
||||||
RespBodyB string `json:"respBodyB"`
|
|
||||||
Result string `json:"result"`
|
|
||||||
Reason string `json:"reason"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var Resp []DataItem // 数据存储在全局切片中
|
|
||||||
|
|
||||||
func Index() {
|
func Index() {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
@ -37,7 +26,7 @@ func Index() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
r.POST("/update", func(c *gin.Context) {
|
r.POST("/update", func(c *gin.Context) {
|
||||||
var newData DataItem
|
var newData Result
|
||||||
if err := c.ShouldBindJSON(&newData); err != nil {
|
if err := c.ShouldBindJSON(&newData); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
@ -54,7 +43,7 @@ func Index() {
|
|||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
filteredData := []DataItem{}
|
filteredData := []Result{}
|
||||||
for _, item := range Resp {
|
for _, item := range Resp {
|
||||||
if item.Result == filterData.Result {
|
if item.Result == filterData.Result {
|
||||||
filteredData = append(filteredData, item)
|
filteredData = append(filteredData, item)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user