This commit is contained in:
aozhiwei 2024-06-28 14:45:13 +08:00
parent 0f3046a55d
commit 99bce9d286
5 changed files with 21 additions and 9 deletions

View File

@ -30,7 +30,8 @@ func (this *bcCurrency) init() () {
func (e *mt.BcCurrency) bool {
this.nameHash.Store(e.GetName(), int64(e.GetCurrentPrice() * DECIMALS))
if e.GetContractAddress() != "" {
this.addressHash.Store(e.GetContractAddress(), int64(e.GetCurrentPrice() * DECIMALS))
this.addressHash.Store(strings.ToLower(e.GetContractAddress()),
int64(e.GetCurrentPrice() * DECIMALS))
}
return true
})

View File

@ -145,6 +145,7 @@ func (this* webHook) orderUpdatedCb(ds *f5.DataSet) bool {
{"order_id", p.Data.Id},
{"chain", p.Chain},
{"status", p.Data.Status.Name},
{"seller_address", strings.ToLower(p.Data.AccountAddress)},
{"item_id", q5.ToString(itemId)},
{"hero_quality", q5.ToString(heroQuality)},
{"start_time", q5.ToString(startTime)},

View File

@ -25,6 +25,7 @@ type OrderUpdatedEvent struct {
Chain string `json:"chain"`
Data struct {
Id string `json:"id"`
AccountAddress string `json:"account_address"`
Buy [] struct {
Amount string `json:"amount"`
ContractAddress string `json:"contract_address"`

View File

@ -105,6 +105,7 @@ func (this *ShopCartApi) List(c *gin.Context) {
func (this *ShopCartApi) Add(c *gin.Context) {
openId := c.MustGet("open_id").(string)
accountAddress := c.MustGet("account_address").(string)
rspObj := &struct {
ErrCode int32 `json:"errcode"`
@ -175,14 +176,16 @@ func (this *ShopCartApi) Add(c *gin.Context) {
err1 = err
if err == nil {
if ds.Next() {
cartDb.CurrSortIdx += 1
g := common.NewShopCartGoods()
g.NetId = netId
g.ContractAddress = contractAddress
g.TokenId = tokenId
g.SortIdx = cartDb.CurrSortIdx
g.AddTime = q5.ToInt32(f5.GetApp().GetRealSeconds())
q5.AppendSlice(&cartDb.Goods, g)
if ds.GetByName("seller_address") == accountAddress {
cartDb.CurrSortIdx += 1
g := common.NewShopCartGoods()
g.NetId = netId
g.ContractAddress = contractAddress
g.TokenId = tokenId
g.SortIdx = cartDb.CurrSortIdx
g.AddTime = q5.ToInt32(f5.GetApp().GetRealSeconds())
q5.AppendSlice(&cartDb.Goods, g)
}
} else {
}
}

View File

@ -29,6 +29,7 @@ func internalJwtAuth(c *gin.Context, maybe bool) {
} else {
if maybe {
c.Set("open_id", "")
c.Set("account_address", "")
c.Next()
return
}
@ -62,6 +63,9 @@ func internalImmutJwtAuth(c *gin.Context, jwtToken string) {
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Sid string `json:"sid"`
Passport struct {
ZkevmEthAddress string `json:"zkevm_eth_address"`
} `json:"passport"`
} `json:"decoded"`
}{}
rspObj := &struct {
@ -96,6 +100,7 @@ func internalImmutJwtAuth(c *gin.Context, jwtToken string) {
}
openId := fmt.Sprintf("%d_2006_%s", jccommon.IMTBL_CHANNEL, jsonRspObj.Decoded.Sub)
c.Set("open_id", openId)
c.Set("account_address", jsonRspObj.Decoded.Passport.ZkevmEthAddress)
c.Next()
})
}
@ -161,6 +166,7 @@ func internalMetaMaskJwtAuth(c *gin.Context, jwtToken string) {
jccommon.BC_CHANNEL,
strings.ToLower(jsonRspObj.Decoded.OpenId))
c.Set("open_id", openId)
c.Set("account_address", strings.ToLower(jsonRspObj.Decoded.OpenId))
c.Next()
})
}