-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinterface.php
More file actions
49 lines (47 loc) · 1.13 KB
/
interface.php
File metadata and controls
49 lines (47 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
// 接口定义
namespace XXXcrawler;
// 任务
interface iTask {
/**
* 获取任务列表
* @return Array(task) , task= [id=> ,name=>, intval => ,state => , last_time => , data => ]
*/
public function getAll();
/**
* 获取任务状态
* @param Int $taskId 任务id
* @return Int ()
*/
public function getState($taskId);
/**
* 获取任务最后执行时间
* @param Int $taskId 任务id
* @return Int unixtime
*/
public function getLastTime($taskId);
/**
* 设置任务状态
* @param int $taskId 任务id
* @param Int $state 状态
*/
public function setState($taskId, Int $state);
}
// 下载器
interface iDownloader {
/**
* 下载页面内容
* @param $urls = ['key' => 'url']
* @param Array ['key' => 'pageData']
*/
public function fetch(Array $urls);
}
// 页面内容提取
interface iParser {
/**
* 提取指定内容
* @param Array $fields = ['fname' => 'path',...] 提取的字段及路径/模式
* @param string $html 页面内容
*/
public function find($fields, $html);
}