sth
This commit is contained in:
parent
82447b27ad
commit
0c2629f236
|
|
@ -19,14 +19,14 @@ class Dispatcher extends Backend
|
|||
|
||||
/**
|
||||
* Staorder模型对象
|
||||
* @var \app\admin\model\Order
|
||||
* @var Order
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
public function _initialize(): void
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\Order();
|
||||
$this->model = new Order();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -116,12 +116,10 @@ class Dispatcher extends Backend
|
|||
return $newData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws DbException
|
||||
*/
|
||||
public function orderSubSql()
|
||||
//图表统计
|
||||
public function chart($filter,$getAll=false): \think\Collection|\think\Paginator|bool|array|string|\PDOStatement
|
||||
{
|
||||
|
||||
$orderValid = implode(',',$this->model->tabStatus(Order::TAB_VALID));
|
||||
|
||||
//"COUNT(CASE WHEN status IN (".$orderValid.") THEN 1 END) AS ing_num",
|
||||
|
|
@ -140,9 +138,39 @@ class Dispatcher extends Backend
|
|||
// "SUM(CASE WHEN status = 60 THEN (field1 + field2) END) AS performance",
|
||||
];
|
||||
|
||||
return $this->model->field($fields)->group('worker_id')->buildSql();
|
||||
$builder = $this->model
|
||||
->field($fields);
|
||||
//->where('dispatch_admin_id','>',0);
|
||||
|
||||
/* $newData = [];
|
||||
if(!empty($filter['admin_id'])){
|
||||
$builder->where('dispatch_admin_id',$filter['admin_id']);
|
||||
}
|
||||
|
||||
if(!empty($filter['start_time']) && !empty($filter['end_time'])){
|
||||
$time_by = $filter['time_by'] ??1;
|
||||
if($time_by == 1){ //按派单时间
|
||||
$time_field = 'dispatch_time';
|
||||
}else{ //按录单时间
|
||||
$time_field = 'create_time';
|
||||
}
|
||||
$builder->whereBetween($time_field,[$filter['start_time'],$filter['end_time']]);
|
||||
}
|
||||
//城市
|
||||
if(!empty($filter['area_id'])){
|
||||
$builder->where('area_id',$filter['area_id']);
|
||||
}
|
||||
//项目
|
||||
if(!empty($filter['item_id'])){
|
||||
$builder->where('item_id',$filter['item_id']);
|
||||
}
|
||||
|
||||
if($getAll){
|
||||
$data = $builder->group('dispatch_admin_id')->limit(50)->select();
|
||||
}else{
|
||||
$data = $builder->group('dispatch_admin_id')->paginate();
|
||||
}
|
||||
|
||||
$newData = [];
|
||||
|
||||
if(!empty($data)){
|
||||
foreach ($data as &$datum){
|
||||
|
|
@ -173,7 +201,7 @@ class Dispatcher extends Backend
|
|||
return $newData;
|
||||
}else{
|
||||
return $data;
|
||||
}*/
|
||||
}
|
||||
//dump($newData);exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user