1
This commit is contained in:
parent
e3515f9b7f
commit
9b78e7f8fd
@ -86,7 +86,7 @@ func GetGoldBullionByNetIdTokenId(netId int32, tokenId string, itemId *int32) bo
|
||||
return result
|
||||
}
|
||||
|
||||
func GetGoldBullionByTokenId(tokenId string, itemId *int32) bool {
|
||||
func GetGoldBullionItemIdByTokenId(tokenId string, itemId *int32) bool {
|
||||
result := false
|
||||
f5.GetGoStyleDb().OrmSelectOne(
|
||||
constant.GAME_DB,
|
||||
|
@ -28,13 +28,26 @@ func (this* goldBullion) onLock(dbIdx int64, netId int32, contractAddress string
|
||||
|
||||
func (this *goldBullion) onUnlock(dbIdx int64, netId int32, contractAddress string, tokenId string,
|
||||
from string, to string) bool {
|
||||
accountAddress := to
|
||||
accountId := service.GetAccountIdByAddress(accountAddress)
|
||||
if accountId == "" {
|
||||
return false
|
||||
}
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
goldDb := service.GetGoldBullionByTokenId(tokenId)
|
||||
if goldDb == nil {
|
||||
return false
|
||||
}*/
|
||||
ok := this.internalSendMail(dbIdx, to, constant.MAIL_GOLD_BULLION_UNLOCK, tokenId)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (this* goldBullion) internalSendMail(dbIdx int64, accountAddress string, mailName string, tokenId string) bool {
|
||||
var itemId int32
|
||||
if !service.GetGoldBullionByTokenId(tokenId, &itemId) {
|
||||
if !service.GetGoldBullionItemIdByTokenId(tokenId, &itemId) {
|
||||
return true
|
||||
}
|
||||
goldNum := jccommon.GetGoldBullionGoldNum(itemId)
|
||||
|
@ -408,3 +408,70 @@ WHERE idx in (%s)
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *MarketApi) Goods(c *gin.Context) {
|
||||
netId := q5.ToInt64(c.Param("net_id"))
|
||||
contractAddress := c.Param("contract_address")
|
||||
tokenId := c.Param("token_id")
|
||||
|
||||
rspObj := &struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Data *goodsDto `json:"data"`
|
||||
}{}
|
||||
|
||||
var dbErr error
|
||||
sql := fmt.Sprintf(`
|
||||
SELECT * FROM t_order
|
||||
WHERE net_id=? AND contract_address=? AND token_id=? AND status=?
|
||||
`)
|
||||
nfts := []*common.NftDto{}
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.BCNFT_DB,
|
||||
sql,
|
||||
[]string{
|
||||
q5.ToString(netId),
|
||||
contractAddress,
|
||||
tokenId,
|
||||
jccommon.ORDER_STATUS_ACTIVE,
|
||||
},
|
||||
func (err error, ds *f5.DataSet) {
|
||||
dbErr = err
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for ds.Next() {
|
||||
p := new(common.NftDto)
|
||||
p.Param1 = q5.ToInt64(ds.GetByName("idx"))
|
||||
p.NetId = q5.ToInt32(ds.GetByName("net_id"))
|
||||
p.ContractAddress = ds.GetByName("contract_address")
|
||||
p.TokenId = ds.GetByName("token_id")
|
||||
p.Payload = map[string]interface{}{}
|
||||
q5.DecodeJson(ds.GetByName("event_data"), &p.Payload)
|
||||
q5.AppendSlice(&nfts, p)
|
||||
}
|
||||
})
|
||||
if dbErr != nil {
|
||||
rspObj.ErrCode = 500
|
||||
rspObj.ErrMsg = "server internal error"
|
||||
c.JSON(200, rspObj)
|
||||
return
|
||||
}
|
||||
GetCacheMgr().GetNfts(nfts)
|
||||
{
|
||||
for _, val := range nfts {
|
||||
var p *goodsDto
|
||||
p = new(goodsDto)
|
||||
p.Event = val.Payload
|
||||
p.Nft = val.NftCache.GetJsonData()
|
||||
rspObj.Data = p
|
||||
}
|
||||
}
|
||||
if rspObj.Data == nil {
|
||||
rspObj.ErrCode = 1
|
||||
rspObj.ErrMsg = "not found"
|
||||
c.JSON(200, rspObj)
|
||||
return
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ func (this *MarketRouter) InitRouter() {
|
||||
api.MarketApi.TransactionHistory)
|
||||
f5.GetApp().GetGinEngine().GET("/api/market/product/category/:net_id", api.MarketApi.CategoryGoodsNum)
|
||||
f5.GetApp().GetGinEngine().GET("/api/market/product/query_price", api.MarketApi.QueryPrice)
|
||||
f5.GetApp().GetGinEngine().GET("/api/market/product/goods/:net_id/:contract_address/:token_id", api.MarketApi.Goods)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user