This commit is contained in:
aozhiwei 2024-06-20 17:04:38 +08:00
parent ea6f71ba8e
commit 35b782733d
5 changed files with 57 additions and 1 deletions

View File

@ -1,5 +1,5 @@
[
{
"url": "http://127.0.0.1:7672/"
"url": "http://127.0.0.1:7672"
}
]

View File

@ -0,0 +1,6 @@
package jccommon
const (
NFT_TYPE_CFHERO = 1
NFT_TYPE_GOLD_BULLION = 11
)

1
server/jccommon/go.mod Normal file
View File

@ -0,0 +1 @@
module jccommon

View File

@ -1,6 +1,11 @@
package hero
import (
"q5"
"f5"
"mt"
"fmt"
"jccommon"
"github.com/gin-gonic/gin"
)
@ -9,4 +14,44 @@ type HeroApi struct {
}
func (this *HeroApi) Use(c *gin.Context) {
//openId := c.MustGet("open_id").(string)
rspObj := &struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
}{}
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
}
params := map[string]string{
"c": "BcService",
"a": "unlock721Nft",
"token_type": q5.ToString(jccommon.NFT_TYPE_CFHERO),
}
jsonRspObj := &struct {
ErrCode interface{} `json:"errcode"`
ErrMsg string `json:"errmsg"`
TransId string `json:"trans_id"`
Params []string `json:"params"`
}{}
paramsStr := q5.EncodeJson(reqJson)
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
f5.GetHttpCliMgr().SendGoStyleJsonRspPost(
url,
params,
jsonRspObj,
q5.HTTP_HEADER_JSON,
paramsStr,
func(rsp f5.HttpCliResponse) {
})
}

View File

@ -6,6 +6,8 @@ require q5 v1.0.0
require f5 v1.0.0
require jccommon v1.0.0
require mt v1.0.0
require (
@ -59,6 +61,8 @@ replace q5 => ../../third_party/q5
replace f5 => ../../third_party/f5
replace jccommon => ../jccommon
replace mt => ./mt
replace mtb => ./mtb