Skip to content

Commit 8056b94

Browse files
Merge pull request #65 from everFinance/develop
Develop
2 parents 75d0163 + 0919ef5 commit 8056b94

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

api.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,13 @@ func (s *Arseeding) getOrders(c *gin.Context) {
734734
errorResponse(c, err.Error())
735735
return
736736
}
737-
num := 200
738-
orders, err := s.wdb.GetOrdersBySigner(signerAddr, cursorId, num)
737+
num, err := strconv.ParseInt(c.DefaultQuery("num", "20"), 10, 64)
738+
if err != nil {
739+
errorResponse(c, err.Error())
740+
return
741+
}
742+
743+
orders, err := s.wdb.GetOrdersBySigner(signerAddr, cursorId, int(num))
739744
if err != nil {
740745
internalErrorResponse(c, err.Error())
741746
return

schema/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type Order struct {
4646
PaymentStatus string `gorm:"index:idx0" json:"paymentStatus"` // "unpaid", "paid", "expired"
4747
PaymentId string `json:"paymentId"` // everHash
4848

49-
OnChainStatus string `json:"onChainStatus"` // "waiting","pending","success","failed"
49+
OnChainStatus string `gorm:"index:idx5" json:"onChainStatus"` // "waiting","pending","success","failed"
5050
ApiKey string `gorm:"index:idx2" json:"-"`
5151
Sort bool `json:"sort"` // upload items to arweave by sequence
5252
}

wdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (w *Wdb) GetOrdersBySigner(signer string, cursorId int64, num int) ([]schem
146146
cursorId = math.MaxInt64
147147
}
148148
records := make([]schema.Order, 0, num)
149-
err := w.Db.Model(&schema.Order{}).Where("signer = ? and id < ?", signer, cursorId).Order("id DESC").Limit(num).Find(&records).Error
149+
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
150150
return records, err
151151
}
152152

0 commit comments

Comments
 (0)