1
This commit is contained in:
parent
10c086f082
commit
398b6f5aa8
@ -66,6 +66,20 @@ func (this *User) DecDice(num int32) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) DecScore(num int32) error {
|
||||
if this.Score < int64(num) {
|
||||
return errors.New("")
|
||||
}
|
||||
oldScore := this.Score
|
||||
this.Score -= int64(num)
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
"score").Updates(this); result.Error != nil {
|
||||
this.Score = oldScore
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) AddScore(score int32) error {
|
||||
if score <= 0 {
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user