queryCount:=" SELECT COUNT(*) as count FROM recharge_order AS re "
queryCount:=" SELECT COUNT(*) as count FROM recharge_order AS re "
queryAmount:=" SELECT SUM(amount) as amount FROM recharge_order AS re "
queryAmount:=" SELECT SUM(amount) as amount FROM recharge_order AS re "
varstrstring
varstr,orderStrstring
ifreq.Status!=nil&&*req.Status==2{
ifreq.Status!=nil&&*req.Status==2{
str=fmt.Sprintf(" callback_time >= %d AND callback_time < %d AND event in (%d,%d) ",su,eu,common.CurrencyEventReCharge,common.CurrencyEventActivityWeekCard)
str=fmt.Sprintf(" callback_time >= %d AND callback_time < %d AND `event` in (%d,%d) ",su,eu,common.CurrencyEventReCharge,common.CurrencyEventActivityWeekCard)
}else{
}else{
str=fmt.Sprintf(" create_time >= %d AND create_time < %d AND event in (%d,%d) ",su,eu,common.CurrencyEventReCharge,common.CurrencyEventActivityWeekCard)
str=fmt.Sprintf(" create_time >= %d AND create_time < %d AND `event` in (%d,%d) ",su,eu,common.CurrencyEventReCharge,common.CurrencyEventActivityWeekCard)
}
}
ifreq.Channel!=nil{
ifreq.Channel!=nil{
str+=fmt.Sprintf(" AND channel_id = %d",*req.Channel)
str+=fmt.Sprintf(" AND channel_id = %d",*req.Channel)
}
}
ifreq.Status!=nil{
ifreq.Status!=nil{
str+=fmt.Sprintf(" AND status = %d",*req.Status)
str+=fmt.Sprintf(" AND `status` = %d",*req.Status)
queryOrder:=" SELECT * FROM withdraw_order AS re where"
queryOrder:=" SELECT * FROM withdraw_order AS re where"
queryCount:=" SELECT COUNT(*) as count FROM withdraw_order AS re where"
queryCount:=" SELECT COUNT(*) as count FROM withdraw_order AS re where"
str:=fmt.Sprintf(" event = %d AND create_time >= %d AND create_time < %d ",common.CurrencyEventWithDraw,st,et)
str:=fmt.Sprintf(" `event` = %d AND create_time >= %d AND create_time < %d ",common.CurrencyEventWithDraw,st,et)
ifreq.Channel!=nil{
ifreq.Channel!=nil{
str+=fmt.Sprintf(" AND channel_id = %d ",*req.Channel)
str+=fmt.Sprintf(" AND channel_id = %d ",*req.Channel)
}
}
ifreq.Status!=nil{
ifreq.Status!=nil{
str+=fmt.Sprintf(" AND status = %d ",*req.Status)
str+=fmt.Sprintf(" AND `status` = %d ",*req.Status)
}
ifreq.Uid!=nil{
str+=fmt.Sprintf(" AND uid = %d ",*req.Uid)
}
}
// queryOrder += " LEFT JOIN ( SELECT uid, SUM(amount) AS totalAmount FROM withdraw_order WHERE " + str + " GROUP BY uid) rm ON rm.uid = re.uid WHERE rm.uid = re.uid AND "
// queryOrder += " LEFT JOIN ( SELECT uid, SUM(amount) AS totalAmount FROM withdraw_order WHERE " + str + " GROUP BY uid) rm ON rm.uid = re.uid WHERE rm.uid = re.uid AND "
sql:=fmt.Sprintf("event = %v and status = %v and create_time >= %d and create_time < %d",common.CurrencyEventWithDraw,common.StatusROrderFinish,s,e)
sql:=fmt.Sprintf("`event` = %v and `status` = %v and create_time >= %d and create_time < %d",common.CurrencyEventWithDraw,common.StatusROrderFinish,s,e)
ifreq.Channel!=nil{
ifreq.Channel!=nil{
sql+=fmt.Sprintf(" and channel_id = %v",*req.Channel)
sql+=fmt.Sprintf(" and channel_id = %v",*req.Channel)
queryOrder:=fmt.Sprintf(" SELECT * FROM withdraw_order WHERE event = %d AND (apipayid = '%s' or orderid = '%s') ",common.CurrencyEventWithDraw,req.OrderId,req.OrderId)
queryOrder:=fmt.Sprintf(" SELECT * FROM withdraw_order WHERE `event` = %d AND (apipayid = '%s' or orderid = '%s') ",common.CurrencyEventWithDraw,req.OrderId,req.OrderId)