iferr:=mysql.ProdReadOnlyDB.Table("diamond_account_detail AS d").
Joins("INNER JOIN dealer_transfer_detail AS t ON d.origin_id = t.id").
Where("DATE(d.created_time) >= ? AND DATE(d.created_time) <= ? AND operate_type = ? AND add_reduce = 1",
date,date,26).Select("d.user_id,SUM(t.dollar) as money").
Group("d.user_id").
Scan(&money).Error;err!=nil{
returnnil,err
}
returnmoney,nil
}
// 获取参与人数
funcGetFruitUserNum(datestring)(int,error){
varstakeint
iferr:=mysql.ProdReadOnlyDB.Table("fruit_machine_stake").Where("`date`= ?",date).Select("count(DISTINCT user_id) as total").Scan(&stake).Error;err!=nil{
returnstake,err
}
returnstake,nil
}
// 总回收
funcGetFruitRecycle(datestring)(int,error){
vartotalint
iferr:=mysql.ProdReadOnlyDB.Table("fruit_machine").Where("`date`= ?",date).Select("SUM(stake) as total").Scan(&total).Error;err!=nil{