UpdateStatus 更新点赞状态
(newStatus int8)
| 67 | |
| 68 | // UpdateStatus 更新点赞状态 |
| 69 | func (l *Like) UpdateStatus(newStatus int8) error { |
| 70 | if newStatus != LikeStatusActive && newStatus != LikeStatusCancel { |
| 71 | return errors.New("无效的状态值") |
| 72 | } |
| 73 | |
| 74 | l.Status = newStatus |
| 75 | return DB.Model(l).Updates(map[string]interface{}{ |
| 76 | "status": l.Status, |
| 77 | }).Error |
| 78 | } |
| 79 | |
| 80 | // Delete 软删除(更新状态为取消) |
| 81 | func (l *Like) Delete() error { |
no test coverage detected