网关重启时恢复权限与分配数据

This commit is contained in:
2025-05-26 10:55:44 +08:00
parent 52907b3fae
commit 8c928a8321
5 changed files with 18 additions and 8 deletions

View File

@@ -23,8 +23,9 @@ func Online(name string) (err error) {
}
var body struct {
Id int32 `json:"id"`
Secret string `json:"secret"`
Id int32 `json:"id"`
Secret string `json:"secret"`
Permits []core.PermitDef `json:"permits"`
}
err = json.Unmarshal([]byte(resp), &body)
if err != nil {
@@ -33,6 +34,9 @@ func Online(name string) (err error) {
app.Id = body.Id
app.PlatformSecret = body.Secret
for _, def := range body.Permits {
app.Permits.Store(def.Id, &def.Permit)
}
return nil
}