优化代码/删除不需要的代码

This commit is contained in:
刘祥超
2022-10-14 10:03:29 +08:00
parent 5d4da6cccb
commit b0b6b5984f
42 changed files with 554 additions and 1256 deletions

View File

@@ -2617,11 +2617,29 @@ func (this *ServerDAO) UpdateServerBandwidth(tx *dbs.Tx, serverId int64, fullTim
if bandwidthBytes < 0 {
bandwidthBytes = 0
}
return this.Query(tx).
bandwidthTime, err := this.Query(tx).
Pk(serverId).
Set("bandwidthTime", fullTime).
Set("bandwidthBytes", bandwidthBytes).
UpdateQuickly()
Result("bandwidthTime").
FindStringCol("")
if err != nil {
return err
}
if bandwidthTime != fullTime {
return this.Query(tx).
Pk(serverId).
Set("bandwidthTime", fullTime).
Set("bandwidthBytes", bandwidthBytes).
UpdateQuickly()
} else {
return this.Query(tx).
Pk(serverId).
Set("bandwidthTime", fullTime).
Set("bandwidthBytes", dbs.SQL("bandwidthBytes+:bytes")).
Param("bytes", bandwidthBytes).
UpdateQuickly()
}
}
// NotifyUpdate 同步服务所在的集群