1
This commit is contained in:
parent
dd1c470aa7
commit
1306064762
@ -1,15 +1,9 @@
|
|||||||
package gold_bullion
|
package gold_bullion
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"jccommon"
|
|
||||||
"main/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GoldBullionApi struct {
|
type GoldBullionApi struct {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GoldBullionApi) Use(c *gin.Context) {
|
|
||||||
service.Unlock721Nft(c, jccommon.NFT_TYPE_GOLD_BULLION)
|
|
||||||
}
|
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
package hero
|
package hero
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"jccommon"
|
|
||||||
"main/service"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type HeroApi struct {
|
type HeroApi struct {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HeroApi) Use(c *gin.Context) {
|
|
||||||
service.Unlock721Nft(c, jccommon.NFT_TYPE_CFHERO)
|
|
||||||
}
|
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"q5"
|
|
||||||
"f5"
|
|
||||||
//"mt"
|
|
||||||
//"fmt"
|
|
||||||
"jccommon"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Unlock721Nft(c *gin.Context, tokenType int32) {
|
|
||||||
//openId := c.MustGet("open_id").(string)
|
|
||||||
|
|
||||||
rspObj := &struct {
|
|
||||||
ErrCode int32 `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
TransId string `json:"trans_id"`
|
|
||||||
Params []string `json:"params"`
|
|
||||||
}{
|
|
||||||
Params: []string{},
|
|
||||||
}
|
|
||||||
|
|
||||||
reqJson := &struct {
|
|
||||||
NetId interface{} `json:"net_id"`
|
|
||||||
AccountAddress string `json:"account_address"`
|
|
||||||
Tokens interface{} `json:"tokens"`
|
|
||||||
}{}
|
|
||||||
if err := c.ShouldBindJSON(reqJson); err != nil {
|
|
||||||
rspObj.ErrCode = 1
|
|
||||||
rspObj.ErrMsg = "json parse error"
|
|
||||||
c.JSON(200, rspObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !(tokenType == jccommon.NFT_TYPE_CFHERO ||
|
|
||||||
tokenType == jccommon.NFT_TYPE_GOLD_BULLION) {
|
|
||||||
rspObj.ErrCode = 1
|
|
||||||
rspObj.ErrMsg = "token type error"
|
|
||||||
c.JSON(200, rspObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
params := map[string]string{
|
|
||||||
"c": "BcService",
|
|
||||||
"a": "unlock721Nft",
|
|
||||||
"token_type": q5.ToString(tokenType),
|
|
||||||
}
|
|
||||||
jsonRspObj := &struct {
|
|
||||||
ErrCode interface{} `json:"errcode"`
|
|
||||||
ErrMsg string `json:"errmsg"`
|
|
||||||
TransId string `json:"trans_id"`
|
|
||||||
Params []string `json:"params"`
|
|
||||||
}{
|
|
||||||
Params: []string{},
|
|
||||||
}
|
|
||||||
paramsStr := q5.EncodeJson(reqJson)
|
|
||||||
//url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3SignCluster.RandElement().GetUrl())
|
|
||||||
url := ""
|
|
||||||
f5.GetHttpCliMgr().SendGoStyleJsonRspPost(
|
|
||||||
url,
|
|
||||||
params,
|
|
||||||
jsonRspObj,
|
|
||||||
q5.HTTP_HEADER_JSON,
|
|
||||||
paramsStr,
|
|
||||||
func(rsp f5.HttpCliResponse) {
|
|
||||||
if rsp.GetErr() != nil ||
|
|
||||||
!rsp.JsonParseOk() {
|
|
||||||
rspObj.ErrCode = 500
|
|
||||||
rspObj.ErrMsg = "server internal error"
|
|
||||||
c.JSON(200, rspObj)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
|
|
||||||
rspObj.ErrMsg = jsonRspObj.ErrMsg
|
|
||||||
rspObj.TransId = jsonRspObj.TransId
|
|
||||||
rspObj.Params = jsonRspObj.Params
|
|
||||||
c.JSON(200, rspObj)
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user