/ 风控支持 /
SELECT U.user_id, U.country_id AS '国家', U.language AS '语言', U.email, U.telephone, T.withdrawing AS '提币申请', T.withdraw_fee AS '手续费',A.margin_balance/1e8 AS '保证金余额', T.times_deposit AS '充次数', T.times_withdraw AS '提次数', T.total_deposit AS '总充值', T.total_withdraw AS '总提现',from_unixtime(T.first_deposit/1000+28800,'%Y-%m-%d') AS '首充时间',from_unixtime(T.last_deposit/1000+28800,'%Y-%m-%d') AS '最后时间',from_unixtime(T.first_withdraw/1000+28800,'%Y-%m-%d') AS '首提时间',from_unixtime(T.last_withdraw/1000+28800,'%Y-%m-%d') AS '最后时间',C.total_commission AS '总佣金', B.total_bonus AS '总赠金',TS.transfer_in AS '转入',TS.transfer_out AS '转出', TS.transfer_in - TS.transfer_out AS '净转'FROM management.t_trade_user AS ULEFT JOIN clear.t_account AS A ON A.client_id = U.user_idLEFT JOIN (SELECT USER_ID, transaction_status,IF(transaction_status='0',amount/1e8,NULL) AS 'withdrawing',IF(transaction_status='0',withdraw_fee/1e8,NULL) AS 'withdraw_fee',COUNT(IF(transaction_status='5',true,NULL)) AS 'times_deposit',COUNT(IF(transaction_status='7',true,NULL)) AS 'times_withdraw',SUM(IF(transaction_status='5',amount/1e8,0)) AS 'total_deposit',SUM(IF(transaction_status='7',amount/1e8,0)) AS 'total_withdraw',MIN(IF(transaction_status='5',operate_time,NULL)) AS 'first_deposit',MAX(IF(transaction_status='5',operate_time,NULL)) AS 'last_deposit',MIN(IF(transaction_status='7',operate_time,NULL)) AS 'first_withdraw',MAX(IF(transaction_status='7',operate_time,NULL)) AS 'last_withdraw'FROM management.t_wallet_transaction_history WHERE transaction_status IN ('0','5','7')GROUP BY USER_ID) AS TON U.USER_ID = T.USER_IDLEFT JOIN (SELECT inviter, SUM(commission_amount)/1e8 as 'total_commission' FROM affiliate.t_affiliate_commission_transfer GROUP BY inviter)AS CON C.inviter = U.USER_IDLEFT JOIN (SELECT SUM(amount/1e8)AS total_bonus, in_client_id FROM management.t_donation_transfer WHERE transfer_status = 7 GROUP BY in_client_id) AS BON B.in_client_id = U.USER_IDLEFT JOIN (SELECT transfer_out_client_id, transf
