作者 ZhengBing He

team ok

@@ -100,6 +100,22 @@ class FetchTicketProjects extends Command @@ -100,6 +100,22 @@ class FetchTicketProjects extends Command
100 elseif ($status == 1) 100 elseif ($status == 1)
101 $engineer_id = $pm_id; // 建站中找项目经理 101 $engineer_id = $pm_id; // 建站中找项目经理
102 102
  103 + $team_names = [
  104 + $item['pm'],
  105 + $item['assm'],
  106 + $item['yhs'],
  107 + $item['team_leader'],
  108 + $item['technology'],
  109 + $item['designer'],
  110 + $item['yhszl'],
  111 + ];
  112 + // 过滤掉空值,去掉重复
  113 + $team_ids = ManageHr::whereIn('name', $team_names)->pluck('manage_id')
  114 + ->unique()
  115 + ->filter(fn($v) => !is_null($v) && $v !== 0)
  116 + ->values()
  117 + ->toArray();
  118 +
103 $fields = [ 119 $fields = [
104 'post_id' => $item['postid'], 120 'post_id' => $item['postid'],
105 'company_name' => $item['company'], 121 'company_name' => $item['company'],
@@ -114,7 +130,8 @@ class FetchTicketProjects extends Command @@ -114,7 +130,8 @@ class FetchTicketProjects extends Command
114 'project_cate' => 1, 130 'project_cate' => 1,
115 'pm_id' => $pm_id, 131 'pm_id' => $pm_id,
116 'status' => $status, // 项目状态 132 'status' => $status, // 项目状态
117 - 'wechat_group_id' => $item['wx_id'] 133 + 'wechat_group_id' => $item['wx_id'],
  134 + 'team' => $team_ids ? json_encode($team_ids) : null,
118 ]; 135 ];
119 if (!$project) { 136 if (!$project) {
120 $new = new TicketProject(); 137 $new = new TicketProject();
@@ -212,6 +229,23 @@ class FetchTicketProjects extends Command @@ -212,6 +229,23 @@ class FetchTicketProjects extends Command
212 || $item->site_status == 1 229 || $item->site_status == 1
213 ) ? 1 : 0; 230 ) ? 1 : 0;
214 231
  232 + $team_ids = [
  233 + $item->deploy_build->leader_mid,
  234 + $item->deploy_build->manager_mid,
  235 + $item->deploy_build->designer_mid,
  236 + $item->deploy_build->tech_mid,
  237 + $item->deploy_optimize->manager_mid,
  238 + $item->deploy_optimize->optimist_mid,
  239 + $item->deploy_optimize->assist_mid,
  240 + $item->deploy_optimize->tech_mid,
  241 + $item->deploy_optimize->tech_leader,
  242 + ];
  243 + // $team_ids 去重复
  244 + $team_ids = array_unique($team_ids);
  245 + $team_ids = array_filter($team_ids);
  246 + // $team_ids 去掉下标
  247 + $team_ids = array_values($team_ids);
  248 +
