1
This commit is contained in:
parent
af91d6116f
commit
8786f49b37
@ -55,6 +55,8 @@ func (this *ActivityApi) RollDice(c *gin.Context) {
|
|||||||
Point int32 `json:"point"`
|
Point int32 `json:"point"`
|
||||||
}{}
|
}{}
|
||||||
rspObj.Point = int32(1 + rand.Intn(6))
|
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 = new(vo.SideEffect)
|
||||||
rspObj.SideEffect.User = new(vo.User)
|
rspObj.SideEffect.User = new(vo.User)
|
||||||
rspObj.SideEffect.User.FromModel(user)
|
rspObj.SideEffect.User.FromModel(user)
|
||||||
|
@ -25,3 +25,7 @@ const (
|
|||||||
MSG_LOGIN = iota
|
MSG_LOGIN = iota
|
||||||
MSG_CREATE_USER
|
MSG_CREATE_USER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VIRTUAL_ITEM_SCORE = 20001
|
||||||
|
)
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package vo
|
package vo
|
||||||
|
|
||||||
|
import (
|
||||||
|
"q5"
|
||||||
|
)
|
||||||
|
|
||||||
type BaseVo struct {
|
type BaseVo struct {
|
||||||
ErrCode int32 `json:"errcode"`
|
ErrCode int32 `json:"errcode"`
|
||||||
ErrMsg string `json:"errcmsg"`
|
ErrMsg string `json:"errcmsg"`
|
||||||
@ -13,10 +17,15 @@ type AwardItem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Award struct {
|
type Award struct {
|
||||||
Items []AwardItem `json:"items"`
|
Items []*AwardItem `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SideEffect struct {
|
type SideEffect struct {
|
||||||
User *User `json:"user_info"`
|
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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user