|
|
@@ -93,7 +93,17 @@ class MasterWorkerServiceOrderLists extends BaseAdminDataLists implements ListsS
|
|
|
$where[] = ['a.audit_state','=' ,1];
|
|
|
return $where;
|
|
|
}
|
|
|
-
|
|
|
+ public function queryWhereLog()
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ if (!empty($this->params['start_time'])) {
|
|
|
+ $where[0] = $this->params['start_time'];
|
|
|
+ }
|
|
|
+ if (!empty($this->params['end_time'])) {
|
|
|
+ $where[1] = strtotime($this->params['end_time'])+86400;
|
|
|
+ }
|
|
|
+ return $where;
|
|
|
+ }
|
|
|
/**
|
|
|
* 获取数据权限
|
|
|
* $this->adminInfo['data_rules']
|
|
|
@@ -125,6 +135,7 @@ class MasterWorkerServiceOrderLists extends BaseAdminDataLists implements ListsS
|
|
|
public function lists(): array
|
|
|
{
|
|
|
$queryWhere = $this->queryWhere();
|
|
|
+ $queryWhereLog = $this->queryWhereLog();
|
|
|
$lists = Db::name('master_worker')->alias('a')->field([
|
|
|
'a.id','a.real_name','a.nickname','a.area_name','a.worker_number','a.recruiting_behalf','a.mobile','a.cooperation','a.category_ids','a.labels','a.remark',
|
|
|
Db::raw("COUNT(b.id) AS all_count"),
|
|
|
@@ -146,7 +157,10 @@ class MasterWorkerServiceOrderLists extends BaseAdminDataLists implements ListsS
|
|
|
foreach ($lists as &$item) {
|
|
|
$item['labels'] = $item['labels']?array_map(function ($item) { return intval($item); },explode(',',$item['labels'])):'';
|
|
|
$item['category_name'] = $item['category_ids']?implode('、',array_column(get_parent_info($categoryData,explode(',',$item['category_ids'])),'name')):'';
|
|
|
- $item['allocate_num'] = ServiceWorkAllocateWorkerLog::where(['master_worker_id'=>$item['id']])->count();
|
|
|
+ $item['allocate_num'] = ServiceWorkAllocateWorkerLog::where(['master_worker_id'=>$item['id']])
|
|
|
+ ->where('type',0)
|
|
|
+ ->whereBetweenTime('create_time',$queryWhereLog[0],$queryWhereLog[1])
|
|
|
+ ->count();
|
|
|
$item['register_info'] = $masterWorkerRegisters[$item['id']]??[];
|
|
|
}
|
|
|
return $lists;
|