215 $fields = [ 249 $fields = [
216 'company_name' => $item->company, 250 'company_name' => $item->company,
217 'title' => $item->title . " - V6", 251 'title' => $item->title . " - V6",
@@ -230,6 +264,7 @@ class FetchTicketProjects extends Command @@ -230,6 +264,7 @@ class FetchTicketProjects extends Command
230 ->value('friend_id'), 264 ->value('friend_id'),
231 'pm_id' => $pm_id, 265 'pm_id' => $pm_id,
232 'status' => $status, // 项目状态 266 'status' => $status, // 项目状态
  267 + 'team' => $team_ids ? json_encode($team_ids) : null,
233 ]; 268 ];
234 if (!$project) { 269 if (!$project) {
235 $project = new TicketProject(); 270 $project = new TicketProject();
@@ -93,4 +93,24 @@ class TicketProjectController extends BaseController @@ -93,4 +93,24 @@ class TicketProjectController extends BaseController
93 { 93 {
94 // 94 //
95 } 95 }
  96 +
  97 + /**
  98 + * 获取项目团队信息
  99 + *
  100 + * @param string $id 项目UUID
  101 + * @return mixed 返回项目团队信息或错误响应
  102 + */
  103 + public function team($id)
  104 + {
  105 + // 根据UUID查找项目
  106 + $project = TicketProject::where('uuid', $id)->first();
  107 +
  108 + // 如果项目不存在,返回错误响应
  109 + if (!$project) $this->response('Project not found', Code::USER_MODEL_NOTFOUND_ERROE);
  110 +
  111 + // 返回项目团队信息
  112 + // 修改: 使用 getTeam() 方法而不是 getTeam 属性
  113 + return $this->response('Project team', Code::SUCCESS, $project->getTeam());
  114 + }
  115 +
96 } 116 }
@@ -93,4 +93,11 @@ class TicketProject extends Base @@ -93,4 +93,11 @@ class TicketProject extends Base
93 $message_push->save(); 93 $message_push->save();
94 } 94 }
95 } 95 }
  96 +
  97 + public function getTeam()
  98 + {
  99 + return ManageHr::whereIn('manage_id', json_decode($this->team, true))
  100 + ->where('manage_id', '>', 0)
  101 + ->select(['manage_id', 'name', 'nickname', 'mobile'])->get()->toArray();
  102 + }
96 } 103 }
@@ -258,6 +258,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -258,6 +258,7 @@ Route::middleware(['aloginauth'])->group(function () {
258 Route::get('/pushNotify/{id}', [Aside\WorkOrder\AsideTicketController::class, 'pushNotify'])->name('admin.tickets.pushNotify')->summary('A端工单推送企微群'); 258 Route::get('/pushNotify/{id}', [Aside\WorkOrder\AsideTicketController::class, 'pushNotify'])->name('admin.tickets.pushNotify')->summary('A端工单推送企微群');
259 Route::get('/projects/{search}', [Aside\WorkOrder\AsideTicketController::class, 'getProjects'])->name('admin.tickets.projects')->summary('A端V5V6项目列表'); 259 Route::get('/projects/{search}', [Aside\WorkOrder\AsideTicketController::class, 'getProjects'])->name('admin.tickets.projects')->summary('A端V5V6项目列表');
260 Route::patch('/projects/{id}', [Aside\WorkOrder\TicketProjectController::class, 'update'])->name('admin.tickets.projects.update')->summary('A端修改工单项目'); 260 Route::patch('/projects/{id}', [Aside\WorkOrder\TicketProjectController::class, 'update'])->name('admin.tickets.projects.update')->summary('A端修改工单项目');
  261 + Route::get('/projects_team/{id}', [Aside\WorkOrder\TicketProjectController::class, 'team'])->name('admin.tickets.projects_team')->summary('A端工单项目团队');
261 Route::get('/v56_projects/list', [Aside\WorkOrder\AsideTicketController::class, 'projectList'])->name('admin.tickets.projectList')->summary('A端V5V6项目列表') 262 Route::get('/v56_projects/list', [Aside\WorkOrder\AsideTicketController::class, 'projectList'])->name('admin.tickets.projectList')->summary('A端V5V6项目列表')
262 ->description("project_cate[项目分类1]: 1 V5, 2 V6, 3 超迹, 4 域途"); 263 ->description("project_cate[项目分类1]: 1 V5, 2 V6, 3 超迹, 4 域途");
263 Route::post('/log/{id}', [Aside\WorkOrder\AsideTicketLogController::class, 'update'])->name('admin.tickets.log.update')->summary('A端工单操作日志更新,完成工单'); 264 Route::post('/log/{id}', [Aside\WorkOrder\AsideTicketLogController::class, 'update'])->name('admin.tickets.log.update')->summary('A端工单操作日志更新,完成工单');