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

15
api/hero/hero.go Normal file
View File

@@ -0,0 +1,15 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package hero
import (
"context"
v1 "epic/api/hero/v1"
)
type IHeroV1 interface {
GetOne(ctx context.Context, req *v1.GetOneReq) (res *v1.GetOneRes, err error)
GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error)
}

30
api/hero/v1/hero.go Normal file
View File

@@ -0,0 +1,30 @@
package v1
import (
"epic/internal/model/entity"
"github.com/gogf/gf/v2/frame/g"
)
type GetOneReq struct {
g.Meta `path:"/getOne" method:"get" tags:"Hero" summary:"Get one hero"`
Code string `v:"required" dc:"角色code"`
}
type GetOneRes struct {
*entity.EpicHeroInfo
}
// GetListReq GetListRes 列表返回所有角色
type GetListReq struct {
g.Meta `path:"/getList" method:"get" tags:"Hero" summary:"Get all hero"`
}
type GetListRes struct {
Records []*EpicHeroVO `json:"list"` // ✅ 返回一个数组
}
type GetDetailReq struct {
g.Meta `path:"/getDetail" method:"get" tags:"Hero" summary:"Get hero detail by code"`
Code string `v:"required" dc:"角色code"`
}
type GetDetailRes struct {
Data *HeroDetailVO `json:"data"`
}

99
api/hero/v1/vo.go Normal file
View File

@@ -0,0 +1,99 @@
package v1
type EpicHeroVO struct {
Id int64 `json:"id" orm:"id" description:"文件编号"` // 文件编号
HeroName string `json:"heroName" orm:"hero_name" description:"配置编号"` // 配置编号
HeroCode string `json:"heroCode" orm:"hero_code" description:"文件名"` // 文件名
HeroAttrLv60 string `json:"heroAttrLv60" orm:"hero_attr_lv60" description:"文件路径"` // 文件路径
NickName string `json:"nickName" orm:"nick_name" description:"配置编号"` // 配置编号
Rarity string `json:"rarity" orm:"rarity" description:"配置编号"` // 配置编号
Role string `json:"role" orm:"role" description:"配置编号"` // 配置编号
Zodiac string `json:"zodiac" orm:"zodiac" description:"配置编号"` // 配置编号
HeadImgUrl string `json:"headImgUrl" orm:"head_img_url" description:"配置编号"` // 配置编号
Attribute string `json:"attribute" orm:"attribute" description:"配置编号"` // 配置编号
Remark string `json:"remark" orm:"remark" description:"配置编号"` // 配置编号
}
// HeroRespSimpleVO 简要信息
type HeroRespSimpleVO struct {
Id string `json:"id"`
HeroCode string `json:"heroCode"`
HeroName string `json:"heroName"`
NickName string `json:"nickName"`
HeadImgUrl string `json:"headImgUrl"`
Stars int `json:"stars"`
Role string `json:"role"`
Attribute string `json:"attribute"`
}
// Hero60AttributeVO 基础属性
type Hero60AttributeVO struct {
Cp int `json:"cp"`
Atk int `json:"atk"`
Hp int `json:"hp"`
Spd int `json:"spd"`
Def int `json:"def"`
Chc float64 `json:"chc"`
Chd float64 `json:"chd"`
Dac float64 `json:"dac"`
Eff float64 `json:"eff"`
Efr float64 `json:"efr"`
}
// HeroSetAvgVO 平均属性
type HeroSetAvgVO struct {
Cp int `json:"cp"`
Atk int `json:"atk"`
Hp int `json:"hp"`
Spd int `json:"spd"`
Def int `json:"def"`
Chc float64 `json:"chc"`
Chd float64 `json:"chd"`
Dac float64 `json:"dac"`
Eff float64 `json:"eff"`
Efr float64 `json:"efr"`
}
// HeroSetPercentVO 套装百分比
type HeroSetPercentVO struct {
SetName string `json:"setName"`
Percent float64 `json:"percent"`
}
// HeroArtifactPercentVO 神器百分比
type HeroArtifactPercentVO struct {
ArtifactCode string `json:"artifactCode"`
ArtifactName string `json:"artifactName"`
Rarity string `json:"rarity"`
Role string `json:"role"`
ImageUrl string `json:"imageUrl"`
Percent float64 `json:"percent"`
}
// HeroSetShowVO 展示用的装备数据
type HeroSetShowVO struct {
Cp int `json:"cp"`
Atk int `json:"atk"`
Hp int `json:"hp"`
Spd int `json:"spd"`
Def int `json:"def"`
Chc float64 `json:"chc"`
Chd float64 `json:"chd"`
Dac float64 `json:"dac"`
Eff float64 `json:"eff"`
Efr float64 `json:"efr"`
Hds string `json:"hds"`
Ctr string `json:"ctr"`
ArfName string `json:"arfName"`
ArfPic string `json:"arfPic"`
}
// HeroDetailVO 角色详情主对象
type HeroDetailVO struct {
HeroRespSimpleVO *HeroRespSimpleVO `json:"heroRespSimpleVO"`
Hero60AttributeVO *Hero60AttributeVO `json:"hero60AttributeVO"`
HeroSetAvgVO *HeroSetAvgVO `json:"heroSetAvgVO"`
HeroSetPercentVOS []*HeroSetPercentVO `json:"heroSetPercentVOS"`
HeroArtifactPercentVOS []*HeroArtifactPercentVO `json:"heroArtifactPercentVOS"`
HeroSetShows []*HeroSetShowVO `json:"heroSetShows"`
}