正在显示
1 个修改的文件
包含
24 行增加
和
6 行删除
| @@ -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 | - $channel = Channel::where('source_id', $source_id)->first(); | ||
| 579 | - if(!$channel){ | ||
| 580 | - $this->response('渠道不存在',Code::SYSTEM_ERROR); | 578 | + |
| 579 | + if(!$source_id && !$id){ | ||
| 580 | + $this->response('参数异常',Code::SYSTEM_ERROR); | ||
| 581 | + } | ||
| 582 | + | ||
| 583 | + $channel_id = 0; | ||
| 584 | + if($source_id){ | ||
| 585 | + $channel = Channel::where('source_id', $source_id)->first(); | ||
| 586 | + if(!$channel){ | ||
| 587 | + $this->response('渠道不存在',Code::SYSTEM_ERROR); | ||
| 588 | + } | ||
| 589 | + $channel_id = $channel->id; | ||
| 581 | } | 590 | } |
| 582 | - if ($id && FALSE == is_array($id)) | ||
| 583 | - $id = explode(',', $id); | ||
| 584 | 591 | ||
| 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){ | 592 | + if ($id){ |
| 593 | + if(!is_array($id)){ | ||
| 594 | + $id = explode(',', $id); | ||
| 595 | + } | ||
| 596 | + } | ||
| 597 | + | ||
| 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 | } |
-
请 注册 或 登录 后发表评论