1
This commit is contained in:
parent
2bd2a7a99a
commit
13cc4bf78b
@ -4,6 +4,7 @@ import (
|
||||
"f5"
|
||||
"main/vo"
|
||||
"main/model"
|
||||
"main/mt"
|
||||
)
|
||||
|
||||
type award struct {
|
||||
@ -16,6 +17,10 @@ func (this *award) unInit() {
|
||||
}
|
||||
|
||||
func (this *award) AddItem(accountId string, itemId int32, itemNum int32, baseVo *vo.BaseVo) {
|
||||
itemMeta := mt.Table.Item.GetById(int64(itemId))
|
||||
if itemMeta == nil {
|
||||
return
|
||||
}
|
||||
nowTime := int32(f5.GetApp().GetRealSeconds())
|
||||
bagItem := new(model.Bag)
|
||||
if err, found := bagItem.Find(accountId, itemId); err == nil {
|
||||
@ -29,5 +34,6 @@ func (this *award) AddItem(accountId string, itemId int32, itemNum int32, baseVo
|
||||
bagItem.ModifyTime = nowTime
|
||||
bagItem.Create()
|
||||
}
|
||||
baseVo.GetOrCreateAward().AddItem(itemId, itemNum)
|
||||
}
|
||||
}
|
||||
|
@ -29,3 +29,17 @@ func (this *Award) AddItem(itemId int32, itemNum int32) {
|
||||
p := new(AwardItem)
|
||||
q5.AppendSlice(&this.Items, p)
|
||||
}
|
||||
|
||||
func (this *BaseVo) GetOrCreateAward() *Award {
|
||||
if this.Award == nil {
|
||||
this.Award = new(Award)
|
||||
}
|
||||
return this.Award
|
||||
}
|
||||
|
||||
func (this *BaseVo) GetOrCreateSideEffect() *SideEffect {
|
||||
if this.SideEffect == nil {
|
||||
this.SideEffect = new(SideEffect)
|
||||
}
|
||||
return this.SideEffect
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user