fix 修复watch更新数据库时,没指定uid的bug

This commit is contained in:
timerzz 2024-04-12 14:53:30 +08:00
parent d3ead81583
commit e20ca6aab0

View File

@ -86,7 +86,7 @@ func (c *CoachOutlet) Restart() {
}
func (c *CoachOutlet) Watch() {
c.ctx, c.cancel = context.WithCancel(c.fCtx)
if err := c.db.Model(&model.Product{}).Updates(map[string]interface{}{"watch": true, "orderable": false}).Error; err != nil {
if err := c.db.Model(&model.Product{}).Where("uid", c.Uid()).Updates(map[string]interface{}{"watch": true, "orderable": false}).Error; err != nil {
glog.Errorf("watch update db err: %v", err)
err = nil
}