Skip to content

Commit

Permalink
Merge pull request #65 from everFinance/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
zyjblockchain authored Jan 31, 2023
2 parents 75d0163 + 0919ef5 commit 8056b94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,13 @@ func (s *Arseeding) getOrders(c *gin.Context) {
errorResponse(c, err.Error())
return
}
num := 200
orders, err := s.wdb.GetOrdersBySigner(signerAddr, cursorId, num)
num, err := strconv.ParseInt(c.DefaultQuery("num", "20"), 10, 64)
if err != nil {
errorResponse(c, err.Error())
return
}

orders, err := s.wdb.GetOrdersBySigner(signerAddr, cursorId, int(num))
if err != nil {
internalErrorResponse(c, err.Error())
return
Expand Down
2 changes: 1 addition & 1 deletion schema/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Order struct {
PaymentStatus string `gorm:"index:idx0" json:"paymentStatus"` // "unpaid", "paid", "expired"
PaymentId string `json:"paymentId"` // everHash

OnChainStatus string `json:"onChainStatus"` // "waiting","pending","success","failed"
OnChainStatus string `gorm:"index:idx5" json:"onChainStatus"` // "waiting","pending","success","failed"
ApiKey string `gorm:"index:idx2" json:"-"`
Sort bool `json:"sort"` // upload items to arweave by sequence
}
Expand Down
2 changes: 1 addition & 1 deletion wdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (w *Wdb) GetOrdersBySigner(signer string, cursorId int64, num int) ([]schem
cursorId = math.MaxInt64
}
records := make([]schema.Order, 0, num)
err := w.Db.Model(&schema.Order{}).Where("signer = ? and id < ?", signer, cursorId).Order("id DESC").Limit(num).Find(&records).Error
err := w.Db.Model(&schema.Order{}).Where("id < ? and signer = ? and on_chain_status != ?", cursorId, signer, schema.FailedOnChain).Order("id DESC").Limit(num).Find(&records).Error
return records, err
}

Expand Down

0 comments on commit 8056b94

Please sign in to comment.