diff --git a/server/backtask/service/bc_currency.go b/server/backtask/service/bc_currency.go index 6f121f56..52534496 100644 --- a/server/backtask/service/bc_currency.go +++ b/server/backtask/service/bc_currency.go @@ -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 }) diff --git a/server/backtask/task/webhook.go b/server/backtask/task/webhook.go index ae2db8c3..67d72410 100644 --- a/server/backtask/task/webhook.go +++ b/server/backtask/task/webhook.go @@ -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)}, diff --git a/server/jccommon/types.go b/server/jccommon/types.go index 8f3b84fd..e841a2e8 100644 --- a/server/jccommon/types.go +++ b/server/jccommon/types.go @@ -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"` diff --git a/server/marketserver/api/v1/shopcart/shopcart.go b/server/marketserver/api/v1/shopcart/shopcart.go index 6aa9fc24..88ec1a1e 100644 --- a/server/marketserver/api/v1/shopcart/shopcart.go +++ b/server/marketserver/api/v1/shopcart/shopcart.go @@ -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 { } } diff --git a/server/marketserver/middleware/jwtauth.go b/server/marketserver/middleware/jwtauth.go index 608539cf..c67582b6 100644 --- a/server/marketserver/middleware/jwtauth.go +++ b/server/marketserver/middleware/jwtauth.go @@ -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() }) }