This commit is contained in:
aozhiwei 2024-11-29 11:21:46 +08:00
parent c76277efd9
commit bc888c9dc4

View File

@ -2,9 +2,9 @@ package model
import (
"f5"
//"errors"
"errors"
"main/constant"
//"gorm.io/gorm"
"gorm.io/gorm"
)
type InAppOrder struct {
@ -36,3 +36,13 @@ func (this *InAppOrder) UpdateFields(fields []string) error {
}
return nil
}
func (this *InAppOrder) Find(accountId string, orderId string) (error, bool) {
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(this.TableName()).Take(
this, "account_id = ? AND order_id = ?", accountId, orderId); result.Error != nil &&
!errors.Is(result.Error, gorm.ErrRecordNotFound) {
return result.Error, false
} else {
return nil, result.RowsAffected > 0
}
}