FloorProcess.php 5.31 KB
<?php

namespace Plugin;

/**
 * 楼层数据处理类
 */
class FloorProcess
{

    /**
     * 焦点图数据处理方法
     * @param  array $data 焦点图数据
     * @return array       处理之后的焦点图数据
     */
    public static function focus($data)
    {
        $result = array();

        foreach ($data as &$one) {
          $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
          unset($one['src']);
        }
        $result['list'] = $data;

        return $result;
    }

    /**
     * 图标列表数据处理方法
     * @param  array $data 图标列表数据
     * @return array       处理之后的图标列表数据
     */
    public static function app_icon_list($data)
    {
        $result = array();

        foreach ($data as &$one) {
          $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
          unset($one['src']);
        }
        $result['list'] = $data;

        return $result;
    }

    /**
     * 单图片数据处理方法
     * @param  array $data 单图片数据
     * @return array       处理之后的单图片数据
     */
    public static function single_image($data)
    {
        $result = array();

        foreach ($data as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
        }
        $result['list'] = $data;

        return $result;
    }

    /**
     * 带标题的12个小图推荐数据处理方法
     * @param  array $data 带标题的12个小图推荐数据
     * @return array       处理之后的带标题的12个小图推荐数据
     */
    public static function recommend_content_five($data)
    {
        $result = array();

        foreach ($data['list'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }

    /**
     * 推荐品牌数据处理方法
     * @param  array $data 推荐品牌数据
     * @return array       处理之后的推荐品牌数据
     */
    public static function app_hot_brands($data)
    {
        $result = array();

        $data['name'] = $data['title']['title'];
        unset($data['title']);
        foreach ($data['list'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }

    /**
     * 潮人·搭配数据处理方法
     * @param  array $data 潮人·搭配数据
     * @return array       处理之后的潮人·搭配数据
     */
    public static function trendsetter_collocation($data)
    {
        $result = array();

        foreach ($data['article'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        foreach ($data['recommend_collocation'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }

    /**
     * 潮品·话题数据处理方法
     * @param  array $data 潮品·话题数据
     * @return array       处理之后的潮品·话题数据
     */
    public static function trendgoods_topic($data)
    {
        $result = array();

        foreach ($data['list'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }

    /**
     * 一张大图一个大的推荐和4个小图推荐数据处理方法
     * @param  array $data 一张大图一个大的推荐和4个小图推荐数据
     * @return array       处理之后的一张大图一个大的推荐和4个小图推荐数据
     */
    public static function recommend_content_one($data)
    {
        $result = array();

        foreach ($data['big_image'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        foreach ($data['list'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }

    /**
     * 一张大图和6个小图推荐数据处理方法
     * @param  array $data 一张大图和6个小图推荐数据
     * @return array       处理之后的一张大图和6个小图推荐数据
     */
    public static function recommend_content_two($data)
    {
        $result = array();

        foreach ($data['big_image'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        foreach ($data['list'] as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }

    /**
     * 小图片数据处理方法
     * @param  array $data 小图片数据
     * @return array       处理之后的小图片数据
     */
    public static function small_pic($data)
    {
        $result = array();

        foreach ($data as &$one) {
            $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
            unset($one['src']);
        }
        $result = $data;

        return $result;
    }
}