维护用户排序

This commit is contained in:
wanyongkang
2020-11-24 15:56:59 +08:00
parent a326346f5b
commit b0b6da63d4
3 changed files with 18 additions and 19 deletions

View File

@@ -66,6 +66,8 @@ class SellInfo extends Controller
}
$user_where = ['UserId' => ['in', $user_id_list]];
$register_where = ['UserId' => ['in', $register_id_list]];
//获取所有消费额
$cost_data = $product_order_model->getAllMoney();
//获取本月所有消费额
$all_cost_data = $product_order_model->getAllMoney($time_where1);
//获取本月该客户经理所有的消费额
@@ -92,7 +94,7 @@ class SellInfo extends Controller
$sell_percent = ($all_cost ? round($user_cost / $all_cost * 100, 2) : 0);
$cost_percent = ($all_cost_num ? round($user_cost_num / $all_cost_num * 100, 2) : 0);
$cost_register = ($user_register_count ? round($user_register_cost_count / $user_register_count * 100, 2) : 0);
$cost_old_user = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($all_cost_num - $user_register_count) * 100, 2) : 0);
$cost_old_user = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($cost_data['num'] - $user_register_count) * 100, 2) : 0);
$com_cost = round(($user_cost - $user_last_month_cost), 2);
$com_percent = ($user_last_month_cost ? round(($user_cost - $user_last_month_cost) / $user_last_month_cost * 100, 2) : 0);
$today_new_user = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list);
@@ -101,7 +103,7 @@ class SellInfo extends Controller
$data['sell_percent'] = "我的营业额($user_cost)/总营业额($all_cost)=" . $sell_percent . '%';
$data['cost_percent'] = "消费客户数($user_cost_num)/所有客户($all_cost_num)=" . $cost_percent . '%';
$data['cost_register'] = "注册且购买过的客户($user_register_cost_count)/当月新注册客户总数($user_register_count)=" . $cost_register . '%';
$data['cost_old_user'] = "老客户在本月再次购买(" . ($user_cost_num - $user_register_cost_count) . ")/所有老客户(" . ($all_cost_num - $user_register_count) . ')=' . $cost_old_user . '%';
$data['cost_old_user'] = "老客户在本月再次购买(" . ($user_cost_num - $user_register_cost_count) . ")/所有老客户(" . ($cost_data['num'] - $user_register_count) . ')=' . $cost_old_user . '%';
$data['com_cost'] = "同比增加金额=" . $com_cost;
$data['com_percent'] = "同比增加百分比=" . $com_percent . '%';
$data['today_new_user'] = "今日新赠客户" . $today_new_user;
@@ -175,7 +177,8 @@ class SellInfo extends Controller
}
}
$user_where = ['UserId' => ['in', $user_id_list]];
$register_where = ['UserId' => ['in', $register_id_list]];
$register_where = ['UserId' => ['in', $register_id_list]]; //获取所有消费额
$cost_data = $product_order_model->getAllMoney();
//获取本月所有消费额
$all_cost_data = $product_order_model->getAllMoney($time_where1);
//获取本月该客户经理所有的消费额
@@ -202,7 +205,7 @@ class SellInfo extends Controller
$data['sell_percent'] = ($all_cost ? round($user_cost / $all_cost * 100, 2) : 0) . '%';
$data['cost_percent'] = ($all_cost_num ? round($user_cost_num / $all_cost_num * 100, 2) : 0) . '%';
$data['cost_register'] = ($user_register_count ? round($user_register_cost_count / $user_register_count * 100, 2) : 0) . '%';
$data['cost_old_user'] = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($all_cost_num - $user_register_count) * 100, 2) : 0) . '%';
$data['cost_old_user'] = (($all_cost_num - $user_register_count) ? round(($user_cost_num - $user_register_cost_count) / ($cost_data['num'] - $user_register_count) * 100, 2) : 0) . '%';
$data['com_cost'] = round(($user_cost - $user_last_month_cost), 2);
$data['com_percent'] = ($user_last_month_cost ? round(($user_cost - $user_last_month_cost) / $user_last_month_cost * 100, 2) : 0) . '%';
$data['today_new_user'] = ($user_today_cost_data ? $user_today_cost_data['num'] : 0) . "/" . count($today_register_id_list);