🐛 fix bug

This commit is contained in:
2023-04-27 18:02:38 +08:00
parent 1212e999cc
commit 27daf68736
3 changed files with 14 additions and 4 deletions

View File

@@ -44,7 +44,11 @@ func (w *wine) Update(p entity.Wine) (err error) {
return
}
func (w *wine) Delete(p entity.Wine) (err error) {
err = client.MySQL.Delete(&p).Error
func (w *wine) Delete(p *entity.Wine, ue *entity.User) (err error) {
err = client.MySQL.Table(p.TableName()).Where("wine_id = ? and user_id = ?", p.WineId, ue.Id).Delete(&p).Error
if err != nil {
log.Errorf("删除酒单失败:%s", err.Error())
return
}
return
}