iferr:=mysql.ProdReadOnlyDB.Raw("select id as user_id,code,SUM(dollar) as dollar,country FROM "+
"(select u.id,u.`code`,SUM(price) / 100 as dollar,u.country FROM pay_order p, `user` u where u.id = p.user_id AND p.`status` = 2 AND `type` = 0 group by user_id UNION ALL select u.id,u.code,SUM(dollar) / 100 as dollar,u.country FROM dealer_transfer_detail d, `user` u where u.id = d.receiver_id group by receiver_id UNION ALL "+
"select u.id,u.code,SUM(dollar) / 100 as dollar,u.country FROM dealer_transfer_detail_pink d, `user` u where u.id = d.receiver_id group by receiver_id) t "+
"where country in (SELECT name FROM res_country where area = 1) group by code order by dollar DESC").Find(&charges).Error;err!=nil{
iferr:=mysql.ProdReadOnlyDB.Raw("select user_id,d,SUM(dollar) / 100 dollar \nFROM (\nSELECT\n\tuser_id,\n\tDATE_FORMAT(created_time,\"%Y-%m\") as d,\n\tSUM(price) as dollar\nFROM\n\t`pay_order`\nWHERE\n\t`status` = '2' AND `type` = 0 AND user_id = ?\nGROUP BY d UNION ALL \nSELECT\n\treceiver_id user_id,\n\tDATE_FORMAT(created_time,\"%Y-%m\") as d,\n\tSUM(dollar) as dollar\nFROM\n\t`dealer_transfer_detail`\nWHERE receiver_id = ?\nGROUP BY d UNION ALL \nSELECT\n\treceiver_id user_id,\n\tDATE_FORMAT(created_time,\"%Y-%m\") as d,\n\tSUM(dollar) as dollar\nFROM\n\t`dealer_transfer_detail_pink`\nWHERE receiver_id = ?\nGROUP BY d\n) t GROUP BY d order by dollar desc ",uid,uid,uid).Find(&md).Error;err!=nil{