zhangzengfei
2024-05-18 3771d5551480964ab17f4c23a152df2482bf6470
models/subplatform.go
@@ -1,8 +1,9 @@
package models
import "time"
type SubPlatform struct {
   Id            string `gorm:"primary_key;" json:"id"`
   HeartbeatTime string `gorm:"column:heartbeat_time" json:"heartbeat_time"`
   Name          string `gorm:"not null;default:''" json:"name"`
   UserName      string `gorm:"not null;default:''" json:"user_name"`
   Realm         string `gorm:"not null;default:''" json:"realm"`
@@ -10,6 +11,7 @@
   Description   string `gorm:"not null;default:''" json:"description"`
   RemoteIP      string `gorm:"not null;default:''" json:"remote_ip"`
   RemotePort    int    `gorm:"not null;default:0" json:"remote_port"`
   HeartbeatTime string `gorm:"column:heartbeat_time" json:"heartbeat_time"`
   CreateTime    int64  `gorm:"column:create_time;autoCreateTime;" json:"create_time"`
   UpdateTime    int64  `gorm:"column:update_time;autoUpdateTime" json:"-"`
   DeleteTime    int64  `gorm:"column:delete_time" json:"-"`
@@ -39,3 +41,7 @@
   return list, nil
}
func (s *SubPlatform) Keepalive(id string) error {
   return db.Table(s.TableName()).Where("id = ?", id).Update("heartbeat_time", time.Now().Format("2006-01-02 15:04:05")).Error
}