From 37b54f16365a02fd5194cc1aa0a9f89b5c8c3fff Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 24 Jun 2024 19:59:57 +0800 Subject: [PATCH] 1 --- server/backtask/task/spec_transfer721/hero.go | 19 +++++- server/marketserver/api/v1/asset/asset.go | 2 +- server/marketserver/api/v1/market/market.go | 58 +++++++++++++++++++ 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/server/backtask/task/spec_transfer721/hero.go b/server/backtask/task/spec_transfer721/hero.go index 875ecac2..f59742ab 100644 --- a/server/backtask/task/spec_transfer721/hero.go +++ b/server/backtask/task/spec_transfer721/hero.go @@ -2,6 +2,7 @@ package spec_transfer721 import ( "q5" + "f5" "main/service" "main/constant" "mt" @@ -52,13 +53,25 @@ func (this* hero) internalSendMail(dbIdx int64, accountAddress string, mailName if mailCfg == nil { return true } + nowTime := f5.GetApp().GetRealSeconds() + subject := mailMeta.GetTitle() + content := "" uniKey := fmt.Sprintf("%d_%s_%s", dbIdx, mailName, tokenId) - if uniKey != "" { - - } + service.SendSysMail( + uniKey, + accountId, + subject, + content, + q5.ToInt32(nowTime), + mailCfg.Tag1, + mailCfg.Tag2) return true } +func (this *hero) t(content string) string { + return "" +} + func (this *hero) getMailConfig(mailName string) *jccommon.MailConfig { if v, ok := this.mailCfgHash.Load(mailName); ok { return *v diff --git a/server/marketserver/api/v1/asset/asset.go b/server/marketserver/api/v1/asset/asset.go index 84e67664..e52b4551 100644 --- a/server/marketserver/api/v1/asset/asset.go +++ b/server/marketserver/api/v1/asset/asset.go @@ -1,4 +1,4 @@ - package asset +package asset import ( "q5" diff --git a/server/marketserver/api/v1/market/market.go b/server/marketserver/api/v1/market/market.go index 68cb0488..221a3705 100644 --- a/server/marketserver/api/v1/market/market.go +++ b/server/marketserver/api/v1/market/market.go @@ -275,3 +275,61 @@ WHERE net_id = %d AND status="%s" AND item_id <> 0 GROUP BY item_id c.JSON(200, rspObj) }) } + +func (this *MarketApi) QueryPrice(c *gin.Context) { + netId := q5.ToInt64(c.DefaultQuery("net_id", "")) + itemId := q5.ToInt64(c.DefaultQuery("item_id", "")) + + rspObj := &struct { + ErrCode int32 `json:"errcode"` + ErrMsg string `json:"errmsg"` + LowestPriceGoods *struct{ + Event interface{} `json:"event"` + Nft interface{} `json:"nft"` + } `json:"lowest_price_goods"` + HighestPriceGoods *struct{ + Event interface{} `json:"event"` + Nft interface{} `json:"nft"` + } `json:"highest_price_goods"` + }{} + + sql := fmt.Sprintf(` +SELECT idx, price FROM t_order +WHERE net_id = %d AND status="%s" AND item_id = %d +`, + netId, + jccommon.ORDER_STATUS_ACTIVE, + itemId) + params := []string{} + lowestPriceGoodsIdx := int64(0) + highestPriceGoodsIdx := int64(0) + lowestPrice := "" + highestPrice := "" + f5.GetGoStyleDb().RawQuery( + constant.BCNFT_DB, + sql, + params, + func (err error, ds *f5.DataSet) { + if err != nil { + rspObj.ErrCode = 500 + rspObj.ErrMsg = "server internal error" + c.JSON(200, rspObj) + return + } + for ds.Next() { + idx := q5.ToInt64(ds.GetByName("idx")) + price := ds.GetByName("price") + if lowestPriceGoodsIdx == 0 || + q5.BigIntStrCmp(lowestPrice, price) < 0 { + lowestPriceGoodsIdx = idx + lowestPrice = price + } + if highestPriceGoodsIdx == 0 || + q5.BigIntStrCmp(highestPrice, price) > 0 { + highestPriceGoodsIdx = idx + highestPrice = price + } + } + c.JSON(200, rspObj) + }) +}