|
|
@@ -34,7 +34,7 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
throw new \Exception('团队不存在');
|
|
|
}
|
|
|
$team = $team->toArray();
|
|
|
- $team['count_num'] = MasterWorker::where('team_id',$team['id'])->where('team_role',2)->count();
|
|
|
+ $team['count_num'] = MasterWorker::where('team_id',$team['id'])->count();
|
|
|
return $team;
|
|
|
} catch (\Exception $e) {
|
|
|
self::setError($e->getMessage());
|
|
|
@@ -105,7 +105,7 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
if ($team->isEmpty()) {
|
|
|
throw new \Exception('团队不存在');
|
|
|
}
|
|
|
- return MasterWorker::where('team_id',$team['id'])->where('team_role',2)->field(['id','nickname','avatar','mobile','real_name','team_role'])->select()->toArray();
|
|
|
+ return MasterWorker::where('team_id',$team['id'])->field(['id','nickname','avatar','mobile','real_name','team_role'])->select()->toArray();
|
|
|
} catch (\Exception $e) {
|
|
|
self::setError($e->getMessage());
|
|
|
return [];
|
|
|
@@ -132,7 +132,7 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
if($work->master_worker_id == $params['master_worker_id']){
|
|
|
throw new \Exception('分配的工程师相同');
|
|
|
}
|
|
|
- $worker = MasterWorker::where(['id'=>$params['master_worker_id'],'team_id' =>$userInfo['team_id'],'team_role' =>2,'is_disable' =>0])->findOrEmpty();
|
|
|
+ $worker = MasterWorker::where(['id'=>$params['master_worker_id'],'team_id' =>$userInfo['team_id'],'is_disable' =>0])->findOrEmpty();
|
|
|
if($worker->isEmpty()){
|
|
|
throw new \Exception('成员工程师不存在或被禁用');
|
|
|
}
|
|
|
@@ -166,8 +166,8 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function MemberWorkStatistics($userInfo){
|
|
|
- $lists = ServiceWork::whereIn('master_worker_id',
|
|
|
- MasterWorker::where('team_id', $userInfo['team_id'])->where('team_role', 2)->column('id')
|
|
|
+ $lists = ServiceWork::where('tenant_id',
|
|
|
+ (MasterWorkerTeam::where('id',$userInfo['team_id'])->value('tenant_id')??-1)
|
|
|
)->group('work_status')
|
|
|
->field('work_status, COUNT(id) as count_num')
|
|
|
->order('work_status asc')
|
|
|
@@ -200,8 +200,8 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
$start_time = strtotime($month.'-01');
|
|
|
$end_time = $start_time + 31 * 86400;
|
|
|
}
|
|
|
- $lists = ServiceWork::whereIn('master_worker_id',
|
|
|
- MasterWorker::where('team_id', $userInfo['team_id'])->where('team_role', 2)->column('id')
|
|
|
+ $lists = ServiceWork::where('tenant_id',
|
|
|
+ (MasterWorkerTeam::where('id',$userInfo['team_id'])->value('tenant_id')??-1)
|
|
|
)->group('DATE(FROM_UNIXTIME(create_time))')
|
|
|
->field('DATE(FROM_UNIXTIME(create_time)) as days, COUNT(id) as count_num')
|
|
|
->where('create_time','between',[$start_time,$end_time])
|