i18n翻译

This commit is contained in:
hu xiaotong
2025-07-11 17:09:24 +08:00
parent 9293db3809
commit 4ac2072fce
9 changed files with 733 additions and 48 deletions

View File

@@ -7,7 +7,7 @@ import (
"epic/internal/model/dto"
"epic/internal/model/entity"
"epic/internal/service"
"epic/utility"
"epic/internal/util"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
@@ -46,9 +46,9 @@ func (l *Logic) GetHeroByCode(ctx context.Context, code string) (*entity.EpicHer
// GetHeroList 查询所有英雄信息,并按创建时间倒序排列
func (l *Logic) GetHeroList(ctx context.Context) ([]*v1.EpicHeroVO, error) {
//utility.RedisCache.Set(ctx, "epic_artifact_map_key111", "122", 1000*time.Second)
//utility.RedisCache.Set(ctx, "epic_artifact_map_key222", "6565", 0)
//fmt.Println(utility.RedisCache.Get(ctx, "NAME"))
//util.RedisCache.Set(ctx, "epic_artifact_map_key111", "122", 1000*time.Second)
//util.RedisCache.Set(ctx, "epic_artifact_map_key222", "6565", 0)
//fmt.Println(util.RedisCache.Get(ctx, "NAME"))
var (
doList []*entity.EpicHeroInfo // 数据库原始结构
@@ -117,7 +117,7 @@ func (l *Logic) GetHeroDetailByCode(ctx context.Context, code string) (*v1.HeroD
// 优化:先查 RedisCache再查数据库
cacheKey := "epic_hero_set:" + code
jsonContent, err := utility.RedisCache.Get(ctx, cacheKey)
jsonContent, err := util.RedisCache.Get(ctx, cacheKey)
if err == nil && !jsonContent.IsEmpty() {
fribbleHeroSet = &entity.FribbleHeroSet{
HeroCode: code,
@@ -131,7 +131,7 @@ func (l *Logic) GetHeroDetailByCode(ctx context.Context, code string) (*v1.HeroD
return nil, err
}
// 写入 Redis 缓存1小时
utility.RedisCache.Set(ctx, cacheKey, fribbleHeroSet.JsonContent, 0)
util.RedisCache.Set(ctx, cacheKey, fribbleHeroSet.JsonContent, 0)
}
// 解析 JsonContent 字段