feat(cron): 添加角色配装信息刷新任务并优化神器数据同步功能
- 新增每5天执行一次的角色配装信息刷新任务 - 重构神器数据同步功能,优化数据处理和保存逻辑- 添加神器图片URL获取和上传逻辑 - 更新相关测试用例
This commit is contained in:
@@ -180,6 +180,13 @@ func (l *Logic) registerDefaultJobs(ctx context.Context) error {
|
||||
// return err
|
||||
//}
|
||||
|
||||
// 每5天执行一次角色配装信息刷新任务
|
||||
if err := l.AddJob(ctx, "hero_set_refresh_5days", "0 0 0 */5 * *", func() {
|
||||
l.refreshHeroSetContent(ctx)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -196,7 +203,7 @@ func (l *Logic) syncDataFromThirdParty(ctx context.Context) {
|
||||
g.Log().Info(ctx, "Data sync completed")
|
||||
}
|
||||
|
||||
// syncHeroData 同步英雄数据
|
||||
//同步英雄数据
|
||||
func (l *Logic) syncHeroData(ctx context.Context) {
|
||||
g.Log().Info(ctx, "Starting hero data sync...")
|
||||
|
||||
@@ -284,3 +291,13 @@ func (l *Logic) refreshOssPresignUrlCacheJob(ctx context.Context) {
|
||||
g.Log().Info(ctx, "OSS presigned URL cache refresh completed")
|
||||
}
|
||||
}
|
||||
|
||||
// 新增:定时刷新角色配装信息
|
||||
func (l *Logic) refreshHeroSetContent(ctx context.Context) {
|
||||
g.Log().Info(ctx, "Starting hero set content refresh...")
|
||||
if err := l.sync.RefreshAllHeroSetContent(ctx); err != nil {
|
||||
g.Log().Error(ctx, "Hero set content refresh failed:", err)
|
||||
return
|
||||
}
|
||||
g.Log().Info(ctx, "Hero set content refresh completed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user