This commit is contained in:
aozhiwei 2024-06-24 15:09:45 +08:00
parent 233a5e3ea6
commit f32960e808
21 changed files with 109 additions and 96 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "third_party/f5"]
path = third_party/f5
url = git@git.kingsome.cn:server_common/f5.git
[submodule "third_party/contracts-imtbl"]
path = third_party/contracts-imtbl
url = git@git.kingsome.cn:crypto/contracts-imtbl.git

View File

@ -0,0 +1 @@
[${item.name}] has been synthesized successfully. Please go to the personal assets page on the web to view it. The web address : XXXXX

View File

@ -0,0 +1 @@
[${item.name}] has been used successfully, you have received ${gold} gold

View File

@ -0,0 +1 @@
[{$hero.name} ${hero.quality}] has been off-chained successfully. Please check in the hero backpack.

View File

@ -0,0 +1 @@
[{$hero.name} ${hero.quality}] has been on-chain successfully. Please go to the personal assets page on the web to view it. The web market address is XXXXX

View File

@ -0,0 +1 @@
[{$hero.name} ${hero.quality}] has been on-chain successfully. Please go to the personal assets page on the web to view it. The web market address is XXXXX

View File

@ -1,14 +1,29 @@
package mt
import (
"f5"
"mtb"
)
type Mail struct {
mtb.Mail
}
type MailTable struct {
f5.NameMetaTable[Mail]
}
func (this *MailTable) IsNoLoad() bool {
return false
}
func (this *MailTable) Load() {
}
func (this *MailTable) PreInit1() {
}
func (this *MailTable) ElementsInit(int) {
}
func (this *MailTable) PostInit1() {
}

View File

