Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 1m40s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 42m16s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
35 lines
884 B
Go
35 lines
884 B
Go
package model
|
|
|
|
import "encoding/json"
|
|
|
|
// Correct historical error-log presentation from the already-stored routing
|
|
// evidence, without rewriting financial history or exposing private metadata.
|
|
// Consume records always retain their original billed group.
|
|
func normalizeErrorLogGroup(log *Log) {
|
|
if log == nil || log.Type != LogTypeError {
|
|
return
|
|
}
|
|
if log.ChannelId <= 0 {
|
|
log.Group = ""
|
|
return
|
|
}
|
|
var other struct {
|
|
Admin struct {
|
|
Events []struct {
|
|
ChannelID int `json:"channel_id"`
|
|
Group string `json:"group"`
|
|
} `json:"request_policy"`
|
|
} `json:"admin_info"`
|
|
}
|
|
if json.Unmarshal([]byte(log.Other), &other) != nil {
|
|
return
|
|
}
|
|
for i := len(other.Admin.Events) - 1; i >= 0; i-- {
|
|
event := other.Admin.Events[i]
|
|
if event.ChannelID == log.ChannelId && event.Group != "" && event.Group != "auto" {
|
|
log.Group = event.Group
|
|
return
|
|
}
|
|
}
|
|
}
|