1
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
昔念
2026-04-02 12:38:51 +08:00
parent 6aa601bb06
commit 2f220bb863
2 changed files with 44 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
package admin
package admin
import (
"blazing/common/data"
@@ -20,13 +20,12 @@ type PetGetReq struct {
g.Meta `path:"/genpet" method:"POST"`
UserID uint32 `json:"user_id"`
IsVIP int `json:"is_vip"`
// 新增:精灵相关参数(完全对齐自定义表单配置)
PetTypeId int `json:"petTypeId" v:"required|min:1" comment:"精灵类型ID必填正整数最小1无0或负数类型对应GenPetInfo的id参数"`
IndividualValue int `json:"individualValue" v:"required|between:-1,31" comment:"精灵个体值,必填,范围-1~31-1表示随机生成满个体0~31为固定值决定基础属性上限"`
NatureId int `json:"natureId" v:"required|between:-1,24" comment:"精灵性格ID必填范围-1~24-1表示随机0~24对应25种固定性格影响属性加成"`
AbilityTypeEnum int `json:"abilityTypeEnum" v:"required|min:-1" comment:"精灵特性类型ID必填最小值-1-1表示随机选择1个特性0及以上为固定特性ID需与PlayerEffectMAP匹配"`
IsShiny int `json:"isShiny" v:"min:-1" comment:"精灵异色闪光ID必填最小值-1-1表示随机0及以上为固定异色状态稀有精灵特殊外观/属性原表单hidden但需保留必填逻辑"`
Level int `json:"level" v:"required|between:1,100" comment:"精灵等级必填范围1~100常规游戏等级上限影响精灵当前属性强度"`
// 閺傛澘顤冮敍姘辩翱閻忕數娴夐崗鍐插棘閺佸府绱欑€瑰苯鍙忕€靛綊缍堥懛顏勭暰娑斿銆冮崡鏇㈠帳缂冾噯绱? PetTypeId int `json:"petTypeId" v:"required|min:1" comment:"缁墽浼掔猾璇茬€稩D閿涘苯绻€婵夘偓绱濆锝嗘殻閺佸府绱欓張鈧亸?閿涘本妫?閹存牞绀嬮弫鎵閸ㄥ绱氶敍灞筋嚠鎼存摜enPetInfo閻ㄥ埇d閸欏倹鏆?`
IndividualValue int `json:"individualValue" v:"required|between:-1,31" comment:"缁墽浼掓稉顏冪秼閸婄》绱濊箛鍛綖閿涘矁瀵栭崶?1~31閿?1鐞涖劎銇氶梾蹇旀簚閻㈢喐鍨氬鈥查嚋娴搫绱?~31娑撳搫娴愮€规艾鈧》绱濋崘鍐茬暰閸╄櫣顢呯仦鐐粹偓褌绗傞梽鎰剁礆"`
NatureId int `json:"natureId" v:"required|between:-1,24" comment:"缁墽浼掗幀褎鐗窱D閿涘苯绻€婵夘偓绱濋懠鍐ㄦ纯-1~24閿?1鐞涖劎銇氶梾蹇旀簚閿?~24鐎电懓绨?5缁夊秴娴愮€规碍鈧勭壐閿涘苯濂栭崫宥呯潣閹冨閹存劧绱?`
AbilityTypeEnum int `json:"abilityTypeEnum" v:"required|min:-1" comment:"缁墽浼掗悧瑙勨偓褏琚崹濠璂閿涘苯绻€婵夘偓绱濋張鈧亸蹇撯偓?1閿?1鐞涖劎銇氶梾蹇旀簚闁瀚?娑擃亞澹掗幀褝绱?閸欏﹣浜掓稉濠佽礋閸ュ搫鐣鹃悧瑙勨偓顪廌閿涘矂娓舵稉宥眑ayerEffectMAP閸栧綊鍘ら敍?`
IsShiny int `json:"isShiny" v:"min:-1" comment:"缁墽浼掑鍌濆閿涘牓妫崗澶涚礆ID閿涘苯绻€婵夘偓绱濋張鈧亸蹇撯偓?1閿?1鐞涖劎銇氶梾蹇旀簚閿?閸欏﹣浜掓稉濠佽礋閸ュ搫鐣惧鍌濆閻樿埖鈧緤绱濈粙鈧張澶岀翱閻忕數澹掑▓濠傤樆鐟?鐏炵偞鈧嶇礆閿涘苯甯悰銊ュ礋hidden娴棝娓舵穱婵堟殌韫囧懎锝為柅鏄忕帆"`
Level int `json:"level" v:"required|between:1,100" comment:"缁墽浼掔粵澶岄獓閿涘苯绻€婵夘偓绱濋懠鍐ㄦ纯1~100閿涘牆鐖剁憴鍕埗閹村繒鐡戠痪褌绗傞梽鎰剁礉瑜板崬鎼风划鍓т紥瑜版挸澧犵仦鐐粹偓褍宸辨惔锔肩礆"`
}
func init() {
@@ -34,10 +33,10 @@ func init() {
&cool.Controller{
Prefix: "/admin/monster/bag",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewPetService(0), //因为page已经过滤所以这里需要改成0
Service: service.NewPetService(0), //閸ョ姳璐焢age瀹歌尙绮℃潻鍥ㄦ姢閿涘本澧嶆禒銉ㄧ箹闁插矂娓剁憰浣规暭閹?
},
}
// 注册路由
// 濞夈劌鍞界捄顖滄暠
cool.RegisterController(task_info_controller)
}
func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res *cool.BaseRes, err error) {
@@ -50,7 +49,7 @@ func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res
t := model.GenPetInfo(
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.Level, shiny, 0)
t.CatchRect = 1 //代表这是人工合成的
t.CatchRect = 1 //娴狅綀銆冩潻娆愭Ц娴滃搫浼愰崥鍫熷灇閻?
if req.IsShiny == -1 {
t.RandomByWeightShiny()
}
@@ -79,13 +78,25 @@ func (c *PetBagController) Level(ctx context.Context, req *PetLevelReq) (res *co
}
type PetStorageReq struct {
g.Meta `path:"/storage" method:"POST"`
IsVIP int `json:"is_vip"`
}
func (c *PetBagController) Storage(ctx context.Context, req *PetStorageReq) (res *cool.BaseRes, err error) {
admin := cool.GetAdmin(ctx)
res = &cool.BaseRes{}
res.Data = service.NewPetService(uint32(admin.UserId)).StorageInfo(req.IsVIP)
return
}
type PetLevelReq struct {
g.Meta `path:"/getlevel" method:"GET"`
// 新增:精灵相关参数(完全对齐自定义表单配置)
}
// 閺傛澘顤冮敍姘辩翱閻忕數娴夐崗鍐插棘閺佸府绱欑€瑰苯鍙忕€靛綊缍堥懛顏勭暰娑斿銆冮崡鏇㈠帳缂冾噯绱?}
type PetLevelRes struct {
UserID int `json:"user_id"`
//等级PetLevelRes
//缁涘楠嘝etLevelRes
Level int `json:"level"`
//ID
ID int `json:"id"`
@@ -107,7 +118,7 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
if req.Free == 2 {
if base.NewBaseSysUserService().GetFreeGold(admin.UserId) < 0 {
err = fmt.Errorf("金币不足")
err = fmt.Errorf("闁叉垵绔垫稉宥堝喕")
return
}
@@ -133,3 +144,4 @@ func (c *PetBagController) BuyPet(ctx context.Context, req *BuyPetReq) (res *coo
return
}