Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d37302cf9 | ||
|
|
1a1856257d |
@@ -3,6 +3,7 @@ package api
|
|||||||
import (
|
import (
|
||||||
requstform "Gwen/http/request/api"
|
requstform "Gwen/http/request/api"
|
||||||
"Gwen/http/response"
|
"Gwen/http/response"
|
||||||
|
"Gwen/model"
|
||||||
"Gwen/service"
|
"Gwen/service"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -53,7 +54,11 @@ func (i *Index) Heartbeat(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
peer.LastOnlineTime = time.Now().Unix()
|
//如果在一分钟以内则不更新
|
||||||
service.AllService.PeerService.Update(peer)
|
if time.Now().Unix()-peer.LastOnlineTime > 60 {
|
||||||
|
peer.LastOnlineTime = time.Now().Unix()
|
||||||
|
upp := &model.Peer{RowId: peer.RowId, LastOnlineTime: peer.LastOnlineTime}
|
||||||
|
service.AllService.PeerService.Update(upp)
|
||||||
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,5 +54,5 @@ func (p *Peer) SysInfo(c *gin.Context) {
|
|||||||
//SYSINFO_UPDATED 上传成功
|
//SYSINFO_UPDATED 上传成功
|
||||||
//ID_NOT_FOUND 下次心跳会上传
|
//ID_NOT_FOUND 下次心跳会上传
|
||||||
//直接响应文本
|
//直接响应文本
|
||||||
c.String(http.StatusOK, "")
|
c.String(http.StatusOK, "SYSINFO_UPDATED")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user