Compare commits
5 Commits
master
...
market_onl
Author | SHA1 | Date | |
---|---|---|---|
![]() |
97a27d2ef6 | ||
![]() |
49347f8203 | ||
![]() |
a4367ab4db | ||
![]() |
3f8b508182 | ||
![]() |
ffe69ce97a |
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"main/service"
|
"main/service"
|
||||||
|
"main/mt"
|
||||||
"q5"
|
"q5"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ func (cta *ContriApi) HistoryQuery(c *gin.Context) {
|
|||||||
rspObj.CP = fmt.Sprintf("%.2f", mycp)
|
rspObj.CP = fmt.Sprintf("%.2f", mycp)
|
||||||
q5.NewSlice(&rspObj.Rows, 0, 10)
|
q5.NewSlice(&rspObj.Rows, 0, 10)
|
||||||
|
|
||||||
if mycp > 0.000001 {
|
if mycp > 0.000001 && !mt.Table.Config.HideContributionPoint() {
|
||||||
sql := `SELECT * FROM t_staking_daily_settlement WHERE idx > 0 and account_address = ?`
|
sql := `SELECT * FROM t_staking_daily_settlement WHERE idx > 0 and account_address = ?`
|
||||||
f5.GetGoStyleDb().RawQuery(
|
f5.GetGoStyleDb().RawQuery(
|
||||||
constant.BCNFT_DB,
|
constant.BCNFT_DB,
|
||||||
|
@ -67,15 +67,17 @@ token_type <> ? AND last_lock_address = ? AND last_lock_time <= ? AND owner_addr
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
nfts := []*jccommon.NftStacking{}
|
nfts := []*jccommon.NftStacking{}
|
||||||
for ds.Next() {
|
if !mt.Table.Config.HideContributionPoint() {
|
||||||
p := new(jccommon.NftStacking)
|
for ds.Next() {
|
||||||
p.NetId = q5.ToInt32(ds.GetByName("net_id"))
|
p := new(jccommon.NftStacking)
|
||||||
p.ContractAddress = ds.GetByName("contract_address")
|
p.NetId = q5.ToInt32(ds.GetByName("net_id"))
|
||||||
p.TokenType = q5.ToInt32(ds.GetByName("token_type"))
|
p.ContractAddress = ds.GetByName("contract_address")
|
||||||
p.TokenId = ds.GetByName("token_id")
|
p.TokenType = q5.ToInt32(ds.GetByName("token_type"))
|
||||||
p.ItemId = q5.ToInt32(ds.GetByName("item_id"))
|
p.TokenId = ds.GetByName("token_id")
|
||||||
p.Quality = q5.ToInt32(ds.GetByName("quality"))
|
p.ItemId = q5.ToInt32(ds.GetByName("item_id"))
|
||||||
q5.AppendSlice(&nfts, p)
|
p.Quality = q5.ToInt32(ds.GetByName("quality"))
|
||||||
|
q5.AppendSlice(&nfts, p)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rspObj.ContributionPoint = fmt.Sprintf("%.2f", (jccommon.CalcContributionScore(nfts)))
|
rspObj.ContributionPoint = fmt.Sprintf("%.2f", (jccommon.CalcContributionScore(nfts)))
|
||||||
c.JSON(200, rspObj)
|
c.JSON(200, rspObj)
|
||||||
@ -100,28 +102,30 @@ func (sa *StackingApi) ContributionQuery(c *gin.Context) {
|
|||||||
accountAddress,
|
accountAddress,
|
||||||
}
|
}
|
||||||
|
|
||||||
f5.GetGoStyleDb().RawQuery(
|
if !mt.Table.Config.HideContributionPoint() {
|
||||||
constant.BCNFT_DB,
|
f5.GetGoStyleDb().RawQuery(
|
||||||
sql,
|
constant.BCNFT_DB,
|
||||||
params,
|
sql,
|
||||||
func(err error, ds *f5.DataSet) {
|
params,
|
||||||
if err != nil {
|
func(err error, ds *f5.DataSet) {
|
||||||
c.JSON(200, rspObj)
|
if err != nil {
|
||||||
return
|
c.JSON(200, rspObj)
|
||||||
}
|
return
|
||||||
obj := struct {
|
|
||||||
Date int32 `json:"date"`
|
|
||||||
ContributionPoint string `json:"contribution_point"`
|
|
||||||
}{}
|
|
||||||
for ds.Next() {
|
|
||||||
contributionPoint := q5.ToFloat64(ds.GetByName("contribution"))
|
|
||||||
if contributionPoint > 0.00001 {
|
|
||||||
obj.Date = q5.SafeToInt32(ds.GetByName("settle_date"))
|
|
||||||
obj.ContributionPoint = ds.GetByName("contribution")
|
|
||||||
rspObj.Rows = append(rspObj.Rows, obj)
|
|
||||||
}
|
}
|
||||||
}
|
obj := struct {
|
||||||
})
|
Date int32 `json:"date"`
|
||||||
|
ContributionPoint string `json:"contribution_point"`
|
||||||
|
}{}
|
||||||
|
for ds.Next() {
|
||||||
|
contributionPoint := q5.ToFloat64(ds.GetByName("contribution"))
|
||||||
|
if contributionPoint > 0.00001 {
|
||||||
|
obj.Date = q5.SafeToInt32(ds.GetByName("settle_date"))
|
||||||
|
obj.ContributionPoint = ds.GetByName("contribution")
|
||||||
|
rspObj.Rows = append(rspObj.Rows, obj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
c.JSON(200, rspObj)
|
c.JSON(200, rspObj)
|
||||||
}
|
}
|
||||||
|
@ -227,3 +227,59 @@ func (this *InGameApi) newHeroMint(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *InGameApi) GetCircuitRanking(c *gin.Context) {
|
||||||
|
accountAddress := c.DefaultQuery("address", "")
|
||||||
|
params := map[string]string{
|
||||||
|
"c": "OutAppCircuit",
|
||||||
|
"a": "getCircuitRanking",
|
||||||
|
"address": accountAddress,
|
||||||
|
}
|
||||||
|
rspObj := &struct {
|
||||||
|
ErrCode interface{} `json:"errcode"`
|
||||||
|
ErrMsg string `json:"errmsg"`
|
||||||
|
}{}
|
||||||
|
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||||
|
mt.Table.Config.GetGameApiUrl()+"/webapp/index.php",
|
||||||
|
params,
|
||||||
|
func(rsp f5.HttpCliResponse) {
|
||||||
|
if rsp.GetErr() != nil {
|
||||||
|
rspObj.ErrCode = 500
|
||||||
|
rspObj.ErrMsg = "server internal error1"
|
||||||
|
c.JSON(200, rspObj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data := map[string]interface{}{}
|
||||||
|
f5.GetSysLog().Info(rsp.GetRawData())
|
||||||
|
q5.DecodeJson(rsp.GetRawData(), &data)
|
||||||
|
c.JSON(200, data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *InGameApi) GetCircuitPhaseRanking(c *gin.Context) {
|
||||||
|
accountAddress := c.DefaultQuery("address", "")
|
||||||
|
params := map[string]string{
|
||||||
|
"c": "OutAppCircuit",
|
||||||
|
"a": "getCircuitPhaseRanking",
|
||||||
|
"address": accountAddress,
|
||||||
|
}
|
||||||
|
rspObj := &struct {
|
||||||
|
ErrCode interface{} `json:"errcode"`
|
||||||
|
ErrMsg string `json:"errmsg"`
|
||||||
|
}{}
|
||||||
|
f5.GetHttpCliMgr().SendGoStyleRequest(
|
||||||
|
mt.Table.Config.GetGameApiUrl()+"/webapp/index.php",
|
||||||
|
params,
|
||||||
|
func(rsp f5.HttpCliResponse) {
|
||||||
|
if rsp.GetErr() != nil {
|
||||||
|
rspObj.ErrCode = 500
|
||||||
|
rspObj.ErrMsg = "server internal error1"
|
||||||
|
c.JSON(200, rspObj)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data := map[string]interface{}{}
|
||||||
|
f5.GetSysLog().Info(rsp.GetRawData())
|
||||||
|
q5.DecodeJson(rsp.GetRawData(), &data)
|
||||||
|
c.JSON(200, data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"main/service"
|
"main/service"
|
||||||
|
"main/mt"
|
||||||
"q5"
|
"q5"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -127,7 +128,9 @@ func (this *UserApi) Info(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rspObj.ContributionPoint = fmt.Sprintf("%.2f", contributionPoint)
|
if !mt.Table.Config.HideContributionPoint() {
|
||||||
|
rspObj.ContributionPoint = fmt.Sprintf("%.2f", contributionPoint)
|
||||||
|
}
|
||||||
rspObj.Gold = fmt.Sprintf("%.2f", gold)
|
rspObj.Gold = fmt.Sprintf("%.2f", gold)
|
||||||
rspObj.Diamond = fmt.Sprintf("%.2f", diamond)
|
rspObj.Diamond = fmt.Sprintf("%.2f", diamond)
|
||||||
c.JSON(200, rspObj)
|
c.JSON(200, rspObj)
|
||||||
|
@ -22,6 +22,10 @@ func (this *ConfigTable) GetJwksUri() string {
|
|||||||
return this.selfConf.GetJwksUri()
|
return this.selfConf.GetJwksUri()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ConfigTable) HideContributionPoint() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func (this *ConfigTable) GetEmailBuyerPassportAddress() string {
|
func (this *ConfigTable) GetEmailBuyerPassportAddress() string {
|
||||||
return this.selfConf.GetEmailBuyerPassportAddress()
|
return this.selfConf.GetEmailBuyerPassportAddress()
|
||||||
|
@ -16,4 +16,10 @@ func (this *IngameRouter) InitRouter() {
|
|||||||
f5.GetApp().GetGinEngine().POST("/api/ingame/asset/hero/mint",
|
f5.GetApp().GetGinEngine().POST("/api/ingame/asset/hero/mint",
|
||||||
middleware.JwtAuth,
|
middleware.JwtAuth,
|
||||||
api.InGameApi.HeroMint)
|
api.InGameApi.HeroMint)
|
||||||
|
f5.GetApp().GetGinEngine().GET("/api/circuit_ranking",
|
||||||
|
middleware.MaybeJwtAuth,
|
||||||
|
api.InGameApi.GetCircuitRanking)
|
||||||
|
f5.GetApp().GetGinEngine().GET("/api/circuit_phase_ranking",
|
||||||
|
middleware.MaybeJwtAuth,
|
||||||
|
api.InGameApi.GetCircuitPhaseRanking)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user