1
This commit is contained in:
parent
6021b3465c
commit
a664fdb7f9
@ -108,6 +108,13 @@ type UserStackingPo struct {
|
||||
Contracts []*ContractStackingPo `json:"contracts"`
|
||||
}
|
||||
|
||||
type ContractStackingCecPo struct {
|
||||
NetId int32 `json:"net_id"`
|
||||
ContractAddress string `json:"contract_address"`
|
||||
TokenType int32 `json:"token_type"`
|
||||
Nfts []*NftStackingPo `json:"nfts"`
|
||||
}
|
||||
|
||||
type NftIdentity struct {
|
||||
NetId int32
|
||||
ContractAddress string
|
||||
@ -141,6 +148,11 @@ func NewContractStackingPo() *ContractStackingPo {
|
||||
return p
|
||||
}
|
||||
|
||||
func NewContractStackingCecPo() *ContractStackingCecPo {
|
||||
p := new(ContractStackingCecPo)
|
||||
return p
|
||||
}
|
||||
|
||||
func NewUserStackingPo() *UserStackingPo {
|
||||
p := new(UserStackingPo)
|
||||
p.Contracts = []*ContractStackingPo{}
|
||||
|
88
server/light_backtask/task/stacking_go.go
Normal file
88
server/light_backtask/task/stacking_go.go
Normal file
@ -0,0 +1,88 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"main/mt"
|
||||
"main/service"
|
||||
"jccommon"
|
||||
"time"
|
||||
)
|
||||
|
||||
type stackingCec struct {
|
||||
lockMetas []*mt.Contract
|
||||
}
|
||||
|
||||
type accountStackingCec struct {
|
||||
accountAddress string
|
||||
}
|
||||
|
||||
func (this* stackingCec) init() {
|
||||
this.lockMetas = []*mt.Contract{}
|
||||
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
|
||||
if ele.GetName() == jccommon.CONTRACT_NAME_NFTLock {
|
||||
q5.AppendSlice(&this.lockMetas, ele)
|
||||
f5.GetSysLog().Info("task.contribution.init load lockMetas net_id:%d name:%s contract_address:%s",
|
||||
ele.GetNetId(),
|
||||
ele.GetName(),
|
||||
ele.GetAddress())
|
||||
}
|
||||
return true
|
||||
})
|
||||
if len(this.lockMetas) <= 0 {
|
||||
panic("task.contribution.init lockMetas is empty")
|
||||
return
|
||||
}
|
||||
go this.calc()
|
||||
}
|
||||
|
||||
func (this* stackingCec) unInit() {
|
||||
}
|
||||
|
||||
func (this* stackingCec) stat(statTime int64, nowTime int64) {
|
||||
}
|
||||
|
||||
func (this* stackingCec) calc() {
|
||||
for true {
|
||||
nowTime := f5.GetApp().GetRealSeconds()
|
||||
this.stat(nowTime - 3600 * 24, nowTime)
|
||||
|
||||
nowTime = f5.GetApp().GetRealSeconds()
|
||||
daySeconds := q5.GetDaySeconds(nowTime, 0)
|
||||
sleepTime := daySeconds + 3600 * 24 - nowTime + 3
|
||||
time.Sleep(time.Second * time.Duration(sleepTime))
|
||||
}
|
||||
}
|
||||
|
||||
func (this* stackingCec) isStatEd(statDaySeconds int64) (error, bool) {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (this* stackingCec) loadFromDb(addressHash *q5.ConcurrentMap[string, *accountStackingCec],
|
||||
ds *f5.DataSet) bool {
|
||||
accountAddress := ds.GetByName("last_lock_address")
|
||||
if accountAddress == "" {
|
||||
return true
|
||||
}
|
||||
ownerAddress := ds.GetByName("owner_address")
|
||||
p := new(jccommon.NftStacking)
|
||||
p.NetId = q5.ToInt32(ds.GetByName("net_id"))
|
||||
p.ContractAddress = ds.GetByName("contract_address")
|
||||
p.TokenType = q5.ToInt32(ds.GetByName("token_type"))
|
||||
p.TokenId = ds.GetByName("token_id")
|
||||
p.ItemId = q5.ToInt32(ds.GetByName("item_id"))
|
||||
p.Quality = q5.ToInt32(ds.GetByName("quality"))
|
||||
lockMeta := mt.Table.Contract.GetByNetIdName(p.NetId, jccommon.CONTRACT_NAME_NFTLock)
|
||||
if lockMeta == nil {
|
||||
return true
|
||||
}
|
||||
if lockMeta.GetAddress() != ownerAddress {
|
||||
return true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (this* stackingCec) saveToDb() {
|
||||
|
||||
}
|
||||
,
|
Loading…
x
Reference in New Issue
Block a user