@ -49,10 +49,7 @@ var Table = f5.New(func(this *table) {
this.PrimKey = "id"
})
this.Mail = f5.New(func(this *MailTable) {
this.FileName = "../config/mail.json"
this.PrimKey = "name"
})
this.Mail = new(MailTable)
this.Language = f5.New(func(this *LanguageTable) {
this.FileName = "../res/language@language.json"

View File

@ -56,13 +56,6 @@ message Language
optional string en = 2;
}
message Mail
{
optional string name = 1;
optional string subject = 2;
optional string content = 3;
}
message RankSeason
{
optional int32 id = 1;

View File

@ -44,10 +44,11 @@ func (this* hero) internalSendMail(dbIdx int64, accountAddress string, mailName
if accountId == "" {
return true
}
/*
mailMeta := mt.Table.Mail.GetByName(mailName)
if mailMeta == nil {
return true
}
}*/
mailCfg := this.getMailConfig(mailName)
if mailCfg == nil {
return true

View File

@ -5,7 +5,7 @@ import (
"f5"
"time"
"fmt"
"mt"
//"mt"
"jccommon"
"main/constant"
)
@ -49,6 +49,7 @@ SELECT * FROM t_721nft_spec_transfer WHERE idx > %d AND status = 0 AND createtim
}
func (this* SpecTransfer721) dispatch(ds *f5.DataSet) bool {
/*
idx := q5.ToInt64(ds.GetByName("idx"))
netId := q5.ToInt32(ds.GetByName("net_id"))
contractAddress := ds.GetByName("contract_address")
@ -69,6 +70,6 @@ func (this* SpecTransfer721) dispatch(ds *f5.DataSet) bool {
}
}
}
}
}*/
return true
}

View File

@ -53,12 +53,13 @@ func (this *MarketApi) ProductList(c *gin.Context) {
SELECT * FROM t_order A WHERE idx > %d AND net_id = %d AND status="%s"
`,
cursor, netId, jccommon.ORDER_STATUS_ACTIVE)
/*
if f5.IsTestEnv() {
sql = fmt.Sprintf(`
SELECT * FROM t_order A WHERE idx > %d AND net_id = %d
`,
cursor, netId)
}
}*/
orderBy := ""
/*

View File

@ -144,65 +144,63 @@ func (this *ShopCartApi) Add(c *gin.Context) {
c.JSON(200, rspObj)
return
}
cartDb := common.NewShopCart()
dirty := false
if ds.Next() {
cartDb := common.NewShopCart()
dirty := false
if q5.DecodeJson(ds.GetByName("data"), cartDb) == nil {
for _, val := range reqJson.Tokens {
netId := q5.SafeToInt32(reqJson.NetId)
contractAddress := val.ContractAddress
tokenId := q5.SafeToString(val.TokenId)
p := cartDb.GetGoods(netId, contractAddress, tokenId)
if p != nil {
cartDb.CurrSortIdx += 1
p.SortIdx = cartDb.CurrSortIdx
p.AddTime = q5.ToInt32(f5.GetApp().GetRealSeconds())
dirty = true;
} else {
var err1 error
f5.GetGoStyleDb().OrmSelectOne(
constant.BCNFT_DB,
"t_order",
[][]string{
{"net_id", q5.ToString(netId)},
{"contract_address", contractAddress},
{"token_id", tokenId},
{"status", jccommon.ORDER_STATUS_ACTIVE},
},
func (err error, ds* f5.DataSet) {
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)
} else {
}
}
})
if err1 != nil {
rspObj.ErrCode = 500
rspObj.ErrMsg = "server internal error"
c.JSON(200, rspObj)
return
}
dirty = true;
}
}
}
if dirty {
cartDb.DeleteExcessData()
this.save(openId, cartDb)
}
c.JSON(200, rspObj)
} else {
c.JSON(200, rspObj)
}
for _, val := range reqJson.Tokens {
netId := q5.SafeToInt32(reqJson.NetId)
contractAddress := val.ContractAddress
tokenId := q5.SafeToString(val.TokenId)
p := cartDb.GetGoods(netId, contractAddress, tokenId)
if p != nil {
cartDb.CurrSortIdx += 1
p.SortIdx = cartDb.CurrSortIdx
p.AddTime = q5.ToInt32(f5.GetApp().GetRealSeconds())
dirty = true;
} else {
var err1 error
f5.GetGoStyleDb().OrmSelectOne(
constant.BCNFT_DB,
"t_order",
[][]string{
{"net_id", q5.ToString(netId)},
{"contract_address", contractAddress},
{"token_id", tokenId},
{"status", jccommon.ORDER_STATUS_ACTIVE},
},
func (err error, ds* f5.DataSet) {
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)
} else {
}
}
})
if err1 != nil {
rspObj.ErrCode = 500
rspObj.ErrMsg = "server internal error"
c.JSON(200, rspObj)
return
}
dirty = true;
}
}
if dirty {
cartDb.DeleteExcessData()
this.save(openId, cartDb)
}
c.JSON(200, rspObj)
})
}
@ -241,34 +239,32 @@ func (this *ShopCartApi) Del(c *gin.Context) {
c.JSON(200, rspObj)
return
}
cartDb := common.NewShopCart()
dirty := false
if ds.Next() {
cartDb := common.NewShopCart()
dirty := false
if q5.DecodeJson(ds.GetByName("data"), cartDb) == nil {
newGoods := []*common.ShopCartGoods{}
for _, val := range cartDb.Goods {
found := false
for _, val2 := range reqJson.Tokens {
if val.NetId == q5.SafeToInt32(reqJson.NetId) &&
q5.ToString(val.TokenId) == q5.SafeToString(val2.TokenId) &&
strings.ToLower(val.ContractAddress) == strings.ToLower(val2.ContractAddress) {
found = true
}
}
if !found {
q5.AppendSlice(&newGoods, val)
} else {
dirty = true
}
}
}
newGoods := []*common.ShopCartGoods{}
for _, val := range cartDb.Goods {
found := false
for _, val2 := range reqJson.Tokens {
if val.NetId == q5.SafeToInt32(reqJson.NetId) &&
q5.ToString(val.TokenId) == q5.SafeToString(val2.TokenId) &&
strings.ToLower(val.ContractAddress) == strings.ToLower(val2.ContractAddress) {
found = true
}
}
if dirty {
this.save(openId, cartDb)
if !found {
q5.AppendSlice(&newGoods, val)
} else {
dirty = true
}
c.JSON(200, rspObj)
} else {
c.JSON(200, rspObj)
}
if dirty {
this.save(openId, cartDb)
}
c.JSON(200, rspObj)
})
}

1
third_party/contracts-imtbl vendored Submodule

@ -0,0 +1 @@
Subproject commit 6621b926b460d820e6c01d69c13053259a80e5f3