```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

fix(fight): 修复战斗效果类型初始化错误

- 将EffectType.NewSel更改为EffectType.Skill以修正技能效果类型
- 移除effect_415中的多余变量声明,直接使用参数值进行治疗计算

feat(admin): 添加用户金币增加功能

- 新增UserGoldAddReq结构体用于处理金币添加请求
- 实现GoldAdd方法支持管理员为指定用户增加金币

feat(pet):
This commit is contained in:
昔念
2026-03-10 20:51:48 +08:00
parent ab2ebcd56d
commit 69350bb79e
27 changed files with 50 additions and 41 deletions

View File

@@ -69,7 +69,7 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
if playerinfo != nil {
res.IsReg = 1
if t1.DepartmentID == 35 { ///抢先服玩家3天没登录衰退
if playerinfo.UpdateTime.AddDate(0, 0, 3).Before(gtime.Now()) {
t1.DepartmentID = 1
service.NewBaseSysUserService().SetdepartmentId(uint32(t1.ID), 1)
@@ -137,3 +137,17 @@ func (c *BaseSysUserController) Regrobot(ctx context.Context, req *RegReq) (res
type RegRes struct {
Session string `json:"session"`
}
type UserGoldAddReq struct {
g.Meta `path:"/goldadd" method:"GET"`
Authorization string `json:"Authorization" in:"header"`
UserID int `json:"userid"`
Gold float32 `json:"gold"`
}
func (c *BaseSysUserController) GoldAdd(ctx context.Context, req *UserGoldAddReq) (res *cool.BaseRes, err error) {
service.NewBaseSysUserService().UpdateGold(uint32(req.UserID), int64(req.Gold*100))
res = cool.Ok(nil)
return
}

View File

@@ -28,6 +28,8 @@ type Pet struct {
PlayerID uint32 `gorm:"not null;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"`
Free int `gorm:"not null;default:0;comment:'是否放生'" json:"free"` //"0为放入仓库1为放入背包
CatchTime uint32 `gorm:"not null;comment:'捕捉时间'" json:"catch_time"` //唯一键
IsSale int `gorm:"not null;default:0;comment:'是否出售'" json:"is_sale"`
SalePrice int `gorm:"not null;default:0;comment:'出售价格'" json:"sale_price"`
// Owner uint32 `struc:"skip"` //仅作为存储
// FreedTime uint32 `struc:"skip"` //放生时间
//是否可交易这里应该定义在精灵ID里

View File

@@ -174,16 +174,10 @@ func NewPetService(userid uint32) *PetService {
admin = cool.GetAdmin(ctx)
userId = admin.UserId
)
if userId != 10001 {
return [][]interface{}{
{"player_id", userId, true},
{"free", 1, true},
}
} else {
return [][]interface{}{
// {"player_id", userId, true},
// {"free", 1, true},
}
return [][]interface{}{
{"player_id", userId, true},
{"free", 1, true},
{"is_vip", 0, true},
}
},