This commit is contained in:
539943419 committed 2024-08-23 12:35:43 +08:00
commit acd7a8b5f0
14 files changed
+581

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
package api
import (
"net/http"
"strconv"
"github.com/gin-gonic/gin"
"my-go-project/fsOperateEventCenter"
)
func QueryHandler(fsOperateEventCenter *fsOperateEventCenter.FsOperateEventCenter) gin.HandlerFunc {
return func(c *gin.Context) {
idStr := c.Query("id")
id, err := strconv.ParseInt(idStr, 10, 32)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid id"})
return
}
event := fsOperateEventCenter.Query(int32(id))
c.JSON(http.StatusOK, event)
}
}