...
|
...
|
@@ -11,27 +11,42 @@ class FloorProcess |
|
|
{
|
|
|
|
|
|
/**
|
|
|
* 频道参数
|
|
|
*
|
|
|
* @var array
|
|
|
*/
|
|
|
private static $channel = array(
|
|
|
'1' => '1,3',
|
|
|
'2' => '2,3'
|
|
|
);
|
|
|
|
|
|
/**
|
|
|
* 处理首页内容
|
|
|
* @param $data
|
|
|
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
|
|
|
*/
|
|
|
public static function getContent($data, $type = 1)
|
|
|
{
|
|
|
if (empty($data['list'])) {
|
|
|
return array();
|
|
|
}
|
|
|
|
|
|
$result = array();
|
|
|
if (!empty($data['list'])) {
|
|
|
$build = array();
|
|
|
foreach ($data['list'] as $v) {
|
|
|
$fun = $v['template_name'];
|
|
|
if (!is_callable("self::$fun")) {
|
|
|
continue;
|
|
|
}
|
|
|
$build = self::$fun($v['data'], $type);
|
|
|
if (empty($build)) {
|
|
|
continue;
|
|
|
}
|
|
|
$result[] = $build;
|
|
|
|
|
|
$build = array();
|
|
|
foreach ($data['list'] as $v) {
|
|
|
$fun = $v['template_name'];
|
|
|
if (empty($v['data']) || !is_callable("self::$fun")) {
|
|
|
continue;
|
|
|
}
|
|
|
$build = self::$fun($v['data'], $type);
|
|
|
if (empty($build)) {
|
|
|
continue;
|
|
|
}
|
|
|
$result[] = $build;
|
|
|
}
|
|
|
$build = array();
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -46,16 +61,35 @@ class FloorProcess |
|
|
$result = array();
|
|
|
|
|
|
foreach ($data as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 640, 310);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result['bannerTop']['list'] = $data;
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 图标
|
|
|
*/
|
|
|
private static function floor($data)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
foreach ($data as &$one) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 98, 98);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result['list'] = $data;
|
|
|
$result['iconsEnter']['list'] = $data;
|
|
|
|
|
|
return array('bannerTop' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 图标列表数据处理方法
|
|
|
*
|
|
|
* @param array $data 图标列表数据
|
|
|
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
|
|
|
* @return array 处理之后的图标列表数据
|
...
|
...
|
@@ -65,36 +99,66 @@ class FloorProcess |
|
|
$result = array();
|
|
|
|
|
|
foreach ($data as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 98, 98);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result['list'] = $data;
|
|
|
$result['iconsEnter']['list'] = $data;
|
|
|
|
|
|
return array('iconsEnter' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 单图片数据处理方法
|
|
|
* 单广告图片数据处理方法
|
|
|
*
|
|
|
* @param array $data 单图片数据
|
|
|
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
|
|
|
* @return array 处理之后的单图片数据
|
|
|
*/
|
|
|
private static function single_image($data, $type)
|
|
|
{
|
|
|
if (empty($data)) {
|
|
|
return array();
|
|
|
}
|
|
|
|
|
|
$result = array();
|
|
|
|
|
|
foreach ($data as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 640, 200);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result['banner'] = $data;
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 女生品类
|
|
|
*/
|
|
|
private static function recommend_content_three($data, $type)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
$build = array();
|
|
|
if (!empty($data['big_image'][0])) {
|
|
|
$build['img'] = Helpers::getImageUrl($data['big_image'][0]['src'], 640, 198);
|
|
|
$build['url'] = Helpers::getFilterUrl($data['big_image'][0]['url']);
|
|
|
$result['hotCategory']['banner'] = $build;
|
|
|
}
|
|
|
|
|
|
$build = array();
|
|
|
foreach ($data['list'] as $one) {
|
|
|
$build['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
$build['img'] = Helpers::getImageUrl($one['src'], 140, 140);
|
|
|
$build['textCn'] = $one['title'];
|
|
|
$result['hotCategory']['list'][] = $build;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return array('banner' => $data);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 带标题的12个小图推荐数据处理方法
|
|
|
*
|
|
|
* @param array $data 带标题的12个小图推荐数据
|
|
|
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
|
|
|
* @return array 处理之后的带标题的12个小图推荐数据
|
...
|
...
|
@@ -104,15 +168,20 @@ class FloorProcess |
|
|
$result = array();
|
|
|
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 140, 140);
|
|
|
$one['textCn'] = $one['title'];
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$data['is_show_name'] = $data['title']['is_show'];
|
|
|
$data['name'] = $data['title']['title'];
|
|
|
unset($data['title']);
|
|
|
$result = $data;
|
|
|
|
|
|
return array('hotCategory' => $result);
|
|
|
$result['hotCategory'] = $data;
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -125,16 +194,20 @@ class FloorProcess |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
$data['is_show_name'] = (isset($data['is_show_name']) && $data['is_show_name'] == 'Y') ? 1 : 0;
|
|
|
$data['is_show_name'] = (isset($data['is_show_name']) && $data['is_show_name'] === 'Y') ? 1 : 0;
|
|
|
$data['name'] = $data['title']['title'];
|
|
|
unset($data['title']);
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 158, 174);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result = $data;
|
|
|
$data['more'] = '/category/brand/index?channel=' . $type;
|
|
|
$result['hotBrands'] = $data;
|
|
|
|
|
|
return array('hotBrands' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -148,16 +221,22 @@ class FloorProcess |
|
|
$result = array();
|
|
|
|
|
|
foreach ($data['article'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 400, 400);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
foreach ($data['recommend_collocation'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 140, 140);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result = $data;
|
|
|
$result['trendColloaction'] = $data;
|
|
|
|
|
|
return array('trendColloaction' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -171,12 +250,15 @@ class FloorProcess |
|
|
$result = array();
|
|
|
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 580, 360);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result = $data;
|
|
|
$result['trendTopics'] = $data;
|
|
|
|
|
|
return array('trendTopics' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -190,19 +272,33 @@ class FloorProcess |
|
|
$result = array();
|
|
|
|
|
|
foreach ($data['big_image'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 640, 403);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$data['banner']['list'] = $data['big_image'];
|
|
|
unset($data['big_image']);
|
|
|
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
foreach ($data['list'] as $kk => &$one) {
|
|
|
if ($kk == 0) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 253, 383);
|
|
|
} else {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 191, 191);
|
|
|
}
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['textCn'] = $one['title'];
|
|
|
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result = $data;
|
|
|
|
|
|
return array('goodsCategory' => $result);
|
|
|
unset($data['big_image']);
|
|
|
|
|
|
$result['goodsCategory'] = $data;
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -217,19 +313,25 @@ class FloorProcess |
|
|
|
|
|
$data['banner'] = array();
|
|
|
foreach ($data['big_image'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 640, 400);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$data['banner'] = $data['big_image'];
|
|
|
unset($data['big_image']);
|
|
|
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 212, 192);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result = $data;
|
|
|
$result['creativeLife'] = $data;
|
|
|
|
|
|
return array('creativeLife' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -240,15 +342,21 @@ class FloorProcess |
|
|
*/
|
|
|
private static function small_pic($data, $type)
|
|
|
{
|
|
|
// 按照以前业务操作,不显示
|
|
|
return array();
|
|
|
|
|
|
$result = array();
|
|
|
|
|
|
foreach ($data as &$one) {
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 98, 98);
|
|
|
unset($one['src']);
|
|
|
}
|
|
|
$result = $data;
|
|
|
$result['small_pic'] = $data;
|
|
|
|
|
|
return array('small_pic' => $result);
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -264,9 +372,47 @@ class FloorProcess |
|
|
}
|
|
|
|
|
|
$data['name'] = $data['title'];
|
|
|
$data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2);
|
|
|
$data['img'] = Helpers::getImageUrl($data['src'], 640, 198);
|
|
|
if (isset($data['url'])) {
|
|
|
$data['url'] = Helpers::getFilterUrl($data['url']);
|
|
|
}
|
|
|
|
|
|
return array('plusStar' => $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 自定义品牌
|
|
|
*
|
|
|
* @param unknown $data
|
|
|
* @param mixed $type
|
|
|
* @return multitype:
|
|
|
*/
|
|
|
private static function custom_brands($data, $type)
|
|
|
{
|
|
|
// URL附加参数
|
|
|
$param = '';
|
|
|
if (isset(self::$channel[$type])) {
|
|
|
$param = '/?gender=' . self::$channel[$type];
|
|
|
}
|
|
|
|
|
|
$result = array();
|
|
|
$result['hotBrandsScroll']['name'] = $data['title']['title'];
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] = Helpers::getFilterUrl($one['url']);
|
|
|
}
|
|
|
$one['img'] = Helpers::getImageUrl($one['src'], 140, 140);
|
|
|
$one['textCn'] = $one['name'];
|
|
|
if (isset($one['url'])) {
|
|
|
$one['url'] .= $param;
|
|
|
}
|
|
|
}
|
|
|
if (!empty($data['is_show_name']) && $data['is_show_name'] == 'Y') {
|
|
|
$result['hotBrandsScroll']['is_show_name'] = true;
|
|
|
}
|
|
|
$result['hotBrandsScroll']['list'] = $data['list'];
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|