This commit is contained in:
aozhiwei 2024-06-24 13:35:33 +08:00
parent 8055191421
commit 233a5e3ea6
3 changed files with 52 additions and 49 deletions

View File

@ -1,3 +1,4 @@
{ {
"gameapi_url": "https://game2006api-test.kingsome.cn" "gameapi_url": "https://game2006api-test.kingsome.cn",
"jwks_uri": "https://auth.immutable.com/.well-known/jwks.json"
} }

View File

@ -39,8 +39,9 @@ func (this *ShopCartApi) List(c *gin.Context) {
c.JSON(200, rspObj) c.JSON(200, rspObj)
return return
} }
cartDb := common.NewShopCart()
nfts := []*common.NftDto{} nfts := []*common.NftDto{}
if ds.Next() {
cartDb := common.NewShopCart()
if q5.DecodeJson(ds.GetByName("data"), cartDb) == nil { if q5.DecodeJson(ds.GetByName("data"), cartDb) == nil {
q5.Sort[common.ShopCartGoods](cartDb.Goods, q5.Sort[common.ShopCartGoods](cartDb.Goods,
func (a *common.ShopCartGoods, b *common.ShopCartGoods) bool{ func (a *common.ShopCartGoods, b *common.ShopCartGoods) bool{
@ -89,6 +90,7 @@ func (this *ShopCartApi) List(c *gin.Context) {
this.save(openId, cartDb) this.save(openId, cartDb)
} }
} }
}
GetCacheMgr().GetNfts(nfts) GetCacheMgr().GetNfts(nfts)
{ {
for _, val := range nfts { for _, val := range nfts {

View File

@ -14,8 +14,8 @@ import (
func JwtAuth(c *gin.Context) { func JwtAuth(c *gin.Context) {
tokenHeader := c.Request.Header.Get("Authorization") tokenHeader := c.Request.Header.Get("Authorization")
jwtToken := "" jwtToken := ""
if len(tokenHeader) < 8 { if len(tokenHeader) > 8 {
jwtToken = tokenHeader[8:len(tokenHeader)] jwtToken = tokenHeader[7:len(tokenHeader)]
} }
params := map[string]string{ params := map[string]string{
@ -62,7 +62,7 @@ func JwtAuth(c *gin.Context) {
} }
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode) rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
rspObj.ErrMsg = jsonRspObj.ErrMsg rspObj.ErrMsg = jsonRspObj.ErrMsg
if rspObj.ErrCode != 0 { if q5.SafeToInt32(rspObj.ErrCode) != 0 {
rspObj.ErrCode = 501 rspObj.ErrCode = 501
rspObj.ErrMsg = "jwt error" rspObj.ErrMsg = "jwt error"
c.JSON(200, rspObj) c.JSON(200, rspObj)