This commit is contained in:
@@ -10,6 +10,7 @@ use app\agent\model\ProductPackage as PoductPackageModel;
|
||||
use app\agent\model\AgentPrice as AgentPriceModel;
|
||||
use app\agent\model\AgentScore as AgentScoreModel;
|
||||
use app\agent\model\ProductPriceDiscount as ProductPriceDiscountModel;
|
||||
use app\agent\model\ProductOrder as ProductOrderModel;
|
||||
|
||||
class Agent extends Controller
|
||||
{
|
||||
@@ -26,6 +27,8 @@ class Agent extends Controller
|
||||
}
|
||||
$agent_user_model = new AgentUser;
|
||||
$user_model = new UserModel;
|
||||
$order_model = new ProductOrderModel;
|
||||
|
||||
$user_list = $agent_user_model->getListPage($where, '*', 'id desc', "$page,50");
|
||||
|
||||
//获取代理商下的用户数
|
||||
@@ -36,10 +39,36 @@ class Agent extends Controller
|
||||
$agent_ids[] = $info['id'];
|
||||
$list[$info['id']] = $info;
|
||||
}
|
||||
|
||||
$last_month_cost_money = $order_model->getLastMonthCost($agent_ids);
|
||||
$last_month_refund_money = $order_model->getLastMonthRefund($agent_ids);
|
||||
$month_cost_money = $order_model->getMonthCost($agent_ids);
|
||||
$month_refund_money = $order_model->getMonthRefund($agent_ids);
|
||||
|
||||
$last_cost_list = $last_refund_list = $cost_list = $refund_list = [];
|
||||
|
||||
foreach ($last_month_cost_money as $info){
|
||||
$last_cost_list[$info['agent_id']] = $info['pay_money'];
|
||||
}
|
||||
foreach ($last_month_refund_money as $info){
|
||||
$last_refund_list[$info['agent_id']] = $info['pay_money'];
|
||||
}
|
||||
foreach ($month_cost_money as $info){
|
||||
$cost_list[$info['agent_id']] = $info['pay_money'];
|
||||
}
|
||||
foreach ($month_refund_money as $info){
|
||||
$refund_list[$info['agent_id']] = $info['pay_money'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$agent_user_num = $user_model->getAgentUser(['agent_id'=>['in',$agent_ids]]);
|
||||
foreach ($agent_user_num as $info){
|
||||
$list[$info['agent_id']]['user_num'] = $info['num'];
|
||||
$list[$info['agent_id']]['last_cost'] = round($last_cost_list[$info['agent_id']] - $last_refund_list[$info['agent_id']],2);
|
||||
$list[$info['agent_id']]['cost'] = round($cost_list[$info['agent_id']] - $refund_list[$info['agent_id']],2);
|
||||
}
|
||||
// dump($list);die;
|
||||
$list = array_merge($list);
|
||||
|
||||
$data = [
|
||||
|
||||
Reference in New Issue
Block a user