Browse Source

Fix the soft delete bug.

master
lishuang 5 years ago
parent
commit
a92e172d26
  1. 4
      code/rest/matter_dao.go
  2. 2
      code/support/tank_context.go

4
code/rest/matter_dao.go

@ -462,13 +462,13 @@ func (this *MatterDao) SoftDelete(matter *Matter) {
}
//soft delete from db.
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matter.Uuid).Update(map[string]interface{}{"deleted": 1, "delete_time": time.Now()})
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matter.Uuid).Update(map[string]interface{}{"deleted": true, "delete_time": time.Now()})
this.PanicError(db.Error)
} else {
//soft delete from db.
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matter.Uuid).Update(map[string]interface{}{"deleted": 1, "delete_time": time.Now()})
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matter.Uuid).Update(map[string]interface{}{"deleted": true, "delete_time": time.Now()})
this.PanicError(db.Error)
//no need to delete its image cache.

2
code/support/tank_context.go

@ -77,7 +77,7 @@ func (this *TankContext) OpenDb() {
core.LOGGER.Panic("failed to connect mysql database")
}
//whether open the db log. (only true when debug)
//whether open the db sql log. (only true when debug)
this.db.LogMode(false)
}

Loading…
Cancel
Save