1
This commit is contained in:
parent
c0673007d3
commit
3f17b23e6b
@ -54,6 +54,16 @@ func (this *ActivityApi) RollDice(c *gin.Context) {
|
||||
f5.RspErr(c, 500, "server internal error4")
|
||||
return
|
||||
}
|
||||
if reqJson.ForwardPoint > 0 {
|
||||
if user.SpecDice <= 0 {
|
||||
f5.RspErr(c, 1, "spec dice not enough")
|
||||
return
|
||||
}
|
||||
if err := user.DecSpecDice(1); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error5")
|
||||
return
|
||||
}
|
||||
}
|
||||
if err := user.DecDice(1); err != nil {
|
||||
f5.RspErr(c, 500, "server internal error5")
|
||||
return
|
||||
|
@ -90,6 +90,19 @@ func (this *User) AddSpecDice(num int32) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) DecSpecDice(num int32) error {
|
||||
if this.Score < int64(num) {
|
||||
return errors.New("")
|
||||
}
|
||||
oldSpecDice := this.SpecDice
|
||||
this.SpecDice -= num
|
||||
if err := this.UpdateFields([]string{"spec_dice"}); err != nil {
|
||||
this.SpecDice = oldSpecDice
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *User) DecScore(num int32) error {
|
||||
if this.Score < int64(num) {
|
||||
return errors.New("")
|
||||
|
Loading…
x
Reference in New Issue
Block a user