fix26.2: полная UI-полировка peer/dashboard и завершение i18n
This commit is contained in:
@@ -40,4 +40,3 @@ func UpdateAdminUser(ids []int64, updates map[string]interface{}) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -152,4 +152,3 @@ func DashboardSystemTimeseries(fromMs int64, toMs int64) ([]vo.DashboardSeriesPo
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+13
-14
@@ -289,8 +289,8 @@ func migrateLegacyAccounts() error {
|
||||
if !tableExists("account") {
|
||||
return nil
|
||||
}
|
||||
var accounts []entity.Account
|
||||
if tx := sqliteDB.Model(&entity.Account{}).Order("id asc").Find(&accounts); tx.Error != nil {
|
||||
var accounts []entity.LegacyAccount
|
||||
if tx := sqliteDB.Model(&entity.LegacyAccount{}).Order("id asc").Find(&accounts); tx.Error != nil {
|
||||
logrus.Errorf("sqlite legacy account query err: %v", tx.Error)
|
||||
return errors.New("sqlite legacy account query err")
|
||||
}
|
||||
@@ -615,17 +615,17 @@ func CloseSqliteDB() error {
|
||||
}
|
||||
|
||||
func IsSqliteReady() bool {
|
||||
if sqliteDB == nil {
|
||||
return false
|
||||
}
|
||||
db, err := sqliteDB.DB()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if err := db.Ping(); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
if sqliteDB == nil {
|
||||
return false
|
||||
}
|
||||
db, err := sqliteDB.DB()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if err := db.Ping(); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func Paginate(pageNum *int64, pageSize *int64) func(db *gorm.DB) *gorm.DB {
|
||||
@@ -641,4 +641,3 @@ func Paginate(pageNum *int64, pageSize *int64) func(db *gorm.DB) *gorm.DB {
|
||||
return db.Offset(int((num - 1) * size)).Limit(int(size))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,4 +72,3 @@ func UpsertTrafficAggregateDaily(peerId int64, dayStart int64, rxBytes int64, tx
|
||||
func gormExprAdd(column string, delta int64) interface{} {
|
||||
return gorm.Expr(fmt.Sprintf("%s + ?", column), delta)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user