Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d37302cf9 | ||
|
|
1a1856257d |
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
requstform "Gwen/http/request/api"
|
||||
"Gwen/http/response"
|
||||
"Gwen/model"
|
||||
"Gwen/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
@@ -53,7 +54,11 @@ func (i *Index) Heartbeat(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{})
|
||||
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{})
|
||||
}
|
||||
|
||||
@@ -54,5 +54,5 @@ func (p *Peer) SysInfo(c *gin.Context) {
|
||||
//SYSINFO_UPDATED 上传成功
|
||||
//ID_NOT_FOUND 下次心跳会上传
|
||||
//直接响应文本
|
||||
c.String(http.StatusOK, "")
|
||||
c.String(http.StatusOK, "SYSINFO_UPDATED")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user