refactor(internal): 优化 OSS 预签名 URL 缓存刷新任务和英雄数据缓存逻辑

- 注释掉 OSS预签名 URL 缓存刷新任务的定时执行代码
- 在 hero/hero.go 中增加对 Redis缓存和英雄数据集的非空校验
- 修改 OSS预签名 URL 生成逻辑,自动替换为 CDN 域名
This commit is contained in:
hu xiaotong
2025-07-25 17:08:39 +08:00
parent ce0fa7f2ed
commit fc41c5ca73
75 changed files with 1970 additions and 1261 deletions

View File

@@ -3,6 +3,7 @@ package cron
import (
"context"
"epic/internal/dao"
"epic/internal/logic/i18n"
"epic/internal/model/entity"
"epic/internal/service"
"epic/internal/util"
@@ -173,13 +174,6 @@ func (l *Logic) registerDefaultJobs(ctx context.Context) error {
return err
}
// 每30分钟执行一次OSS预签名URL缓存刷新任务
//if err := l.AddJob(ctx, "oss_presignurl_refresh", "0 0/30 * * * *", func() {
// l.refreshOssPresignUrlCacheJob(ctx)
//}); err != nil {
// return err
//}
// 每5天执行一次角色配装信息刷新任务
if err := l.AddJob(ctx, "hero_set_refresh_5days", "0 0 0 */5 * *", func() {
l.refreshHeroSetContent(ctx)
@@ -187,6 +181,18 @@ func (l *Logic) registerDefaultJobs(ctx context.Context) error {
return err
}
// 每天凌晨2点同步i18n远程翻译数据
if err := l.AddJob(ctx, "i18n_remote_sync", "0 0 2 * * *", func() {
g.Log().Info(ctx, "开始同步i18n远程翻译数据...")
if err := i18n.GetI18nLogic().SyncI18nFromRemote(ctx); err != nil {
g.Log().Error(ctx, "i18n远程翻译数据同步失败:", err)
} else {
g.Log().Info(ctx, "i18n远程翻译数据同步完成")
}
}); err != nil {
return err
}
return nil
}
@@ -203,7 +209,7 @@ func (l *Logic) syncDataFromThirdParty(ctx context.Context) {
g.Log().Info(ctx, "Data sync completed")
}
//同步英雄数据
// 同步英雄数据
func (l *Logic) syncHeroData(ctx context.Context) {
g.Log().Info(ctx, "Starting hero data sync...")
@@ -215,7 +221,7 @@ func (l *Logic) syncHeroData(ctx context.Context) {
g.Log().Info(ctx, "Hero data sync completed")
}
//同步神器数据
// 同步神器数据
func (l *Logic) syncArtifactData(ctx context.Context) {
g.Log().Info(ctx, "Starting artifact data sync...")