by Robin at 20240516

This commit is contained in:
Leufolium 2024-05-16 16:00:20 +08:00
parent 3a3c50f851
commit 0c3bb46562
1 changed files with 3 additions and 4 deletions

View File

@ -505,14 +505,13 @@ func (m *Mysql) GetZoneRefundHisList(ctx *gin.Context, tx *sqlx.Tx, mid, zid int
func (m *Mysql) GetLastHourZoneProfit(ctx *gin.Context, tx *sqlx.Tx, st, et int64) (list []*dbstruct.ZoneProfit, err error) {
var sql strings.Builder
sql.WriteString(fmt.Sprintf("select uid as mid, oid1 as zid, product_id, count(1) as num, sum(pay_amount) as amount from %s", TableOrder))
sql.WriteString(fmt.Sprintf(" where ct >=%d and ct<=%d and product_id in(%s,%s,%s,%s) and order_status = 1 group by product_id, uid, oid1", st, et,
dbstruct.ProductIdH5ZoneMoment, dbstruct.ProductIdH5ZoneAdmission, dbstruct.ProductIdH5ZoneIronfanship, dbstruct.ProductIdH5ZoneSuperfanship))
sql.WriteString(fmt.Sprintf(" where ct >=%d and ct<=%d and product_id in(?,?,?,?) and order_status = 1 group by product_id, uid, oid1", st, et))
list = make([]*dbstruct.ZoneProfit, 0)
if tx != nil {
err = tx.SelectContext(ctx, &list, sql.String())
err = tx.SelectContext(ctx, &list, sql.String(), dbstruct.ProductIdH5ZoneMoment, dbstruct.ProductIdH5ZoneAdmission, dbstruct.ProductIdH5ZoneIronfanship, dbstruct.ProductIdH5ZoneSuperfanship)
} else {
db := m.getDBVas()
err = db.SelectContext(ctx, &list, sql.String())
err = db.SelectContext(ctx, &list, sql.String(), dbstruct.ProductIdH5ZoneMoment, dbstruct.ProductIdH5ZoneAdmission, dbstruct.ProductIdH5ZoneIronfanship, dbstruct.ProductIdH5ZoneSuperfanship)
}
if err != nil {
return