This commit is contained in:
aozhiwei 2024-11-22 14:32:37 +08:00
parent c5b91836dc
commit ce2a598c42
3 changed files with 5 additions and 7 deletions

View File

@ -11,8 +11,7 @@ type Buff struct {
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
AccountId string `gorm:"column:account_id;primaryKey"`
BuffId int32 `gorm:"column:buff_id"`
StartTime int32 `gorm:"column:start_time"`
EffectiveTime int32 `gorm:"column:effective_time"`
ExpiresTime int32 `gorm:"column:expires_time"`
CreateTime int32 `gorm:"column:createtime;<-:create"`
ModifyTime int32 `gorm:"column:modifytime"`
}

View File

@ -41,13 +41,12 @@ func (this *buff) Add(accountId string, buffList []int32) {
if isCreate {
buffModel.AccountId = accountId
buffModel.BuffId = buffMeta.GetBuffId()
buffModel.StartTime = nowTime
buffModel.EffectiveTime = buffMeta.GetDurationTime()
buffModel.ExpiresTime = nowTime + buffMeta.GetDurationTime()
buffModel.CreateTime = nowTime
buffModel.ModifyTime = nowTime
buffModel.Create()
} else {
if nowTime - buffModel.StartTime > buffModel.EffectiveTime {
if nowTime > buffModel.ExpiresTime {
}
}

View File

@ -8,11 +8,11 @@ import (
type Buff struct {
BuffUniId string `json:"buff_uniid"`
BuffId int32 `json:"buff_id"`
DurationTime int32 `json:"duration_time"`
ExpiresTime int32 `json:"expires_time"`
}
func (this *Buff) FromModel(m *model.Buff) {
this.BuffUniId = q5.ToString(m.Idx)
this.BuffId = m.BuffId
//this.ItemNum = m.
this.ExpiresTime = m.ExpiresTime
}