Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复SignInfo空切片的问题 #1194

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/dice_public.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"net/http"
"time"

"sealdice-core/dice"

Expand Down Expand Up @@ -41,5 +42,7 @@ func dicePublicSet(c echo.Context) error {
myDice.PublicDiceInfoRegister()
myDice.PublicDiceEndpointRefresh()
myDice.PublicDiceSetupTick()
myDice.LastUpdatedTime = time.Now().Unix()
myDice.Save(false)
return Success(&c, Response{})
}
6 changes: 3 additions & 3 deletions dice/platform_adapter_lagrange_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,21 @@ func LagrangeGetSignInfo(dice *Dice) ([]SignInfo, error) {
cachePath := filepath.Join(dice.BaseConfig.DataDir, "extra/SignInfo.cache")
signInfo, err := lagrangeGetSignInfoFromCloud(cachePath)
if err == nil && len(signInfo) > 0 {
copy(signInfoGlobal, signInfo)
signInfoGlobal = append([]SignInfo(nil), signInfo...)
return signInfo, nil
}
dice.Logger.Infof("无法从云端获取SignInfo,即将读取本地缓存数据, 原因: %s", err.Error())

signInfo, err = lagrangeGetSignInfoFromCache(cachePath)
if err == nil && len(signInfo) > 0 {
copy(signInfoGlobal, signInfo)
signInfoGlobal = append([]SignInfo(nil), signInfo...)
return signInfo, nil
}
dice.Logger.Infof("无法从本地缓存获取SignInfo,即将读取内置数据, 原因: %s", err.Error())

if err = json.Unmarshal([]byte(signInfoJson), &signInfo); err == nil {
lagrangeGetSignServerLatency(signInfo)
copy(signInfoGlobal, signInfo)
signInfoGlobal = append([]SignInfo(nil), signInfo...)
return signInfo, nil
}
dice.Logger.Infof("无法从内置数据获取SignInfo,请联系开发者上报问题, 原因: %s", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion dice/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
// APP_CHANNEL 更新频道,stable/dev,在 action 构建时自动注入
APP_CHANNEL = "dev" //nolint:revive

VERSION_CODE = int64(1004100) //nolint:revive
VERSION_CODE = int64(1004101) //nolint:revive

VERSION_JSAPI_COMPATIBLE = []*semver.Version{
VERSION,
Expand Down
Loading