iferr:=mysql.ProdReadOnlyDB.Raw("select max(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'\nAND `type` = '0'\nAND created_time >= \"2022-07-01\"\nAND user_id = ?\nGROUP BY user_id,d \nUNION 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\n\tcreated_time >= \"2022-07-01\"\nAND receiver_id = ?\nGROUP BY\n\treceiver_id,\n\td\n) t",uid,uid).Scan(&dollar).Error;err!=nil{
iferr:=mysql.ProdReadOnlyDB.Raw("select MAX(dollar) FROM\n(\nselect d,SUM(dollar) as dollar FROM (\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'\nAND `type` = '0'\nAND created_time >= \"2022-07-01\"\nAND user_id = ?\nGROUP BY user_id,d \nUNION 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\n\tcreated_time >= \"2022-07-01\"\nAND receiver_id = ?\nGROUP BY\n\treceiver_id,\n\td\n) t GROUP BY d\n) t2",uid,uid).Scan(&dollar).Error;err!=nil{