@ -1366,6 +1366,22 @@ func GetWithdrawAmountTotalBySQLs(s, e int64, t common.CurrencyType, channel ...
return amount
}
// 通过sql查询代付金额
func GetWithdrawingAmountTotalBySQLs ( s , e int64 , t common . CurrencyType , channel ... * int ) int64 {
var amount int64
if s == e {
e += 24 * 60 * 60
}
sql := fmt . Sprintf ( ` SELECT IFNULL(SUM(amount),0) as amount FROM withdraw_order WHERE event = %v and status in (%v,%v,%v,%v,%v,%v) and callback_time >= %d and callback_time < %d and currency_type = %d ` ,
common . CurrencyEventWithDraw , common . StatusROrderWaitting , common . StatusROrderCreate , common . StatusROrderPay , common . StatusROrderFail , common . StatusROrderCancel , common . StatusROrderPending , s , e , t )
sql += PackChannels ( channel ... )
err := db . Mysql ( ) . QueryBySql ( sql , & amount )
if err != nil {
log . Error ( "查询支付总金额失败, error : [%s]" , err . Error ( ) )
}
return amount
}
// 获取首充人数
func GetFirstPayCount ( s , e int64 , t common . CurrencyType , channel ... * int ) int64 {
q := elastic . NewBoolQuery ( )