1
This commit is contained in:
parent
ec71264cad
commit
ec36100f30
@ -21,20 +21,73 @@ func (this *UserApi) Info(c *gin.Context) {
|
||||
Gold float64 `json:"gold"`
|
||||
}{
|
||||
}
|
||||
f5.GetGoStyleDb().OrmSelectOne(
|
||||
constant.GAME_DB,
|
||||
"t_user",
|
||||
[][]string{
|
||||
{"address", accountAddress},
|
||||
},
|
||||
func (err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
if ds.Next() {
|
||||
rspObj.Gold = q5.ToFloat64(ds.GetByName("gold"))
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
})
|
||||
{
|
||||
var dbErr error
|
||||
f5.GetGoStyleDb().OrmSelectOne(
|
||||
constant.GAME_DB,
|
||||
"t_user",
|
||||
[][]string{
|
||||
{"address", accountAddress},
|
||||
},
|
||||
func (err error, ds *f5.DataSet) {
|
||||
dbErr = err
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if ds.Next() {
|
||||
rspObj.Gold = q5.ToFloat64(ds.GetByName("gold"))
|
||||
}
|
||||
})
|
||||
if dbErr != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
}
|
||||
{
|
||||
var dbErr error
|
||||
f5.GetGoStyleDb().OrmSelectOne(
|
||||
constant.BCNFT_DB,
|
||||
"t_contribution",
|
||||
[][]string{
|
||||
{"account_address", accountAddress},
|
||||
},
|
||||
func (err error, ds *f5.DataSet) {
|
||||
dbErr = err
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if ds.Next() {
|
||||
rspObj.ContributionPoint += q5.ToInt64(ds.GetByName("contribution"))
|
||||
}
|
||||
})
|
||||
if dbErr != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
}
|
||||
{
|
||||
var dbErr error
|
||||
sql := "SELECT SUM(contribution) FROM t_staking_daily_settlement WHERE account_address = ?"
|
||||
params := []string{
|
||||
accountAddress,
|
||||
}
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.BCNFT_DB,
|
||||
sql,
|
||||
params,
|
||||
func (err error, ds *f5.DataSet) {
|
||||
dbErr = err
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for ds.Next() {
|
||||
rspObj.ContributionPoint += q5.ToInt64(ds.GetByIndex(0))
|
||||
}
|
||||
})
|
||||
if dbErr != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
}
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user