1
This commit is contained in:
parent
c5b91836dc
commit
ce2a598c42
@ -11,8 +11,7 @@ type Buff struct {
|
|||||||
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
|
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
|
||||||
AccountId string `gorm:"column:account_id;primaryKey"`
|
AccountId string `gorm:"column:account_id;primaryKey"`
|
||||||
BuffId int32 `gorm:"column:buff_id"`
|
BuffId int32 `gorm:"column:buff_id"`
|
||||||
StartTime int32 `gorm:"column:start_time"`
|
ExpiresTime int32 `gorm:"column:expires_time"`
|
||||||
EffectiveTime int32 `gorm:"column:effective_time"`
|
|
||||||
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
CreateTime int32 `gorm:"column:createtime;<-:create"`
|
||||||
ModifyTime int32 `gorm:"column:modifytime"`
|
ModifyTime int32 `gorm:"column:modifytime"`
|
||||||
}
|
}
|
||||||
|
@ -41,13 +41,12 @@ func (this *buff) Add(accountId string, buffList []int32) {
|
|||||||
if isCreate {
|
if isCreate {
|
||||||
buffModel.AccountId = accountId
|
buffModel.AccountId = accountId
|
||||||
buffModel.BuffId = buffMeta.GetBuffId()
|
buffModel.BuffId = buffMeta.GetBuffId()
|
||||||
buffModel.StartTime = nowTime
|
buffModel.ExpiresTime = nowTime + buffMeta.GetDurationTime()
|
||||||
buffModel.EffectiveTime = buffMeta.GetDurationTime()
|
|
||||||
buffModel.CreateTime = nowTime
|
buffModel.CreateTime = nowTime
|
||||||
buffModel.ModifyTime = nowTime
|
buffModel.ModifyTime = nowTime
|
||||||
buffModel.Create()
|
buffModel.Create()
|
||||||
} else {
|
} else {
|
||||||
if nowTime - buffModel.StartTime > buffModel.EffectiveTime {
|
if nowTime > buffModel.ExpiresTime {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@ import (
|
|||||||
type Buff struct {
|
type Buff struct {
|
||||||
BuffUniId string `json:"buff_uniid"`
|
BuffUniId string `json:"buff_uniid"`
|
||||||
BuffId int32 `json:"buff_id"`
|
BuffId int32 `json:"buff_id"`
|
||||||
DurationTime int32 `json:"duration_time"`
|
ExpiresTime int32 `json:"expires_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Buff) FromModel(m *model.Buff) {
|
func (this *Buff) FromModel(m *model.Buff) {
|
||||||
this.BuffUniId = q5.ToString(m.Idx)
|
this.BuffUniId = q5.ToString(m.Idx)
|
||||||
this.BuffId = m.BuffId
|
this.BuffId = m.BuffId
|
||||||
//this.ItemNum = m.
|
this.ExpiresTime = m.ExpiresTime
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user