gorm更新字段值+1或-1
func (xy *XJGYTopic) AdUpdateSignUpNum(id int64) bool { if xy.ID <= 0 { return false } if err := Db.Model(xy).Where("id = ? ", id).Update("sign_up_num", gorm.Expr("sign_up_num+ ?", 1)).Error; err != nil { return false } return true }
func (xy *XJGYTopic) AdUpdateSignUpNum(id int64) bool { if xy.ID <= 0 { return false } if err := Db.Model(xy).Where("id = ? ", id).Update("sign_up_num", gorm.Expr("sign_up_num+ ?", 1)).Error; err != nil { return false } return true }