Authored by 郭成尧

领券单张图的数据

... ... @@ -30,15 +30,22 @@ class CouponFloorProcess
$build = array();
foreach ($data as $k => &$v) {
$fun = '';
if (empty($v) || !is_array($v) || !array_key_exists('template_name', $v)) {
if (array_key_exists('templateName', $v)) {
$fun = $v['templateName'];
} else {
continue;
}
}
if ($fun !== 'single_image') {
$fun = $v['template_name'];
}
if (empty($v['data']) || !is_callable("self::$fun")) {
continue;
}
// tar note 处理楼层标题
if ($fun === 'getCoupon' && $data[$k - 1]['template_name'] === 'text') {
if ($fun === 'getCoupon' && array_key_exists('template_name', $data[$k - 1]) && $data[$k - 1]['template_name'] === 'text') {
$v['data']['floorTitle'] = $data[$k - 1]['data'];
}
$build = self::$fun($v['data']);
... ... @@ -63,8 +70,10 @@ class CouponFloorProcess
return array();
}
foreach ($data['list'] as &$item) {
$imageSrc = Images::getImageUrl($item['src'], 0, 0);
$item['src'] = $imageSrc;
$item['img'] = Images::getImageUrl($item['src'], 0, 0);
if (!is_string($item['url'])) {
$item['url'] = '';
}
}
$data['isCarouselBanner'] = true;
return $data;
... ... @@ -132,14 +141,15 @@ class CouponFloorProcess
/**
*
* 单张图片的处理方法,不用
* 单张图片的处理方法
*
* @param $data
* @return mixed
*/
private static function single_image($data)
{
$data['isSingleImage'] = true;
return $data;
$data[0]['src'] = Images::getImageUrl($data[0]['src'], 0, 0);
$data[0]['isSingleImage'] = true;
return $data[0];
}
}
\ No newline at end of file
... ...
{{>layout/header}}
{{# content}}
{{#if isCarouselBanner}}
{{>home/baner_top}}
{{#if isCarouselBanner}}
<div class="banner-top">
<div class="banner-swiper swiper-container">
<ul class="swiper-wrapper">
{{#each list}}
{{#if @first}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{img}}">
</a>
</li>
{{^}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" src="{{img}}">
</a>
<div class="swiper-lazy-preloader"></div>
</li>
{{/if}}
{{#if isCoupon}}
<div class="coupon-floor">
{{/each}}
</ul>
</div>
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
</div>
{{/if}}
{{#if isCoupon}}
<div class="coupon-floor">
{{#if showFloorTitle}}
<div class="floor-title">
{{floorTitle}}
... ... @@ -31,8 +56,8 @@
</a>
{{/if}}
</div>
</div>
{{/if}}
</div>
{{/if}}
{{/ content}}
<div class="floor-mask"></div>
<div class="floor-message">
... ...
... ... @@ -31,10 +31,6 @@ class CouponController extends AbstractAction
if (isset($resource['code']) && $resource['code'] == 200) {
$result = CouponFloorProcess::getContent($resource['data']);
}
// header("Content-type:text/html;charset=utf-8");
// echo '<pre>';
// print_r($result);
// echo '</pre>';exit;
$this->_view->display('index', array(
'content' => $result,
'floorPage' => true
... ...