|
@@ -12,6 +12,7 @@ use app\common\model\master_worker\MasterWorkerInfo;
|
|
|
use app\common\model\master_worker\MasterWorkerTeam;
|
|
use app\common\model\master_worker\MasterWorkerTeam;
|
|
|
use app\common\model\works\ServiceWork;
|
|
use app\common\model\works\ServiceWork;
|
|
|
use app\common\service\FileService;
|
|
use app\common\service\FileService;
|
|
|
|
|
+use app\workerapi\lists\MasterWorkerLists;
|
|
|
use app\workerapi\lists\ServiceWorkLists;
|
|
use app\workerapi\lists\ServiceWorkLists;
|
|
|
use think\Exception;
|
|
use think\Exception;
|
|
|
use think\facade\Config;
|
|
use think\facade\Config;
|
|
@@ -23,15 +24,16 @@ use think\facade\Db;
|
|
|
*/
|
|
*/
|
|
|
class MasterWorkerTeamLogic extends BaseLogic
|
|
class MasterWorkerTeamLogic extends BaseLogic
|
|
|
{
|
|
{
|
|
|
- public static function getDetail(int $teamId,int $masterWorkerId)
|
|
|
|
|
|
|
+ public static function getDetail(int $masterWorkerId)
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
- $team = MasterWorkerTeam::where('id',$teamId)->where('master_worker_id',$masterWorkerId)->findOrEmpty();
|
|
|
|
|
|
|
+ $team = MasterWorkerTeam::where('master_worker_id',$masterWorkerId)->findOrEmpty();
|
|
|
if ($team->isEmpty()) {
|
|
if ($team->isEmpty()) {
|
|
|
throw new \Exception('团队不存在');
|
|
throw new \Exception('团队不存在');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return $team->toArray();
|
|
|
|
|
|
|
+ $team = $team->toArray();
|
|
|
|
|
+ $team['count_num'] = MasterWorker::where('team_id',$team['id'])->where('team_role',2)->count();
|
|
|
|
|
+ return $team;
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
self::setError($e->getMessage());
|
|
self::setError($e->getMessage());
|
|
|
return [];
|
|
return [];
|
|
@@ -64,14 +66,14 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- public static function getMemberList(int $teamId,int $masterWorkerId)
|
|
|
|
|
|
|
+ public static function getMemberList(int $masterWorkerId)
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
- $team = MasterWorkerTeam::where('id',$teamId)->where('master_worker_id',$masterWorkerId)->findOrEmpty();
|
|
|
|
|
|
|
+ $team = MasterWorkerTeam::where('master_worker_id',$masterWorkerId)->findOrEmpty();
|
|
|
if ($team->isEmpty()) {
|
|
if ($team->isEmpty()) {
|
|
|
throw new \Exception('团队不存在');
|
|
throw new \Exception('团队不存在');
|
|
|
}
|
|
}
|
|
|
- return MasterWorker::where('team_id',$teamId)->where('team_role',2)->field(['id','nickname','avatar','mobile','real_name','team_role'])->select()->toArray();
|
|
|
|
|
|
|
+ return MasterWorker::where('team_id',$team['id'])->where('team_role',2)->field(['id','nickname','avatar','mobile','real_name','team_role'])->select()->toArray();
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
self::setError($e->getMessage());
|
|
self::setError($e->getMessage());
|
|
|
return [];
|
|
return [];
|
|
@@ -132,23 +134,17 @@ class MasterWorkerTeamLogic extends BaseLogic
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
public static function MemberWorkStatistics($userInfo){
|
|
public static function MemberWorkStatistics($userInfo){
|
|
|
- return ServiceWork::whereIn('master_worker_id',
|
|
|
|
|
|
|
+ $lists = ServiceWork::whereIn('master_worker_id',
|
|
|
MasterWorker::where('team_id', $userInfo['team_id'])->where('team_role', 2)->column('id')
|
|
MasterWorker::where('team_id', $userInfo['team_id'])->where('team_role', 2)->column('id')
|
|
|
)->group('work_status')
|
|
)->group('work_status')
|
|
|
->field('work_status, COUNT(id) as count_num')
|
|
->field('work_status, COUNT(id) as count_num')
|
|
|
->append(['work_status_text'])
|
|
->append(['work_status_text'])
|
|
|
->order('work_status asc')
|
|
->order('work_status asc')
|
|
|
- ->select()
|
|
|
|
|
- ->toArray();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public static function MemberWorkLists($userInfo){
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ->select()->toArray();
|
|
|
|
|
|
|
|
|
|
+ dd(array_column($lists,'count_num','work_status'));
|
|
|
|
|
+ return [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|