Girls.php 5.75 KB
<?php

use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use Plugin\Helpers;
/**
 * 女生首页
 */
class GirlsController extends AbstractAction
{

    public function indexAction()
    {
      $data = array(
        'headerDownload' => $this->getHeaderDownload(),
        'homeHeader' => array(
            'bgColor' => '#FF88AE',
            'searchUrl' =>  ''
        ),
        'searchUrl' => '',
        'sideNav' => array(),
        'content' => array()
      );

      $sideDatas = IndexData::getHomeChannels();
      if($sideDatas['code'] == 200)
      {
        $data['sideNav'] = $sideDatas['data'];
      }

      // 频道数据
      $channelData = IndexData::getUserChannelData(0, '2,3', '201504091403002');
      $channels = array();
      if($channelData['code'] == 200)
      {
        $content = array();
        $bannerTop = array();
        $iconsEnter = array();
        $singleImage = array();
        $hotCategory = array();
        $hotBrandsScroll = array();
        $trendColloaction = array();
        $trendTopics = array();
        $goodsCategory = array();
        $recommend_content_two = array();
        $small_pic = array();

        foreach ($channelData['data']['list'] as $key => $val) {
          switch ($val['template_name']) {
            case 'focus': // 焦点图
              $oneFocus = array();
              foreach ($val['data'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
              }
              $oneFocus['list'] = $val['data'];
              $bannerTop[] = $oneFocus;
              break;
            case 'app_icon_list': // 图标列表
              $oneIcon = array();
              foreach ($val['data'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneIcon['list'] = $val['data'];
              $iconsEnter[] = $oneIcon;
              break;
            case 'single_image': // 单图片
              $oneImage = array();
              foreach ($val['data'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
              }
              $oneImage['list'] = $val['data'];
              $singleImage[] = $oneImage;
              break;
            case 'recommend_content_five': // 带标题的12个小图推荐
              $oneHot = array();
              foreach ($val['data']['list'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneHot = $val['data'];
              $hotCategory[] = $oneHot;
              break;
            case 'app_hot_brands': // 推荐品牌
              $oneHotBrand = array();
              foreach ($val['data']['list'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneHotBrand = $val['data'];
              $hotBrandsScroll[] = $oneHotBrand;
              break;
            case 'trendsetter_collocation': // 潮人·搭配
              $oneTrendSetter = array();
              foreach ($val['data']['article'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              foreach ($val['data']['recommend_collocation'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneTrendSetter = $val['data'];
              $trendColloaction[] = $oneTrendSetter;
              break;
            case 'trendgoods_topic': // 潮品·话题
              $oneTopic = array();
              foreach ($val['data']['list'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneTopic = $val['data'];
              $trendTopics[] = $oneTopic;
              break;
            case 'recommend_content_one': // 一张大图一个大的推荐和4个小图推荐
              $oneGoodCategory = array();
              foreach ($val['data']['big_image'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              foreach ($val['data']['list'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneGoodCategory = $val['data'];
              $goodsCategory[] = $oneGoodCategory;
              break;
            case 'recommend_content_two': // 一张大图和6个小图推荐
              $oneRecoContTwo = array();
              foreach ($val['data']['big_image'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              foreach ($val['data']['list'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneRecoContTwo = $val['data'];
              $recommend_content_two[] = $oneRecoContTwo;
              break;
            case 'small_pic': // 小图片
              $oneSmallPic = array();
              foreach ($val['data'] as &$one) {
                $one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
              }
              $oneSmallPic = $val['data'];
              $small_pic[] = $oneSmallPic;
              break;
            default:
              break;
          }

          $content[$key] = array(
            'bannerTop' => $bannerTop,
            'iconsEnter' => $iconsEnter,
            'hotCategory' => $hotCategory,
            'hotBrandsScroll' => $hotBrandsScroll,
            'trendColloaction' => $trendColloaction,
            'trendTopics' => $trendTopics,
            'goodsCategory' => $goodsCategory
          );
        }

        $data['content'] = $content;
      }

      $this->_view->assign('title', 'YOHO!有货');
      $this->_view->display('index', $data);
    }
}