This commit is contained in:
aozhiwei 2024-07-18 16:20:08 +08:00
parent b98744b83e
commit 38b7bcda87
3 changed files with 8 additions and 5 deletions

View File

@ -149,7 +149,7 @@ func NftExists(netId int32, contractAddress string, tokenId string) bool {
}
func NftUpdateLock(netId int32, contractAddress string, tokenId string,
lockIdx int64, lockAddress string) bool {
lockIdx int64, lockAddress string, lockSender string) bool {
nowTime := f5.GetApp().GetRealSeconds()
result := false
f5.GetGoStyleDb().UpsertEx(
@ -163,6 +163,7 @@ func NftUpdateLock(netId int32, contractAddress string, tokenId string,
[][]string {
{"last_lock_idx", q5.ToString(lockIdx)},
{"last_lock_address", lockAddress},
{"last_lock_sender", lockSender},
{"last_lock_time", q5.ToString(nowTime)},
},
[][]string {},

View File

@ -66,6 +66,7 @@ func (this* nftLock) repair(ds *f5.DataSet) bool {
netId := q5.ToInt32(ds.GetByName("net_id"))
idx := q5.ToInt64(ds.GetByName("idx"))
lockTo := ds.GetByName("lock_to")
lockSender := ds.GetByName("lock_sender")
if nftSyncStatus == 0 && lockTo != "" {
p := new(lockReturnValues)
if q5.DecodeJson(ds.GetByName("return_values"), p) == nil {
@ -73,7 +74,7 @@ func (this* nftLock) repair(ds *f5.DataSet) bool {
contractAddress := strings.ToLower(p.Nft)
tokenId := val
if service.NftExists(netId, contractAddress, tokenId) {
service.NftUpdateLock(netId, contractAddress, tokenId, idx, lockTo)
service.NftUpdateLock(netId, contractAddress, tokenId, idx, lockTo, lockSender)
}
}
}

View File

@ -18,7 +18,7 @@ func (this *NftApi) Unlock(c *gin.Context) {
reqJson := struct {
NetId interface{} `json:"net_id"`
ContractAddress string `json:"contract_address"`
To string `json:"to"`
//To string `json:"to"`
Tokens []struct {
TokenId string `json:"token_id"`
} `json:"tokens"`
@ -34,10 +34,11 @@ func (this *NftApi) Unlock(c *gin.Context) {
f5.RspErr(c, 1, "contract_address params error")
return
}
/*
if reqJson.To == "" {
f5.RspErr(c, 1, "to params error")
return
}
}*/
if len(reqJson.Tokens) != 1 {
f5.RspErr(c, 1, "tokens params error")
return
@ -68,7 +69,7 @@ func (this *NftApi) Unlock(c *gin.Context) {
"account_address": accountAddress,
"net_id": ds.GetByName("net_id"),
"nft_address": ds.GetByName("contract_address"),
"to_address": reqJson.To,
//"to_address": reqJson.To,
"token_ids": ds.GetByName("token_id"),
}
rspObj := &struct {