HFish/view/api/view.go
SanJin 60d7580cea 1. ~ 修复 Mysql 三次握手不主动关闭连接异常问题
2. ~ 日记格式完善
3. ~ 暗网钓鱼支持
4. ~ UI 优化
5. ~ 支持分页
6. ~ 筛选
7. ~ 提供黑名单IP接口
8. ~ 邮件发送支持编辑器
9. ~ 支持 ip 地理信息
2019-08-09 10:13:54 +08:00

34 lines
688 B
Go

package api
import (
"github.com/gin-gonic/gin"
"HFish/core/report"
"net/http"
"HFish/error"
"HFish/utils/conf"
"HFish/core/dbUtil"
)
func ReportWeb(c *gin.Context) {
name := c.PostForm("name")
info := c.PostForm("info")
secKey := c.PostForm("sec_key")
ip := c.ClientIP()
apiSecKey := conf.Get("api", "sec_key")
if secKey != apiSecKey {
c.JSON(http.StatusOK, error.ErrFailApiKey())
} else {
go report.ReportWeb(name, ip, info)
c.JSON(http.StatusOK, error.ErrSuccessNull())
}
}
// 获取记录黑客IP
func GetIpList(c *gin.Context) {
sql := `select ip from hfish_info GROUP BY ip;`
result := dbUtil.Query(sql)
c.JSON(http.StatusOK, error.ErrSuccess(result))
}