mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-11 22:00:27 +08:00
优化代码/删除不需要的代码
This commit is contained in:
@@ -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 同步服务所在的集群
|
||||
|
||||
Reference in New Issue
Block a user