调整
This commit is contained in:
parent
af951bad87
commit
19c062423a
@ -128,10 +128,15 @@ func (sa *StackingApi) ContributionQuery(c *gin.Context) {
|
||||
|
||||
func (sa *StackingApi) DiamondRecordQuery(c *gin.Context) {
|
||||
accountAddress := strings.ToLower(c.Param("account_address"))
|
||||
type Record struct {
|
||||
Date int32 `json:"date"`
|
||||
Amount string `json:"amount"`
|
||||
Type int32 `json:"type"`
|
||||
}
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Rows []interface{} `json:"rows"`
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Rows []*Record `json:"rows"`
|
||||
}{}
|
||||
|
||||
{
|
||||
@ -150,20 +155,46 @@ func (sa *StackingApi) DiamondRecordQuery(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
obj := struct {
|
||||
Date int32 `json:"date"`
|
||||
Amount string `json:"amount"`
|
||||
Type int32 `json:"type"`
|
||||
}{}
|
||||
obj := new(Record)
|
||||
|
||||
for ds.Next() {
|
||||
obj.Date = q5.SafeToInt32(ds.GetByName("createtime"))
|
||||
obj.Amount = ds.GetByName("amount")
|
||||
obj.Type = q5.SafeToInt32(ds.GetByName("type"))
|
||||
obj.Type = 1
|
||||
rspObj.Rows = append(rspObj.Rows, obj)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
sql := `SELECT * FROM t_recharge_order WHERE passport_address = ? AND pay_status = 1 ORDER BY createtime DESC`
|
||||
params := []string{
|
||||
accountAddress,
|
||||
}
|
||||
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.BCNFT_DB,
|
||||
sql,
|
||||
params,
|
||||
func(err error, ds *f5.DataSet) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
obj := new(Record)
|
||||
|
||||
for ds.Next() {
|
||||
obj.Date = q5.SafeToInt32(ds.GetByName("pay_time"))
|
||||
obj.Amount = ds.GetByName("diamond")
|
||||
obj.Type = 0
|
||||
rspObj.Rows = append(rspObj.Rows, obj)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
q5.Sort(rspObj.Rows, func(a *Record, b *Record) bool {
|
||||
return a.Date > b.Date
|
||||
})
|
||||
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user