作者 赵彬吉

update

@@ -575,14 +575,32 @@ class ProjectController extends BaseController @@ -575,14 +575,32 @@ class ProjectController extends BaseController
575 $size = $this->param['page_size'] ?? 20; 575 $size = $this->param['page_size'] ?? 20;
576 $type = $this->param['type'] ?? ''; 576 $type = $this->param['type'] ?? '';
577 $company = $this->param['company'] ?? ''; 577 $company = $this->param['company'] ?? '';
  578 +
  579 + if(!$source_id && !$id){
  580 + $this->response('参数异常',Code::SYSTEM_ERROR);
  581 + }
  582 +
  583 + $channel_id = 0;
  584 + if($source_id){
578 $channel = Channel::where('source_id', $source_id)->first(); 585 $channel = Channel::where('source_id', $source_id)->first();
579 if(!$channel){ 586 if(!$channel){
580 $this->response('渠道不存在',Code::SYSTEM_ERROR); 587 $this->response('渠道不存在',Code::SYSTEM_ERROR);
581 } 588 }
582 - if ($id && FALSE == is_array($id)) 589 + $channel_id = $channel->id;
  590 + }
  591 +
  592 + if ($id){
  593 + if(!is_array($id)){
583 $id = explode(',', $id); 594 $id = explode(',', $id);
  595 + }
  596 + }
584 597
585 - $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])->where(['channel->channel_id' => $channel->id, 'delete_status' => 0])->where(function ($query) use ($type, $company, $id){ 598 + $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])
  599 + ->where('delete_status', 0)
  600 + ->where(function ($query) use ($channel_id, $type, $company, $id){
  601 + if ($channel_id) {
  602 + $query->where('channel->channel_id', $channel_id);
  603 + }
586 if ($type) { 604 if ($type) {
587 $query->where('type', $type); 605 $query->where('type', $type);
588 } 606 }