fix: sys job get state and delete ne_state
This commit is contained in:
@@ -1832,3 +1832,35 @@ func XormGetNEStateInfo(neType, neID string) (string, string, error) {
|
||||
Get(&SN, &Version)
|
||||
return SN, Version, err
|
||||
}
|
||||
|
||||
type NeState struct {
|
||||
Id int `json:"id" xorm:"pk 'id' autoincr"`
|
||||
NeType string `json:"neType" xorm:"ne_type"`
|
||||
NeId string `json:"neId" xorm:"ne_id"`
|
||||
Version string `json:"version" xorm:"column 'version' VARCHAR(16)"`
|
||||
Capability uint32 `json:"capability" xorm:"capability"`
|
||||
SerialNum string `json:"serialNum" xorm:"serial_num"`
|
||||
ExpiryDate string `json:"expiryDate" xorm:"expiry_date"`
|
||||
CpuUsage string `json:"cpuUsage" xorm:"cpu_usage"`
|
||||
MemUsage string `json:"memUsage" xorm:"mem_usage"`
|
||||
DiskSpace string `json:"diskSpace" xorm:"disk_space"`
|
||||
Timestamp string `json:"timestamp" xorm:"-" `
|
||||
}
|
||||
|
||||
func XormInsertNeState(neState *NeState) (int64, error) {
|
||||
log.Debug("XormInsertNeState processing... ")
|
||||
|
||||
var affected int64 = 0
|
||||
|
||||
session := xEngine.NewSession()
|
||||
defer session.Close()
|
||||
affected, err := session.InsertOne(neState)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
err = session.Commit()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return affected, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user