Scope unit and accessory data to owning users

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-07-13 08:03:10 +08:00
parent 16ab2549d7
commit 96b7951ee1
14 changed files with 67 additions and 21 deletions
@@ -35,12 +35,21 @@ func removableSkillEquipment(ctx *gin.Context) {
// 佩戴宝石
for _, v := range req.Equip {
// fmt.Println("Equip:", v.UnitOwningUserID, v.UnitRemovableSkillID)
exists, err := ss.HasUserUnit(v.UnitOwningUserID)
if ss.CheckErr(err) {
return
}
if !exists {
ss.AbortWithStatus(http.StatusNotFound, honokautils.NewNotFoundContent(ctx.Request.URL.Path))
return
}
data := unitschema.RemovableSkillEquipmentData{
UnitRemovableSkillId: v.UnitRemovableSkillID,
UnitOwningUserID: v.UnitOwningUserID,
UserID: ss.UserID,
}
_, err := ss.UserEng.Table("user_unit_skill_equip").Insert(&data)
_, err = ss.UserEng.Table("user_unit_skill_equip").Insert(&data)
if ss.CheckErr(err) {
return
}