From df63a6c89f0ea155cb9507a40c46923389366448 Mon Sep 17 00:00:00 2001 From: xman <1946321327@qq.com> Date: Mon, 28 Apr 2025 10:22:20 +0800 Subject: [PATCH] sth --- .../admin/controller/statistics/Worker.php | 43 +++++++++++++++++-- .../admin/view/statistics/worker/index.html | 30 ++++++++----- 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/application/admin/controller/statistics/Worker.php b/application/admin/controller/statistics/Worker.php index afd5fc2..43018db 100644 --- a/application/admin/controller/statistics/Worker.php +++ b/application/admin/controller/statistics/Worker.php @@ -3,6 +3,7 @@ namespace app\admin\controller\statistics; use app\admin\model\Admin; +use app\admin\model\Aftersale; use app\admin\model\Order; use app\admin\model\OrderDispatch; use app\common\controller\Backend; @@ -57,14 +58,50 @@ class Worker extends Backend */ public function index() { - - - //设置过滤方法 $this->request->filter(['strip_tags', 'trim']); if (false === $this->request->isAjax()) { $appkey = config('map.baidu_app_key'); $this->assign('mapkey',$appkey); + + $count = \app\admin\model\Worker::count(); + $active_count = \app\admin\model\Worker::where('location_update_time', '>=', date('Y-m-d H:i:s', strtotime('-30 days'))) + ->count(); + + $add_count_1 = \app\admin\model\Worker::where('create_time', '>=', date('Y-m-d')) + ->count(); + + $active_count_7 = \app\admin\model\Worker::where('create_time', '>=', date('Y-m-d H:i:s', strtotime('-7 days'))) + ->count(); + + $this->assign('count',$count); + $this->assign('active_count',$active_count); + $this->assign('add_count_1',$add_count_1); + $this->assign('add_count_7',$active_count_7); + + //待接单 + $todo_count = OrderDispatch::where('status',OrderDispatch::STATUS_TOGET)->count(); + //进行中 + $ing_count = OrderDispatch::whereIn('status',[OrderDispatch::STATUS_GOTIT,OrderDispatch::STATUS_PLANIT,OrderDispatch::STATUS_CLOCK])->count(); + //待验收 + $check_count = OrderDispatch::where('status',Order::STATUS_CHECKING)->count(); + //售后待处理 + $aftersale_count = Aftersale::where('status',1)->count(); + + $this->assign('todo_count',$todo_count); + $this->assign('ing_count',$ing_count); + $this->assign('check_count',$check_count); + $this->assign('aftersale_count',$aftersale_count); + + //师傅坐标 + $list = \app\admin\model\Worker::where('lng','>',0)->field(['lng','lat'])->select(); + $arr = []; + foreach ($list as $item){ + $arr[] = [ + $item->lng, $item->lat, + ]; + } + $this->assign('locationData',json_encode($arr)); return $this->view->fetch(); } //如果发送的来源是 Selectpage,则转发到 Selectpage diff --git a/application/admin/view/statistics/worker/index.html b/application/admin/view/statistics/worker/index.html index b851d2d..0b8cb66 100644 --- a/application/admin/view/statistics/worker/index.html +++ b/application/admin/view/statistics/worker/index.html @@ -189,7 +189,7 @@
- 100/10 + {$count}/{$active_count} 师傅总数/活跃数
@@ -199,8 +199,8 @@
- 100 - 今日新增 + {$add_count_1}/{$add_count_7} + 今日新增/7天新增
@@ -209,8 +209,8 @@
- 100 - 师傅总数 + {$todo_count}/{$ing_count}/{$check_count} + 待接单/进行中/待验收
@@ -219,12 +219,11 @@
- 100 - 师傅总数 + {$aftersale_count} + 待处理售后
- @@ -253,6 +252,10 @@