diff --git a/backend/src/logic4country/delete.go b/backend/src/logic4country/delete.go index 7ba90fd..3ce4909 100644 --- a/backend/src/logic4country/delete.go +++ b/backend/src/logic4country/delete.go @@ -137,6 +137,26 @@ func DeleteHandler(c *gin.Context) { return } + // 新增:3.4 更新flag表(软删除国旗信息) + _, err = tx.Exec("UPDATE country_flag SET deleted = TRUE WHERE country_id = $1", req.CountryID) + if err != nil { + tx.Rollback() + zap.L().Error("❌ country_flag表更新失败", + zap.String("req_id", reqID), + zap.String("country_id", req.CountryID), + zap.Error(err), + ) + c.JSON(http.StatusInternalServerError, DeleteResponse{ + Success: false, + Message: "删除国旗信息失败", + }) + return + } + zap.L().Debug("📝 flag表软删除成功", + zap.String("req_id", reqID), + zap.String("country_id", req.CountryID), + ) + // 提交事务 if err := tx.Commit(); err != nil { tx.Rollback() @@ -165,4 +185,4 @@ func DeleteHandler(c *gin.Context) { Success: true, Message: "删除成功", }) -} +} \ No newline at end of file