Skip to content

Commit

Permalink
Merge pull request #91 from liteseed/main
Browse files Browse the repository at this point in the history
small idiomatic code fix
  • Loading branch information
zyjblockchain authored Feb 21, 2024
2 parents 1c6b311 + 86a9c5f commit 0c91349
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions wdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,13 @@ func (w *Wdb) GetExpiredOrders() ([]schema.Order, error) {
func (w *Wdb) ExistPaidOrd(itemId string) bool {
ord := &schema.Order{}
err := w.Db.Model(&schema.Order{}).Where("item_id = ? and payment_status = ?", itemId, schema.SuccPayment).First(ord).Error
if err == gorm.ErrRecordNotFound {
return false
}
return true
return err != gorm.ErrRecordNotFound
}

func (w *Wdb) IsLatestUnpaidOrd(itemId string, CurExpiredTime int64) bool {
ord := &schema.Order{}
err := w.Db.Model(&schema.Order{}).Where("item_id = ? and payment_status = ? and payment_expired_time > ?", itemId, schema.UnPayment, CurExpiredTime).First(ord).Error
if err == gorm.ErrRecordNotFound {
return true
}
return false
return err == gorm.ErrRecordNotFound
}

func (w *Wdb) UpdateOrdToExpiredStatus(id uint) error {
Expand Down

0 comments on commit 0c91349

Please sign in to comment.