1
This commit is contained in:
parent
79a8a1d676
commit
d00f10c2d0
@ -1,6 +1,10 @@
|
|||||||
package task
|
package task
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"q5"
|
||||||
|
"f5"
|
||||||
|
"main/constant"
|
||||||
|
"fmt"
|
||||||
"mt"
|
"mt"
|
||||||
"jccommon"
|
"jccommon"
|
||||||
)
|
)
|
||||||
@ -8,14 +12,50 @@ import (
|
|||||||
type recharge struct {
|
type recharge struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* recharge) init() {
|
func (this *recharge) init() {
|
||||||
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
|
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
|
||||||
if ele.GetName() == jccommon.CONTRACT_NAME_GameItemMall {
|
if ele.GetName() == jccommon.CONTRACT_NAME_GameItemMall {
|
||||||
//go this.processLockAndUnLockEvent(ele.GetNetId(), ele.GetAddress())
|
//go this.process(ele.GetNetId(), ele.GetAddress())
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* recharge) unInit() {
|
func (this *recharge) unInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *recharge) process(netId int32, contractAddress string) {
|
||||||
|
key := fmt.Sprintf("recharge.lastIdx.%d.%s", netId, contractAddress)
|
||||||
|
if dbLastIdxStr, err := jccommon.GetDbParam(constant.BCEVENT_DB, key); err == nil {
|
||||||
|
f5.GetGoStyleDb().IncrementLoad(
|
||||||
|
constant.BCEVENT_DB,
|
||||||
|
"recharge." + q5.ToString(netId) + "." + contractAddress,
|
||||||
|
"t_blockchain_event",
|
||||||
|
q5.ToInt64(dbLastIdxStr),
|
||||||
|
func (lastIdx int64, maxIdx int64) (string, []string) {
|
||||||
|
sql := fmt.Sprintf(`
|
||||||
|
SELECT * FROM t_blockchain_event
|
||||||
|
WHERE idx > %d AND idx <= %d AND net_id = %d AND contract_address = ? AND event_name IN (?, ?)
|
||||||
|
ORDER BY idx LIMIT 1000
|
||||||
|
`,
|
||||||
|
lastIdx,
|
||||||
|
maxIdx,
|
||||||
|
netId)
|
||||||
|
params := []string{
|
||||||
|
contractAddress,
|
||||||
|
"ItemSoldOut",
|
||||||
|
}
|
||||||
|
return sql, params
|
||||||
|
},
|
||||||
|
func (newLastIdx int64) {
|
||||||
|
jccommon.SaveDbParam(constant.BCEVENT_DB, key, q5.ToString(newLastIdx))
|
||||||
|
},
|
||||||
|
this.saveToDb)
|
||||||
|
} else {
|
||||||
|
panic(fmt.Sprintf("recharge.process getDBParam error %s", err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *recharge) saveToDb(ds *f5.DataSet) bool {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user