fix26.2: полная UI-полировка peer/dashboard и завершение i18n
This commit is contained in:
@@ -80,23 +80,3 @@ func PagePeer(peerPageDto dto.PeerPageDto) ([]entity.Peer, int64, error) {
|
||||
}
|
||||
return peers, total, nil
|
||||
}
|
||||
|
||||
func UpdatePeerTraffic(name string, download int64, upload int64) error {
|
||||
if upload == 0 && download == 0 {
|
||||
return nil
|
||||
}
|
||||
updates := map[string]interface{}{}
|
||||
if download != 0 {
|
||||
updates["download_bytes"] = gorm.Expr("download_bytes + ?", download)
|
||||
}
|
||||
if upload != 0 {
|
||||
updates["upload_bytes"] = gorm.Expr("upload_bytes + ?", upload)
|
||||
}
|
||||
updates["update_time"] = time.Now().Format("2006-01-02 15:04:05")
|
||||
if tx := sqliteDB.Model(&entity.Peer{}).Where("name = ?", name).Updates(updates); tx.Error != nil {
|
||||
logrus.Errorf("%v", tx.Error)
|
||||
return errors.New(constant.SysError)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user