|
|
@@ -3,6 +3,7 @@ package api
|
|
3
|
3
|
import (
|
|
4
|
4
|
requstform "Gwen/http/request/api"
|
|
5
|
5
|
"Gwen/http/response"
|
|
|
6
|
+ "Gwen/model"
|
|
6
|
7
|
"Gwen/service"
|
|
7
|
8
|
"github.com/gin-gonic/gin"
|
|
8
|
9
|
"net/http"
|
|
|
@@ -53,7 +54,11 @@ func (i *Index) Heartbeat(c *gin.Context) {
|
|
53
|
54
|
c.JSON(http.StatusOK, gin.H{})
|
|
54
|
55
|
return
|
|
55
|
56
|
}
|
|
56
|
|
- peer.LastOnlineTime = time.Now().Unix()
|
|
57
|
|
- service.AllService.PeerService.Update(peer)
|
|
|
57
|
+ //如果在一分钟以内则不更新
|
|
|
58
|
+ if time.Now().Unix()-peer.LastOnlineTime > 60 {
|
|
|
59
|
+ peer.LastOnlineTime = time.Now().Unix()
|
|
|
60
|
+ upp := &model.Peer{RowId: peer.RowId, LastOnlineTime: peer.LastOnlineTime}
|
|
|
61
|
+ service.AllService.PeerService.Update(upp)
|
|
|
62
|
+ }
|
|
58
|
63
|
c.JSON(http.StatusOK, gin.H{})
|
|
59
|
64
|
}
|