Skip to content

Commit

Permalink
Merge pull request #217 from Tobeyw/dev-mindy
Browse files Browse the repository at this point in the history
fix sort
  • Loading branch information
Tobeyw committed Jul 10, 2023
2 parents 54eff9e + 06c3f71 commit 00d4f2b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions neo3fura_http/biz/api/src.GetNFTByAssetSeries.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func (me *T) GetNFTByAssetClass(args struct {
},
"as": "market"},
},
bson.M{"$sort": bson.M{"tokenid": 1}},
bson.M{"$skip": args.Skip},
bson.M{"$limit": args.Limit},
},
Expand Down
11 changes: 6 additions & 5 deletions neo3fura_http/biz/api/src.GetNFTClass.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (me *T) GetNFTClass(args struct {
bson.M{"$eq": []interface{}{"$tokenid", "$$tokenid"}},
bson.M{"$eq": []interface{}{"$asset", "$$asset"}},
}}}},
//bson.M{"$sort":bson.M{"timestamp":1}},
bson.M{"$sort": bson.M{"timestamp": 1}},
},
"as": "marketNotification"},
},
Expand Down Expand Up @@ -144,7 +144,8 @@ func (me *T) GetNFTClass(args struct {
count++
}
}
item["claimed"] = len(groupinfo) - count

item["claimed"] = len(groupinfo) - count // 下次给可以改成 item["left]

asset := item["asset"].(string)
tokenid := item["tokenid"].(string)
Expand Down Expand Up @@ -268,13 +269,13 @@ func GetNFTState(info map[string]interface{}, primarymarket interface{}) map[str
info["currentBidAmount"] = info["bidAmount"]
info["currentBidAmount"] = info["auctionAsset"]

if deadline > currentTime && market != nil && market.(string) == primarymarket.(h160.T).Val() {
if deadline > currentTime && market != nil && market.(string) == primarymarket.(h160.T).Val() { //上架
if auctionType == 1 {
info["state"] = "sale" //
} else if auctionType == 2 {
info["state"] = "auction"
}
} else if deadline <= currentTime && market != nil && market.(string) == primarymarket.(h160.T).Val() {
} else if deadline <= currentTime && market != nil && market.(string) == primarymarket.(h160.T).Val() { //过期
if auctionType == 2 && bidAmount != "0" {
info["state"] = "soldout" //竞拍有人出价
} else {
Expand All @@ -288,7 +289,7 @@ func GetNFTState(info map[string]interface{}, primarymarket interface{}) map[str
info["state"] = ""
}
} else {
info["state"] = "no"
info["state"] = ""
}

//delete(info, "bidAmount")
Expand Down
15 changes: 13 additions & 2 deletions neo3fura_http/biz/api/src.GetNFTList.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (me *T) GetNFTList(args struct {
currentTime := time.Now().UnixNano() / 1e6
pipeline := []bson.M{}
if args.Limit == 0 {
args.Limit = 12
args.Limit = 50
}
rt := os.ExpandEnv("${RUNTIME}")
var nns, polemen, genesis string
Expand Down Expand Up @@ -176,7 +176,7 @@ func (me *T) GetNFTList(args struct {
},
"as": "properties"},
},
{"$sort": bson.M{"bidAmount": 1, "auctionAmount": 1}},
{"$sort": bson.M{"tokenid": 1, "bidAmount": 1, "auctionAmount": 1}},
bson.M{"$group": bson.M{"_id": bson.M{"asset": "$asset", "class": "$properties.class"}, "asset": bson.M{"$last": "$asset"}, "tokenid": bson.M{"$last": "$tokenid"}, "deadline": bson.M{"$last": "$deadline"}, "auctionAmount": bson.M{"$last": "$auctionAmount"}, "timestamp": bson.M{"$last": "$timestamp"}, "propertiesArr": bson.M{"$push": "$$ROOT"}}},
bson.M{"$project": bson.M{"_id": 1, "properties": 1, "asset": 1, "tokenid": 1, "propertiesArr": 1, "auctionAmount": 1, "deadline": 1, "timestamp": 1}},
}
Expand Down Expand Up @@ -425,6 +425,17 @@ func isHttp(class string) bool {
return false
}

func isIpfs(class string) bool {
if len(class) > 4 {
str := class[:4]
if str == "ipfs" {
return true
}
}

return false
}

func ReSetProperties(p map[string]interface{}) (map[string]interface{}, error) {
asset := p["asset"].(string)
tokenid := p["tokenid"].(string)
Expand Down

0 comments on commit 00d4f2b

Please sign in to comment.