mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-03 08:46:18 +00:00
[sub] Show used traffic for unlimited users
This commit is contained in:
parent
25430b7818
commit
a5c3df33a0
1 changed files with 14 additions and 10 deletions
|
@ -787,20 +787,24 @@ func (s *SubService) genRemark(inbound *model.Inbound, email string, extra strin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get remained days
|
|
||||||
if statsExist {
|
if statsExist {
|
||||||
if !stats.Enable {
|
if !stats.Enable {
|
||||||
return fmt.Sprintf("⛔️N/A-%s", strings.Join(remark, "-"))
|
return fmt.Sprintf("⛔️N/A-%s", strings.Join(remark, "-"))
|
||||||
}
|
}
|
||||||
if vol := stats.Total - (stats.Up + stats.Down); vol > 0 {
|
if stats.ExpiryTime == 0 && stats.Total == 0 {
|
||||||
remark = append(remark, fmt.Sprintf("%s%s", common.FormatTraffic(vol), "📊"))
|
totalUsage := stats.Up + stats.Down
|
||||||
}
|
remark = append(remark, fmt.Sprintf("%s♾️", common.FormatTraffic(totalUsage)))
|
||||||
now := time.Now().Unix()
|
} else {
|
||||||
switch exp := stats.ExpiryTime / 1000; {
|
if vol := stats.Total - (stats.Up + stats.Down); vol > 0 {
|
||||||
case exp > 0:
|
remark = append(remark, fmt.Sprintf("%s%s", common.FormatTraffic(vol), "📊"))
|
||||||
remark = append(remark, fmt.Sprintf("%d%s⏳", (exp-now)/86400, "Days"))
|
}
|
||||||
case exp < 0:
|
now := time.Now().Unix()
|
||||||
remark = append(remark, fmt.Sprintf("%d%s⏳", exp/-86400, "Days"))
|
switch exp := stats.ExpiryTime / 1000; {
|
||||||
|
case exp > 0:
|
||||||
|
remark = append(remark, fmt.Sprintf("%d%s⏳", (exp-now)/86400, "Days"))
|
||||||
|
case exp < 0:
|
||||||
|
remark = append(remark, fmt.Sprintf("%d%s⏳", exp/-86400, "Days"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue