Fix legacy unit schema migration

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-06-28 01:20:05 +08:00
parent b276fada4b
commit 1bb8f20c88
5 changed files with 29 additions and 1 deletions
+15 -1
View File
@@ -188,12 +188,20 @@ func (ss *Session) GetLiveInfo(LiveDifficultyID int) (bool, *liveschema.LiveInfo
}
func (ss *Session) GetDeckInfo(deckID int) (bool, *liverecordschema.DeckInfo) {
if ss.UserEng == nil {
return false, nil
}
// 卡片信息
totalHp, totalSmile, totalCute, totalCool := 0, 0, 0, 0
unitData := []liverecordschema.UnitList{}
units := ss.GetUserDeckUnit(deckID)
for _, u := range units {
_, uData := ss.GetUnitInfo(u.UnitID)
has, uData := ss.GetUnitInfo(u.UnitID)
if !has || uData == nil {
return false, nil
}
tempUnitData := liverecordschema.UnitList{
UnitID: u.UnitID,
Position: u.Position,
@@ -225,10 +233,16 @@ func (ss *Session) GetDeckInfo(deckID int) (bool, *liverecordschema.DeckInfo) {
// 技能宝石信息
skillData := ss.GetUserUnitSkillEquipID(u.UnitOwningUserID)
if ss.UserEng == nil {
return false, nil
}
tempUnitData.RemovableSkillIds = skillData
// 饰品信息
has, accessoryData := ss.GetUserAccessoryInfoByUnitOwningUserID(u.UnitOwningUserID)
if ss.UserEng == nil {
return false, nil
}
if has {
tempUnitData.AccessoryInfo = accessoryData
}