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)) {
continue;
if (array_key_exists('templateName', $v)) {
$fun = $v['templateName'];
} else {
continue;
}
}
if ($fun !== 'single_image') {
$fun = $v['template_name'];
}
$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}}
{{/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}}
</div>
{{/if}}
{{#if isCoupon}}
<div class="coupon-floor">
{{#if showFloorTitle}}
<div class="floor-title">
{{floorTitle}}
</div>
{{/if}}
<div class="floor-main" style="background-image: url({{image.src}});">
<a href="{{image.url}}" class="main-left"></a>
{{#if isGet}}
<div class="main-right-receive">
<span class="on-receive"></span>
</div>
<a href="{{image.url}}" class="main-right-use" style="display: none">
<span class="received"></span>
</a>
{{/if}}
{{#if isGeted}}
<a href="{{image.url}}" class="main-right-use">
<span class="received"></span>
</a>
{{/if}}
{{#if isZero}}
<a href="{{image.url}}" class="main-right-go">
<span class="zero"></span>
</a>
{{/if}}
</div>
</div>
<div class="floor-main" style="background-image: url({{image.src}});">
<a href="{{image.url}}" class="main-left"></a>
{{#if isGet}}
<div class="main-right-receive">
<span class="on-receive"></span>
</div>
<a href="{{image.url}}" class="main-right-use" style="display: none">
<span class="received"></span>
</a>
{{/if}}
{{#if isGeted}}
<a href="{{image.url}}" class="main-right-use">
<span class="received"></span>
</a>
{{/if}}
{{#if isZero}}
<a href="{{image.url}}" class="main-right-go">
<span class="zero"></span>
</a>
{{/if}}
</div>
</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
... ...