Channel.php
1.15 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
<?php
namespace WebPlugin\DataProcess;
use WebPlugin\Helpers;
class Channel
{
public static $formatChannel = array(
'boys' => '\WebPlugin\DataProcess\Channel\Boys',
'girls' => '\WebPlugin\DataProcess\Channel\Girls',
'kids' => '\WebPlugin\DataProcess\Channel\Kids',
'lifestyle' => '\WebPlugin\DataProcess\Channel\Lifestyle',
'plusstarIndex' => '\WebPlugin\DataProcess\Channel\PlusstarIndex'
);
/**
* 获取格式数据
*
* @param string $channel
* @param array $data
*/
public static function getFormat($channel, array $data)
{
if (empty($data)) {
return array();
}
// 通用处理器
$result = Process::getContent($data, Helpers::getChannelNameByCookie());
$channelResult = array();
if (isset(self::$formatChannel[$channel])) {
$class = self::$formatChannel[$channel];
$channelResult = $class::format($data);
}
// 组合数据
$result = $result + $channelResult;
ksort($result);
return array_values($result);
}
}