1
This commit is contained in:
parent
f94b4126bc
commit
00d105d68d
@ -2,7 +2,9 @@ package model
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"errors"
|
||||
"main/constant"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Bag struct {
|
||||
@ -24,3 +26,13 @@ func (this *Bag) Create() error {
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user