|
|
@ -61,6 +61,7 @@ class ReportCommunity extends EloquentRepository |
|
|
'user_id' => $params['user_id'] ?? request()->input('user_id', null), |
|
|
'user_id' => $params['user_id'] ?? request()->input('user_id', null), |
|
|
'market_id' => $params['market_id'] ?? request()->input('market_id',null), |
|
|
'market_id' => $params['market_id'] ?? request()->input('market_id',null), |
|
|
'name' => $params['name'] ?? request()->input('name',false), |
|
|
'name' => $params['name'] ?? request()->input('name',false), |
|
|
|
|
|
'position' => $params['position'] ?? request()->input('position',false), |
|
|
]; |
|
|
]; |
|
|
if(empty($startTime) && empty($endTime)){ |
|
|
if(empty($startTime) && empty($endTime)){ |
|
|
return []; |
|
|
return []; |
|
|
@ -79,6 +80,7 @@ class ReportCommunity extends EloquentRepository |
|
|
|
|
|
|
|
|
// 获取懒族员工
|
|
|
// 获取懒族员工
|
|
|
$employeesData = $this->getEmployeesData($selectsEmp,$params); |
|
|
$employeesData = $this->getEmployeesData($selectsEmp,$params); |
|
|
|
|
|
|
|
|
$employeesData->orderBy('id','desc'); |
|
|
$employeesData->orderBy('id','desc'); |
|
|
if($isPerPage){ |
|
|
if($isPerPage){ |
|
|
$employeeList = $employeesData->paginate($this->perPage); |
|
|
$employeeList = $employeesData->paginate($this->perPage); |
|
|
@ -169,7 +171,8 @@ class ReportCommunity extends EloquentRepository |
|
|
*/ |
|
|
*/ |
|
|
public function getEmployeesData($selects, $params = []) |
|
|
public function getEmployeesData($selects, $params = []) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$departments = config('role.department_value'); |
|
|
|
|
|
$positions = explode(',', $departments[9]); |
|
|
$model = Model::select(DB::raw($selects)); |
|
|
$model = Model::select(DB::raw($selects)); |
|
|
|
|
|
|
|
|
if(isset($params['status']) && is_numeric($params['status'])){ |
|
|
if(isset($params['status']) && is_numeric($params['status'])){ |
|
|
@ -185,6 +188,23 @@ class ReportCommunity extends EloquentRepository |
|
|
if(isset($params['market_id']) && is_numeric($params['market_id'])){ |
|
|
if(isset($params['market_id']) && is_numeric($params['market_id'])){ |
|
|
$model->where('market_id', $params['market_id']); |
|
|
$model->where('market_id', $params['market_id']); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!(isset($params['position']) && $params['position'] == 0)){ |
|
|
|
|
|
// $model->whereJsonContains('position', $positions);
|
|
|
|
|
|
|
|
|
|
|
|
$model->where(function ($query) use ($positions) { |
|
|
|
|
|
foreach($positions as $key => $value){ |
|
|
|
|
|
if($key == 0){ |
|
|
|
|
|
$query->whereJsonContains('position', [$value]); |
|
|
|
|
|
}else{ |
|
|
|
|
|
$query->orWhere(function ($query) use($value){ |
|
|
|
|
|
$query->whereJsonContains('position', $value); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $model; |
|
|
return $model; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|