This commit is contained in:
aozhiwei 2024-06-22 09:22:20 +08:00
parent bd48b17d92
commit 69540b7f21
2 changed files with 117 additions and 90 deletions

View File

@ -48,6 +48,25 @@ func (this *app) registerDataSources() {
mt.Table.GameDb.GetById(0).GetPasswd(),
mt.Table.GameDb.GetById(0).GetDatabase(),
30)
f5.GetGoStyleDb().RegisterDataSource(
constant.BCNFT_DB,
mt.Table.BcNftDb.GetById(0).GetHost(),
mt.Table.BcNftDb.GetById(0).GetPort(),
mt.Table.BcNftDb.GetById(0).GetUser(),
mt.Table.BcNftDb.GetById(0).GetPasswd(),
mt.Table.BcNftDb.GetById(0).GetDatabase(),
30)
f5.GetGoStyleDb().RegisterDataSource(
constant.BCEVENT_DB,
mt.Table.BcEventDb.GetById(0).GetHost(),
mt.Table.BcEventDb.GetById(0).GetPort(),
mt.Table.BcEventDb.GetById(0).GetUser(),
mt.Table.BcEventDb.GetById(0).GetPasswd(),
mt.Table.BcEventDb.GetById(0).GetDatabase(),
30)
}
func (this *app) HasTask() bool {

View File

@ -109,12 +109,17 @@ func (this* webHook) saveLastIdx(eventName string, lastIdx int64) bool {
}
func (this* webHook) orderUpdatedCb(ds *f5.DataSet) bool {
f5.GetSysLog().Info("orderUpdate event_id:%s start", ds.GetByName("event_id"))
nowTime := f5.GetApp().GetRealSeconds()
rawData := ds.GetByName("raw_data")
p := new(jccommon.OrderUpdatedEvent)
err := q5.DecodeJson(rawData, &p)
netId := mt.Table.Config.GetById(0).GetNetId()
if err == nil {
if err != nil {
f5.GetSysLog().Warning("orderUpdate event_id:%s event_data parse error :%s",
ds.GetByName("event_id"), err)
return false
}
var itemId int32
var heroQuality int32
this.getItemIdHeroQuality(netId, p.Data.Sell[0].ContractAddress, p.Data.Sell[0].TokenId,
@ -162,17 +167,21 @@ func (this* webHook) orderUpdatedCb(ds *f5.DataSet) bool {
func (ds *f5.DataSet) bool {
return p.EventId > ds.GetByName("event_id")
})
}
return true
}
func (this* webHook) activitySaleCb(ds *f5.DataSet) bool {
f5.GetSysLog().Info("activitySale event_id:%s start", ds.GetByName("event_id"))
nowTime := f5.GetApp().GetRealSeconds()
rawData := ds.GetByName("raw_data")
p := new(jccommon.ActivitySaleEvent)
err := q5.DecodeJson(rawData, &p)
netId := mt.Table.Config.GetById(0).GetNetId()
if err == nil {
if err != nil {
f5.GetSysLog().Warning("activitySale event_id:%s event_data parse error :%s",
ds.GetByName("event_id"), err)
return false
}
var itemId int32
var heroQuality int32
this.getItemIdHeroQuality(netId,
@ -214,7 +223,6 @@ func (this* webHook) activitySaleCb(ds *f5.DataSet) bool {
func (ds *f5.DataSet) bool {
return p.EventId > ds.GetByName("event_id")
})
}
return true
}