@ -177,6 +177,78 @@ class FinanceController extends ThinkController
$this->display();
}
//按月份获取会长统计
public function getRootUser()
{
//获取所有数据
if (!empty(I("count_date"))) {
$month = I("count_date");
} else {
$this->error('月份不能为空');
}
$from = "
(
SELECT root_id,root_name,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,inside_cash_count FROM tab_spend_count WHERE root_id > 0 and count_date='{$month}' group by root_id
UNION
SELECT promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,inside_cash_count FROM tab_spend_count WHERE parent_id = 0 and count_date='{$month}' group by promote_id
UNION
SELECT parent_id,parent_name,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,inside_cash_count FROM tab_spend_count WHERE parent_id > 0 and root_id = 0 and count_date='{$month}' group by parent_id
if (!empty(I("count_date")) && !empty(I("root_id"))) {
$month = I("count_date");
$root_id = I("root_id");
} else {
$this->error('参数错误');
}
//获取数据
$from = "
(
SELECT root_id,root_name,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,inside_cash_count FROM tab_spend_count WHERE root_id = '{$root_id}' and count_date='{$month}' group by root_id
UNION
SELECT promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,inside_cash_count FROM tab_spend_count WHERE parent_id = '{$root_id}' and count_date='{$month}' group by promote_id
if (!empty(I("count_date")) && !empty(I("parent_id"))) {
$month = I("count_date");
$parent_id = I("parent_id");
} else {
$this->error('参数错误');
}
//获取数据
$from = "
(
SELECT promote_id,promote_account,sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,inside_cash_count FROM tab_spend_count WHERE parent_id = '{$parent_id}' and count_date='{$month}' group by promote_id