Plusstar.php
1.61 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
50
<?php
namespace Guang;
use LibModels\Web\Guang\PlusstarData;
use WebPlugin\Images;
use WebPlugin\Cache;
use Configs\WebCacheConfig;
class PlusstarModel
{
/**
* 获取Plustar列表
*
* @param string $brandType
* @param string $gender
* @param int $isRecommend
* @return array
*/
public static function getPlustarList($brandType, $gender, $isRecommend = 0)
{
$key = WebCacheConfig::KEY_WEB_GUANG_PLUSSTAR_DATA.'_'.$brandType.'_'.$isRecommend;
$data = Cache::get($key);
if(empty($data)) {
$list = PlusstarData::getList($brandType, $gender, $isRecommend);;
$brandList = $brandIds = array();
if(isset($list['data']['data']['list'])) {
$brandList = current($list['data']['data']['list']);
}
if(isset($brandList['data'])) {
foreach ($brandList['data'] as $brand) {
$pos = 0;
if(isset($brand['data'][0])) {
$src = Images::getImageUrl($brand['data'][0]['src'], 320, 160, 1);
}
$brandIds[] = $brand['brand_id'];
$data[$brand['brand_id']] = array(
'brand_id' => $brand['brand_id'],
'name'=> $brand['brand_name'],
'sort_id' => $brand['sort_id'],
'src' => $src,
'desc' =>'',
'url'=> '',
);
}
}
Cache::set($key, $data, 600);
}
return $data;
}
}
?>