diff --git a/bin/marketserver/config/web3sign.cluster.json b/bin/marketserver/config/web3sign.cluster.json index 2673b724..9df4444f 100644 --- a/bin/marketserver/config/web3sign.cluster.json +++ b/bin/marketserver/config/web3sign.cluster.json @@ -1,5 +1,5 @@ [ { - "url": "http://127.0.0.1:7672/" + "url": "http://127.0.0.1:7672" } ] diff --git a/server/jccommon/constant.go b/server/jccommon/constant.go new file mode 100644 index 00000000..288d80da --- /dev/null +++ b/server/jccommon/constant.go @@ -0,0 +1,6 @@ +package jccommon + +const ( + NFT_TYPE_CFHERO = 1 + NFT_TYPE_GOLD_BULLION = 11 +) diff --git a/server/jccommon/go.mod b/server/jccommon/go.mod new file mode 100644 index 00000000..3af6d5a4 --- /dev/null +++ b/server/jccommon/go.mod @@ -0,0 +1 @@ +module jccommon \ No newline at end of file diff --git a/server/marketserver/api/v1/hero/hero.go b/server/marketserver/api/v1/hero/hero.go index 8731ca20..c59bef4e 100644 --- a/server/marketserver/api/v1/hero/hero.go +++ b/server/marketserver/api/v1/hero/hero.go @@ -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) { + }) } diff --git a/server/marketserver/go.mod b/server/marketserver/go.mod index 169a061d..bd1f35f5 100644 --- a/server/marketserver/go.mod +++ b/server/marketserver/go.mod @@ -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