show sql error message

This commit is contained in:
RockYang
2024-08-05 16:14:44 +08:00
parent 3f0252b498
commit 72b1515b68
22 changed files with 115 additions and 130 deletions

View File

@@ -92,10 +92,9 @@ func (h *OrderHandler) Remove(c *gin.Context) {
return
}
res = h.DB.Unscoped().Where("id = ?", id).Delete(&model.Order{})
err := h.DB.Unscoped().Where("id = ?", id).Delete(&model.Order{}).Error
if res.Error != nil {
logger.Error("error with update database", res.Error)
resp.ERROR(c, "更新数据库失败!")
resp.ERROR(c, err.Error())
return
}
}