|
@@ -213,33 +213,37 @@ class CollectorService implements CollectorServiceInterface
|
|
}
|
|
}
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
}
|
|
}
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 获取并搜索规则任务
|
|
* 获取并搜索规则任务
|
|
* @param array $data
|
|
* @param array $data
|
|
* @return array|mixed
|
|
* @return array|mixed
|
|
*/
|
|
*/
|
|
|
|
+
|
|
public function getRule(array $data): array
|
|
public function getRule(array $data): array
|
|
{
|
|
{
|
|
|
|
+
|
|
$where = [];
|
|
$where = [];
|
|
|
|
+
|
|
if(isset($data['web_id'])){
|
|
if(isset($data['web_id'])){
|
|
$web = Web::where('id',$data['web_id'])->get();
|
|
$web = Web::where('id',$data['web_id'])->get();
|
|
if(empty($web->toArray())){
|
|
if(empty($web->toArray())){
|
|
return Result::error('请输入正确的网站id!');
|
|
return Result::error('请输入正确的网站id!');
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
|
+ //若是根据网站跳转到的规则任务则存到$where数组中
|
|
$where = [
|
|
$where = [
|
|
['web_id','=', $data['web_id']]
|
|
['web_id','=', $data['web_id']]
|
|
];
|
|
];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
if(isset($data['keyWord'])){
|
|
if(isset($data['keyWord'])){
|
|
//若存在搜索词,则存到条件数组$where中
|
|
//若存在搜索词,则存到条件数组$where中
|
|
$where = [
|
|
$where = [
|
|
['name','like','%'.$data['keyWord'].'%']
|
|
['name','like','%'.$data['keyWord'].'%']
|
|
];
|
|
];
|
|
}
|
|
}
|
|
- // var_dump("===============",$where);
|
|
|
|
|
|
+
|
|
if(empty($where)){
|
|
if(empty($where)){
|
|
$rep = Rule::withCount(relations:'arts')->limit($data['pageSize'])->orderBy("created_at","desc")->offset(($data['page']-1)*$data['pageSize'])->get();
|
|
$rep = Rule::withCount(relations:'arts')->limit($data['pageSize'])->orderBy("created_at","desc")->offset(($data['page']-1)*$data['pageSize'])->get();
|
|
}else{
|
|
}else{
|
|
@@ -255,8 +259,12 @@ class CollectorService implements CollectorServiceInterface
|
|
'rep' => $rep->toArray(),
|
|
'rep' => $rep->toArray(),
|
|
'count' => $count
|
|
'count' => $count
|
|
];
|
|
];
|
|
- return Result::success($data)
|
|
|
|
|
|
+
|
|
|
|
+ return Result::success($data);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取某个任务规则
|
|
* 获取某个任务规则
|
|
* @param array $data
|
|
* @param array $data
|