1
This commit is contained in:
parent
e390bcfb03
commit
eded5d0f8a
@ -2,7 +2,9 @@ package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"errors"
|
||||
"main/constant"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Buff struct {
|
||||
@ -25,3 +27,21 @@ func (this *Buff) Create() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Buff) UpdateFields(fields []string) error {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Model(this).Select(
|
||||
fields).Updates(this); result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *Buff) FindByBuffUniId(accountId string, buffUniId int64) (error, bool) {
|
||||
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
|
||||
this, "account_id = ? and idx = ?", accountId, buffUniId); result.Error != nil &&
|
||||
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return result.Error, false
|
||||
} else {
|
||||
return nil, result.RowsAffected > 0
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user