mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-22 06:40:43 +08:00
feat(rmi): support receive rmi connection (#5)
This commit is contained in:
+1
-1
@@ -157,7 +157,7 @@ func (s *Server) Receive(c *gin.Context) {
|
||||
c.String(code, compileTpl(c, _rule.ResponseBody))
|
||||
return
|
||||
}
|
||||
log.Trace("HTTP record(id:%d) has been created", r.ID)
|
||||
log.Info("HTTP record(id:%d,rule:%s,remote_ip:%s) has been created", r.ID, _rule.Name, ip)
|
||||
|
||||
//only send to client when this connection recorded first time.
|
||||
if _rule.PushToClient {
|
||||
|
||||
@@ -89,6 +89,10 @@ func ListRecords(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if order != "desc" && order != "asc" {
|
||||
order = "desc"
|
||||
}
|
||||
|
||||
if err := db.Order("id" + " " + order).Count(&count).Offset((page - 1) * 10).Limit(10).Find(&res).Error; err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
|
||||
@@ -108,6 +108,10 @@ func ListRules(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if order != "desc" && order != "asc" {
|
||||
order = "desc"
|
||||
}
|
||||
|
||||
if err := db.Order("rank desc").Order("id" + " " + order).Count(&count).Offset((page - 1) * 10).Limit(10).Find(&res).Error; err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
|
||||
Reference in New Issue
Block a user