This commit is contained in:
aozhiwei 2024-11-11 15:55:09 +08:00
parent af91d6116f
commit 8786f49b37
3 changed files with 17 additions and 2 deletions

View File

@ -55,6 +55,8 @@ func (this *ActivityApi) RollDice(c *gin.Context) {
Point int32 `json:"point"`
}{}
rspObj.Point = int32(1 + rand.Intn(6))
rspObj.Award = new(vo.Award)
rspObj.Award.AddItem(constant.VIRTUAL_ITEM_SCORE, score)
rspObj.SideEffect = new(vo.SideEffect)
rspObj.SideEffect.User = new(vo.User)
rspObj.SideEffect.User.FromModel(user)

View File

@ -25,3 +25,7 @@ const (
MSG_LOGIN = iota
MSG_CREATE_USER
)
const (
VIRTUAL_ITEM_SCORE = 20001
)

View File

@ -1,5 +1,9 @@
package vo
import (
"q5"
)
type BaseVo struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errcmsg"`
@ -13,10 +17,15 @@ type AwardItem struct {
}
type Award struct {
Items []AwardItem `json:"items"`
Items []*AwardItem `json:"items"`
}
type SideEffect struct {
User *User `json:"user_info"`
Effects []string `json:"side_effect"`
Effects []string `json:"effects"`
}
func (this *Award) AddItem(itemId int32, itemNum int32) {
p := new(AwardItem)
q5.AppendSlice(&this.Items, p)
}