1
This commit is contained in:
parent
ce8a05cc4b
commit
c29e48f7da
@ -1,7 +1,13 @@
|
|||||||
package activity
|
package activity
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"q5"
|
||||||
|
"f5"
|
||||||
|
"mt"
|
||||||
|
"jccommon"
|
||||||
|
"main/constant"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StackingApi struct {
|
type StackingApi struct {
|
||||||
@ -9,12 +15,50 @@ type StackingApi struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *StackingApi) ExpectedDaily(c *gin.Context) {
|
func (this *StackingApi) ExpectedDaily(c *gin.Context) {
|
||||||
//accountAddress := strings.ToLower(c.Param("account_address"))
|
accountAddress := strings.ToLower(c.Param("account_address"))
|
||||||
rspObj := struct {
|
rspObj := struct {
|
||||||
ErrCode int32 `json:"errcode"`
|
ErrCode int32 `json:"errcode"`
|
||||||
ErrMsg string `json:"errmsg"`
|
ErrMsg string `json:"errmsg"`
|
||||||
ContributionPoint int64 `json:"contribution_point"`
|
ContributionPoint int64 `json:"contribution_point"`
|
||||||
}{
|
}{
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
sqlTpl := "SELECT * FROM t_nft WHERE token_type <> ? AND last_lock_address = ? AND owner_address IN ("
|
||||||
|
params := []string{
|
||||||
|
q5.ToString(jccommon.NFT_TYPE_GOLD_BULLION),
|
||||||
|
accountAddress,
|
||||||
|
}
|
||||||
|
{
|
||||||
|
lockMetas := []*mt.Contract{}
|
||||||
|
mt.Table.Contract.Traverse(func (ele *mt.Contract) bool {
|
||||||
|
if ele.GetName() == jccommon.CONTRACT_NAME_NFTLock {
|
||||||
|
q5.AppendSlice(&lockMetas, ele)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
if len(lockMetas)<= 0 {
|
||||||
|
c.JSON(200, rspObj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
inited := false
|
||||||
|
for _, lockMeta := range lockMetas {
|
||||||
|
if !inited {
|
||||||
|
inited = true
|
||||||
|
sqlTpl += "?"
|
||||||
|
} else {
|
||||||
|
sqlTpl += ",?"
|
||||||
|
}
|
||||||
|
q5.AppendSlice(¶ms, lockMeta.GetAddress())
|
||||||
|
}
|
||||||
|
sqlTpl += ")"
|
||||||
|
}
|
||||||
|
f5.GetGoStyleDb().RawQuery(
|
||||||
|
constant.BCNFT_DB,
|
||||||
|
"",
|
||||||
|
params,
|
||||||
|
func (err error, ds *f5.DataSet) {
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
c.JSON(200, rspObj)
|
c.JSON(200, rspObj)
|
||||||
}
|
}
|
||||||
|
@ -107,3 +107,9 @@ func (this *ContractTable) GetByNetIdAddress(netId int32, address string) *Contr
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ContractTable) Traverse(cb func(*Contract) bool) {
|
||||||
|
this.netIdNameHash.Range(func (k string, v *Contract) bool {
|
||||||
|
return cb(v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user