mirror of
https://gitee.com/lauix/HFish
synced 2025-05-11 12:28:02 +08:00
45 lines
879 B
Go
45 lines
879 B
Go
package colony
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
"HFish/core/dbUtil"
|
|
"HFish/error"
|
|
"HFish/utils/log"
|
|
)
|
|
|
|
func Html(c *gin.Context) {
|
|
c.HTML(http.StatusOK, "colony.html", gin.H{})
|
|
}
|
|
|
|
// 获取蜜罐集群列表
|
|
func GetColony(c *gin.Context) {
|
|
result, err := dbUtil.DB().Table("hfish_colony").OrderBy("id desc").Get()
|
|
|
|
if err != nil {
|
|
log.Pr("HFish", "127.0.0.1", "获取蜜罐集群列表失败", err)
|
|
}
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"code": error.ErrSuccessCode,
|
|
"msg": error.ErrSuccessMsg,
|
|
"data": result,
|
|
})
|
|
}
|
|
|
|
// 删除集群
|
|
func PostColonyDel(c *gin.Context) {
|
|
id := c.PostForm("id")
|
|
|
|
_, err := dbUtil.DB().Table("hfish_colony").Where("id", "=", id).Delete()
|
|
|
|
if err != nil {
|
|
log.Pr("HFish", "127.0.0.1", "删除集群失败", err)
|
|
}
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"code": error.ErrSuccessCode,
|
|
"msg": error.ErrSuccessMsg,
|
|
})
|
|
}
|