This commit is contained in:
aozhiwei 2024-11-20 15:25:22 +08:00
parent f94b4126bc
commit 00d105d68d

View File

@ -2,7 +2,9 @@ package model
import ( import (
"f5" "f5"
"errors"
"main/constant" "main/constant"
"gorm.io/gorm"
) )
type Bag struct { type Bag struct {
@ -24,3 +26,13 @@ func (this *Bag) Create() error {
} }
return nil return nil
} }
func (this *Bag) Find(accountId string, nowTime int64, itemId int32) (error, bool) {
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
this, "account_id = ? and item_id = ?", accountId, itemId); result.Error != nil &&
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
return result.Error, false
} else {
return nil, result.RowsAffected > 0
}
}