Skip to content

Commit

Permalink
Merge pull request #4 from decert-me/fix/update-order
Browse files Browse the repository at this point in the history
Fix 更新NFT数据顺序
  • Loading branch information
0xdwong authored Sep 27, 2023
2 parents f36ee1f + 19493fb commit 09cb552
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/app/router/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func InitAccountRouter(Router *gin.RouterGroup) {
accountRouterWithAddr.POST("/own/refreshUserData", v1.RefreshUserData) // refresh user data
}
{
accountRouterWithAuth.GET("/contract/:address", v1.GetCollectionByContract) // Get the NFT data by the Contract
accountRouterWithAddr.GET("/contract/:address", v1.GetCollectionByContract) // Get the NFT data by the Contract
}
{
accountRouterWithAuth.POST("/own/collection", v1.AddCollection) // add collection
Expand Down
6 changes: 5 additions & 1 deletion internal/app/service/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"nft-collect/internal/app/utils"
"nft-collect/pkg/slice"
"strings"
"time"
)

// GetContract
Expand All @@ -34,7 +35,10 @@ func GetContract(address, account string) (res []response.GetContractRes, err er
dealList = contractDefault
} else if address != common.HexToAddress("0").String() {
dealList = slice.DiffSlice[string](contractDefault, user.ContractIDs)
go updateAllCollection(address, dealList, false, false) // update all collection
go func() {
time.Sleep(5 * time.Second)
updateAllCollection(address, dealList, false, false) // update all collection
}()
}

if len(user.ContractIDs) != len(user.Counts) {
Expand Down

0 comments on commit 09cb552

Please sign in to comment.