|
...
|
...
|
@@ -571,18 +571,36 @@ class ProjectController extends BaseController |
|
|
|
*/
|
|
|
|
public function getProjectByChannel(){
|
|
|
|
$id = $this->param['id'] ?? [];
|
|
|
|
$source_id = $this->param['channel_id']; //原系统渠道id
|
|
|
|
$source_id = $this->param['channel_id'] ?? 0; //原系统渠道id
|
|
|
|
$size = $this->param['page_size'] ?? 20;
|
|
|
|
$type = $this->param['type'] ?? '';
|
|
|
|
$company = $this->param['company'] ?? '';
|
|
|
|
$channel = Channel::where('source_id', $source_id)->first();
|
|
|
|
if(!$channel){
|
|
|
|
$this->response('渠道不存在',Code::SYSTEM_ERROR);
|
|
|
|
|
|
|
|
if(!$source_id && !$id){
|
|
|
|
$this->response('参数异常',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
$channel_id = 0;
|
|
|
|
if($source_id){
|
|
|
|
$channel = Channel::where('source_id', $source_id)->first();
|
|
|
|
if(!$channel){
|
|
|
|
$this->response('渠道不存在',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$channel_id = $channel->id;
|
|
|
|
}
|
|
|
|
if ($id && FALSE == is_array($id))
|
|
|
|
$id = explode(',', $id);
|
|
|
|
|
|
|
|
$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){
|
|
|
|
if ($id){
|
|
|
|
if(!is_array($id)){
|
|
|
|
$id = explode(',', $id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])
|
|
|
|
->where('delete_status', 0)
|
|
|
|
->where(function ($query) use ($channel_id, $type, $company, $id){
|
|
|
|
if ($channel_id) {
|
|
|
|
$query->where('channel->channel_id', $channel_id);
|
|
|
|
}
|
|
|
|
if ($type) {
|
|
|
|
$query->where('type', $type);
|
|
|
|
}
|
...
|
...
|
|