fix
This commit is contained in:
parent
8ae5aec135
commit
4d6a851ec8
@ -84,15 +84,17 @@ func (cta *ContriApi) HistoryQuery(c *gin.Context) {
|
||||
|
||||
sql = `SELECT * FROM t_recharge_return_contribution WHERE idx > 0 AND user_identity IN (?`
|
||||
|
||||
params := []string{account}
|
||||
if loweremail != "" {
|
||||
sql += ", " + loweremail
|
||||
sql += ", ?"
|
||||
params = append(params, loweremail)
|
||||
}
|
||||
sql += ")"
|
||||
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.BCNFT_DB,
|
||||
sql,
|
||||
[]string{account},
|
||||
params,
|
||||
func(err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
return
|
||||
@ -140,7 +142,8 @@ func (cta *ContriApi) CECQuery(c *gin.Context) {
|
||||
|
||||
totalgcp, _ := service.Contribution.GetGlobalContribution(false)
|
||||
mycp, _ := service.Contribution.GetAddressContribution(account)
|
||||
rspObj.Info.MyCP = fmt.Sprintf("%.2f", mycp)
|
||||
rspObj.CP = fmt.Sprintf("%.2f", mycp)
|
||||
rspObj.Info.MyCP = rspObj.CP
|
||||
rspObj.Info.GCP = fmt.Sprintf("%.2f", totalgcp)
|
||||
rspObj.Info.GCEC = 500000
|
||||
rspObj.Info.MyCEC = q5.SafeToInt64(float64(rspObj.Info.GCEC) * (mycp) / totalgcp)
|
||||
|
@ -167,7 +167,7 @@ func (sa *StackingApi) DiamondRecordQuery(c *gin.Context) {
|
||||
}
|
||||
|
||||
{
|
||||
sql := `SELECT * FROM t_recharge_order WHERE passport_address = ? AND pay_status = 1 ORDER BY createtime DESC`
|
||||
sql := `SELECT pay_time, diamond + present_diamond FROM t_recharge_order WHERE passport_address = ? AND pay_status = 1 ORDER BY createtime DESC`
|
||||
params := []string{
|
||||
accountAddress,
|
||||
}
|
||||
@ -185,7 +185,7 @@ func (sa *StackingApi) DiamondRecordQuery(c *gin.Context) {
|
||||
obj := new(Record)
|
||||
|
||||
obj.Date = q5.SafeToInt32(ds.GetByName("pay_time"))
|
||||
obj.Amount = ds.GetByName("diamond")
|
||||
obj.Amount = ds.GetByIndex(1)
|
||||
obj.Type = 0
|
||||
rspObj.Rows = append(rspObj.Rows, obj)
|
||||
}
|
||||
|
@ -23,14 +23,14 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
|
||||
accountAddress := strings.ToLower(c.Param("account_address"))
|
||||
netId := q5.ToInt32(c.DefaultQuery("net_id", ""))
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Contribution string `json:"contribution"`
|
||||
Rows []interface{} `json:"rows"`
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Contribution string `json:"contribution"`
|
||||
Rows []interface{} `json:"rows"`
|
||||
}{}
|
||||
|
||||
currencysMeta := mt.Table.Currency.GetByNetId(netId)
|
||||
if currencysMeta == nil {
|
||||
if currencysMeta == nil {
|
||||
f5.RspErr(c, 2, "server internal error")
|
||||
return
|
||||
}
|
||||
@ -53,12 +53,12 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
|
||||
if ok, err := service.FirstRecharge.IsFirstRecharge(accountAddress, tb.GetId()); err == nil && ok {
|
||||
tmpmap["is_first_recharge"] = 1
|
||||
}
|
||||
currencyList := []struct{
|
||||
Name string `json:"name"`
|
||||
currencyList := []struct {
|
||||
Name string `json:"name"`
|
||||
Address string `json:"address"`
|
||||
}{}
|
||||
currencysMeta.Range(
|
||||
func (key string, val *mt.Currency) bool {
|
||||
func(key string, val *mt.Currency) bool {
|
||||
currency := val
|
||||
p := q5.NewSliceElement(¤cyList)
|
||||
p.Name = currency.GetCurrencyName()
|
||||
@ -78,10 +78,10 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
|
||||
func (this *RechargeApi) Buy(c *gin.Context) {
|
||||
passportAddress := mt.Table.Config.GetEmailBuyerPassportAddress()
|
||||
reqJson := struct {
|
||||
NetId int32 `json:"net_id"`
|
||||
GoodsId int32 `json:"goods_id"`
|
||||
GoodsNum int32 `json:"goods_num"`
|
||||
AccountAddress string `json:"account_address"`
|
||||
NetId int32 `json:"net_id"`
|
||||
GoodsId int32 `json:"goods_id"`
|
||||
GoodsNum int32 `json:"goods_num"`
|
||||
AccountAddress string `json:"account_address"`
|
||||
CurrencyAddress string `json:"currency_address"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
@ -95,12 +95,12 @@ func (this *RechargeApi) Buy(c *gin.Context) {
|
||||
func (this *RechargeApi) BuyWithEmail(c *gin.Context) {
|
||||
passportAddress := c.MustGet("account_address").(string)
|
||||
reqJson := struct {
|
||||
NetId int32 `json:"net_id"`
|
||||
GoodsId int32 `json:"goods_id"`
|
||||
GoodsNum int32 `json:"goods_num"`
|
||||
AccountAddress string `json:"account_address"`
|
||||
NetId int32 `json:"net_id"`
|
||||
GoodsId int32 `json:"goods_id"`
|
||||
GoodsNum int32 `json:"goods_num"`
|
||||
AccountAddress string `json:"account_address"`
|
||||
CurrencyAddress string `json:"currency_address"`
|
||||
Email string `json:"email"`
|
||||
Email string `json:"email"`
|
||||
}{}
|
||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||
f5.RspErr(c, 1, err.Error())
|
||||
@ -277,7 +277,7 @@ func (ea *RechargeApi) RechargeQuery(c *gin.Context) {
|
||||
Currency string `gorm:"column:currency_address" json:"currency"`
|
||||
CurrencyName string `gorm:"column:currency_name" json:"currency_name"`
|
||||
Amount string `gorm:"column:price" json:"amount"`
|
||||
Diamond string `gorm:"column:diamond" json:"diamond"`
|
||||
Diamond string `gorm:"column:diamond+present_diamond" json:"diamond"`
|
||||
Date int32 `gorm:"column:createtime" json:"createtime"`
|
||||
Account string `gorm:"column:account_address" json:"account_address"`
|
||||
Passport string `gorm:"column:passport_address" json:"passport_address"`
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"f5"
|
||||
"fmt"
|
||||
"main/constant"
|
||||
"main/service"
|
||||
"q5"
|
||||
"strings"
|
||||
|
||||
@ -25,7 +26,7 @@ func (this *UserApi) Info(c *gin.Context) {
|
||||
Diamond string `json:"diamond"`
|
||||
}{}
|
||||
rspObj.Email = c.MustGet("email").(string)
|
||||
var contributionPoint float64
|
||||
contributionPoint, _ := service.Contribution.GetAddressContribution(accountAddress)
|
||||
var gold float64
|
||||
var diamond float64
|
||||
{
|
||||
@ -52,55 +53,55 @@ func (this *UserApi) Info(c *gin.Context) {
|
||||
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() {
|
||||
// contributionPoint += q5.ToFloat64(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() {
|
||||
// contributionPoint += q5.ToFloat64(ds.GetByIndex(0))
|
||||
// }
|
||||
// })
|
||||
// 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() {
|
||||
contributionPoint += q5.ToFloat64(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() {
|
||||
contributionPoint += q5.ToFloat64(ds.GetByIndex(0))
|
||||
}
|
||||
})
|
||||
if dbErr != nil {
|
||||
f5.RspErr(c, 500, "server internal error")
|
||||
return
|
||||
}
|
||||
}
|
||||
{
|
||||
var dbErr error
|
||||
sql := "SELECT SUM(diamond) FROM t_recharge_order WHERE passport_address = ? AND pay_status = 1 AND delivery_status = 0;"
|
||||
sql := "SELECT SUM(diamond+present_diamond) FROM t_recharge_order WHERE passport_address = ? AND pay_status = 1 AND delivery_status = 0;"
|
||||
params := []string{
|
||||
accountAddress,
|
||||
}
|
||||
|
@ -138,16 +138,18 @@ func (this *contribution) GetAddressContribution(accountAddress string) (float64
|
||||
}
|
||||
|
||||
{
|
||||
params := []string{accountAddress}
|
||||
sql := `SELECT SUM(return_contribution) FROM t_recharge_return_contribution WHERE idx > 0 AND user_identity IN (?`
|
||||
if (*accinfo).loweremail != "" {
|
||||
sql += ", " + (*accinfo).loweremail
|
||||
sql += ", ?"
|
||||
params = append(params, (*accinfo).loweremail)
|
||||
}
|
||||
sql += ")"
|
||||
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.BCNFT_DB,
|
||||
sql,
|
||||
[]string{accountAddress},
|
||||
params,
|
||||
func(err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user