feat(hero): 新增英雄相关接口和功能

- 新增英雄信息获取接口和相关逻辑
- 实现英雄列表和详情查询功能- 添加英雄相关数据结构和VO对象
- 更新项目结构,移除不必要的文件
This commit is contained in:
hxt
2025-06-21 20:12:02 +08:00
parent 85e3a6540b
commit c5c273f0ab
19 changed files with 374 additions and 66 deletions

34
internal/service/hero.go Normal file
View File

@@ -0,0 +1,34 @@
package service
import (
"context"
v1 "epic/api/hero/v1"
"epic/internal/model/entity"
)
// HeroService 定义了英雄相关的业务接口
type HeroService interface {
// GetHeroByCode 根据 code 查询角色信息
GetHeroByCode(ctx context.Context, code string) (*entity.EpicHeroInfo, error)
GetHeroList(ctx context.Context) ([]*v1.EpicHeroVO, error)
GetHeroDetailByCode(ctx context.Context, code string) (*v1.HeroDetailVO, error)
// ClearHeroCache 清理英雄相关缓存
ClearHeroCache(ctx context.Context, code string) error
}
var heroService HeroService
// Hero 返回 HeroService 的实例
func Hero() HeroService {
if heroService == nil {
panic("implement not found for interface HeroService")
}
return heroService
}
// SetHero 注册 HeroService 实现
func SetHero(s HeroService) {
heroService = s
}