1
This commit is contained in:
parent
3e5fccd132
commit
25ff66cd9c
@ -108,11 +108,16 @@ type UserStackingPo struct {
|
|||||||
Contracts []*ContractStackingPo `json:"contracts"`
|
Contracts []*ContractStackingPo `json:"contracts"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContractStackingCecPo struct {
|
type ContractStakeCecPo struct {
|
||||||
NetId int32 `json:"net_id"`
|
Account string `json:"account"`
|
||||||
ContractAddress string `json:"contract_address"`
|
Token string `json:"token"`
|
||||||
TokenType int32 `json:"token_type"`
|
Amount string `json:"amount"`
|
||||||
Nfts []*NftStackingPo `json:"nfts"`
|
}
|
||||||
|
|
||||||
|
type ContractUnstakeCecPo struct {
|
||||||
|
Account string `json:"account"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Amount string `json:"amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NftIdentity struct {
|
type NftIdentity struct {
|
||||||
@ -148,8 +153,13 @@ func NewContractStackingPo() *ContractStackingPo {
|
|||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContractStackingCecPo() *ContractStackingCecPo {
|
func NewContractStakeCecPo() *ContractStakeCecPo {
|
||||||
p := new(ContractStackingCecPo)
|
p := new(ContractStakeCecPo)
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewContractUnstakeCecPo() *ContractUnstakeCecPo {
|
||||||
|
p := new(ContractUnstakeCecPo)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,12 @@ import (
|
|||||||
"main/constant"
|
"main/constant"
|
||||||
"jccommon"
|
"jccommon"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
EVENT_NAME_STAKE_CEC = "StakeCec"
|
||||||
|
EVENT_NAME_UNSTAKE_CEC = "UnstakeCec"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stackingCec struct {
|
type stackingCec struct {
|
||||||
@ -44,8 +50,8 @@ ORDER BY idx LIMIT 1000
|
|||||||
netId)
|
netId)
|
||||||
params := []string{
|
params := []string{
|
||||||
contractAddress,
|
contractAddress,
|
||||||
"StakeCec",
|
EVENT_NAME_STAKE_CEC,
|
||||||
"UnstakeCec",
|
EVENT_NAME_UNSTAKE_CEC,
|
||||||
}
|
}
|
||||||
return sql, params
|
return sql, params
|
||||||
},
|
},
|
||||||
@ -59,5 +65,69 @@ ORDER BY idx LIMIT 1000
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
|
func (this *stackingCec) saveToDb(ds *f5.DataSet) bool {
|
||||||
|
f5.GetSysLog().Info("load stackingCec idx:%s net_id:%s contract_name:%s event_name:%s",
|
||||||
|
ds.GetByName("net_id"),
|
||||||
|
ds.GetByName("idx"),
|
||||||
|
ds.GetByName("contract_name"),
|
||||||
|
ds.GetByName("event_name"))
|
||||||
|
idx := ds.GetByName("idx")
|
||||||
|
txhash := ds.GetByName("txhash")
|
||||||
|
logIndex := ds.GetByName("log_index")
|
||||||
|
netId := ds.GetByName("net_id")
|
||||||
|
eventName := ds.GetByName("event_name")
|
||||||
|
contractAddress := ds.GetByName("contract_address")
|
||||||
|
returnValues := ds.GetByName("return_values")
|
||||||
|
createTime := ds.GetByName("createtime")
|
||||||
|
modifyTime := ds.GetByName("modifytime")
|
||||||
|
|
||||||
|
accountAddress := ""
|
||||||
|
token := ""
|
||||||
|
amount := ""
|
||||||
|
|
||||||
|
decodeJsonOk := false
|
||||||
|
p := new(itemSoldOut)
|
||||||
|
if q5.DecodeJson(returnValues, p) == nil {
|
||||||
|
decodeJsonOk = true
|
||||||
|
var dbErr error
|
||||||
|
f5.GetGoStyleDb().Upsert(
|
||||||
|
constant.BCEVENT_DB,
|
||||||
|
"t_staking_cec_record",
|
||||||
|
[][]string{
|
||||||
|
{"txhash", txhash},
|
||||||
|
{"log_index", logIndex},
|
||||||
|
{"net_id", netId},
|
||||||
|
{"contract_address", contractAddress},
|
||||||
|
},
|
||||||
|
[][]string{},
|
||||||
|
[][]string{
|
||||||
|
{"txhash", txhash},
|
||||||
|
{"log_index", logIndex},
|
||||||
|
{"net_id", netId},
|
||||||
|
{"contract_address", strings.ToLower(contractAddress)},
|
||||||
|
{"src_idx", idx},
|
||||||
|
{"event_name", eventName},
|
||||||
|
{"account_address", accountAddress},
|
||||||
|
{"token_address", token},
|
||||||
|
{"amount", amount},
|
||||||
|
{"createtime", createTime},
|
||||||
|
{"modifytime", modifyTime},
|
||||||
|
},
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
dbErr = err
|
||||||
|
})
|
||||||
|
if dbErr != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !decodeJsonOk {
|
||||||
|
jccommon.AddDbLog(constant.BCEVENT_DB, "stackingCec", "decodeJsonError",
|
||||||
|
map[string]string{
|
||||||
|
"param1": txhash,
|
||||||
|
"param2": netId,
|
||||||
|
"param3": eventName,
|
||||||
|
"param4": idx,
|
||||||
|
"param5": contractAddress,
|
||||||
|
})
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
|||||||
Subproject commit e6b6ca73a1ad43c8950d037e9ac5de08d8e05f5c
|
Subproject commit f3c6bd34599966b9d3724d3eb7f0703cdf0383bd
|
Loading…
x
Reference in New Issue
Block a user