fix26.2: полная UI-полировка peer/dashboard и завершение i18n
This commit is contained in:
+20
-7
@@ -24,7 +24,7 @@ func PagePeer(peerPageDto dto.PeerPageDto) ([]vo.PeerVo, int64, error) {
|
||||
result := make([]vo.PeerVo, 0, len(peers))
|
||||
for _, p := range peers {
|
||||
item := vo.PeerVo{
|
||||
BaseVo: vo.BaseVo{Id: *p.Id, CreateTime: *p.CreateTime},
|
||||
BaseVo: vo.BaseVo{Id: *p.Id, CreateTime: *p.CreateTime},
|
||||
Name: strVal(p.Name),
|
||||
Remark: strVal(p.Remark),
|
||||
AuthId: strVal(p.AuthId),
|
||||
@@ -137,7 +137,7 @@ func GetPeerVo(id int64) (vo.PeerVo, error) {
|
||||
return vo.PeerVo{}, err
|
||||
}
|
||||
return vo.PeerVo{
|
||||
BaseVo: vo.BaseVo{Id: *p.Id, CreateTime: *p.CreateTime},
|
||||
BaseVo: vo.BaseVo{Id: *p.Id, CreateTime: *p.CreateTime},
|
||||
Name: strVal(p.Name),
|
||||
Remark: strVal(p.Remark),
|
||||
AuthId: strVal(p.AuthId),
|
||||
@@ -152,8 +152,12 @@ func GetPeerVo(id int64) (vo.PeerVo, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func ResetPeerTraffic(id int64) error { return dao.UpdatePeer([]int64{id}, map[string]interface{}{"download_bytes": 0, "upload_bytes": 0}) }
|
||||
func ReleaseKickPeer(id int64) error { return dao.UpdatePeer([]int64{id}, map[string]interface{}{"banned_until": 0}) }
|
||||
func ResetPeerTraffic(id int64) error {
|
||||
return dao.UpdatePeer([]int64{id}, map[string]interface{}{"download_bytes": 0, "upload_bytes": 0})
|
||||
}
|
||||
func ReleaseKickPeer(id int64) error {
|
||||
return dao.UpdatePeer([]int64{id}, map[string]interface{}{"banned_until": 0})
|
||||
}
|
||||
|
||||
func KickPeer(id int64, bannedUntil int64) error {
|
||||
if err := dao.UpdatePeer([]int64{id}, map[string]interface{}{"banned_until": bannedUntil}); err != nil {
|
||||
@@ -324,6 +328,15 @@ func UpdatePeerLastConnectionAt(id int64, conAt int64) error {
|
||||
return dao.UpdatePeer([]int64{id}, map[string]interface{}{"last_connection_at": conAt})
|
||||
}
|
||||
|
||||
func strVal(v *string) string { if v == nil { return "" }; return *v }
|
||||
func int64Val(v *int64) int64 { if v == nil { return 0 }; return *v }
|
||||
|
||||
func strVal(v *string) string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
return *v
|
||||
}
|
||||
func int64Val(v *int64) int64 {
|
||||
if v == nil {
|
||||
return 0
|
||||
}
|
||||
return *v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user