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

feat(player): 添加称号重复检查逻辑

防止玩家重复获得相同称号,提升系统稳定性

fix(config): 修复boss配置相关代码问题

- 新增BossController的GetList接口
- 优化import语句顺序
- 修正PetBaseConfig中Desc字段为Remark字段
- 移除Tower配置中的TaskIds冗余字段
- 完善ShopConfig字段注释内容
```
This commit is contained in:
昔念
2026-02-23 12:39:57 +08:00
parent 4fff047c4c
commit 6b316b868c
6 changed files with 30 additions and 3 deletions

View File

@@ -294,6 +294,10 @@ func (p *Player) Cheak(b error) {
} }
func (p *Player) GiveTitle(id uint32) { func (p *Player) GiveTitle(id uint32) {
r := p.Service.Title.Can(id) //已经有了就不给了
if !r {
return
}
p.Service.Title.Give(id) p.Service.Title.Give(id)
p.SendPackCmd(50005, &info.S2C_50005{ p.SendPackCmd(50005, &info.S2C_50005{
Title: id, Title: id,

View File

@@ -3,6 +3,9 @@ package admin
import ( import (
"blazing/cool" "blazing/cool"
"blazing/modules/config/service" "blazing/modules/config/service"
"context"
"github.com/gogf/gf/v2/frame/g"
) )
type BossController struct { type BossController struct {
@@ -20,3 +23,14 @@ func init() {
// 注册路由 // 注册路由
cool.RegisterController(task_info_controller) cool.RegisterController(task_info_controller)
} }
type GetListReq struct {
g.Meta `path:"/getlist" method:"POST"`
Id uint32 `json:"id" v:"required#请选择要查询的数据"`
}
func (this *BossController) GetList(ctx context.Context, req *GetListReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
res.Data = service.NewBossService().GetList(req.Id)
return res, nil
}

View File

@@ -37,7 +37,7 @@ type PetBaseConfig struct {
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"` SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
Desc *string `gorm:"comment:'BOSS描述'" json:"desc"` Remark string `gorm:"comment:'BOSS备注'" json:"remark"`
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"` // ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
// // ===================== BOSS奖励规则Boss_bonus ===================== // // ===================== BOSS奖励规则Boss_bonus =====================

View File

@@ -27,7 +27,7 @@ type ShopConfig struct {
Stock uint32 `gorm:"not null;default:0;comment:'商品库存数量0表示无限库存'" json:"stock" description:"库存数量"` Stock uint32 `gorm:"not null;default:0;comment:'商品库存数量0表示无限库存'" json:"stock" description:"库存数量"`
// 限购信息 // 限购信息
QuotaLimit uint32 `gorm:"not null;default:0;comment:'单位时间内的限购数量0表示不限购'" json:"quota_limit" description:"限购数量"` QuotaLimit uint32 `gorm:"not null;default:0;comment:'单位时间内的限购数量'" json:"quota_limit" description:"限购数量"`
//限购类型 //限购类型
QuotaType uint32 `gorm:"not null;default:0;comment:'限购类型(0-不限购 1-每日限购 2-每周限购 3-每月限购)'" json:"quota_type" description:"限购类型"` QuotaType uint32 `gorm:"not null;default:0;comment:'限购类型(0-不限购 1-每日限购 2-每周限购 3-每月限购)'" json:"quota_type" description:"限购类型"`
} }

View File

@@ -19,7 +19,6 @@ type BaseTowerConfig struct {
// 核心必填字段(所有塔类型通用) // 核心必填字段(所有塔类型通用)
TowerLevel uint32 `gorm:"not null;default:0;uniqueIndex;comment:'塔层数(唯一标识每层配置)'" json:"tower_level" description:"塔层数"` TowerLevel uint32 `gorm:"not null;default:0;uniqueIndex;comment:'塔层数(唯一标识每层配置)'" json:"tower_level" description:"塔层数"`
BossIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定BOSS ID数组关联config_pet_boss表主键'" json:"boss_ids" description:"绑定BOSS数组"` BossIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定BOSS ID数组关联config_pet_boss表主键'" json:"boss_ids" description:"绑定BOSS数组"`
TaskIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定任务ID数组关联config_task表主键'" json:"task_ids" description:"绑定任务数组"`
} }
// NewBaseTowerConfig 创建基础塔配置实例(所有塔类型共用) // NewBaseTowerConfig 创建基础塔配置实例(所有塔类型共用)

View File

@@ -30,3 +30,13 @@ func (s *BossService) Get(id uint32) *model.BossConfig {
return item return item
} }
func (s *BossService) GetList(id uint32) []model.BossConfig {
var ret []model.BossConfig
// 执行 Raw SQL 并扫描返回值
dbm_nocache_noenable(s.Model).
Wheref(`map_id @> ARRAY[?]::integer[]`, id).WhereOrf(`map_id @> ARRAY[?]::integer[]`, 0).Scan(&ret)
return ret
}