Authored by 郭成尧

图片链接处理

... ... @@ -25,9 +25,10 @@ class CouponFloorProcess
* 获取楼层数据
*
* @param $data
* @param $isApp
* @return array
*/
public static function getContent($data)
public static function getContent($data, $isApp = false)
{
$result = array();
... ... @@ -55,7 +56,7 @@ class CouponFloorProcess
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']);
$build = self::$fun($v['data'], $isApp);
if (empty($build)) {
continue;
}
... ... @@ -69,9 +70,10 @@ class CouponFloorProcess
* 焦点图处理
*
* @param $data
* @param $isApp
* @return mixed
*/
private static function carousel_banner($data)
private static function carousel_banner($data, $isApp = false)
{
if (empty($data['list'])) {
return array();
... ... @@ -91,10 +93,11 @@ class CouponFloorProcess
* 领券楼层数据处理
*
* @param $data
* @param bool $isApp
* @return array
* @internal param $type
*/
private static function getCoupon($data)
private static function getCoupon($data, $isApp = false)
{
$result = array();
if (empty($data)) {
... ... @@ -108,6 +111,7 @@ class CouponFloorProcess
}
$imageSrc = Images::getImageUrl($item['image']['src'], 0, 0);
$item['image']['src'] = $imageSrc;
$item['image']['url'] = $isApp ? $item['image']['src'] : Helpers::getFilterUrl($item['image']['src']);
switch ($item['status']) {
case 1:
$item['isGet'] = true;
... ... @@ -137,7 +141,7 @@ class CouponFloorProcess
* @param $data
* @return bool
*/
private static function text($data)
private static function text($data, $isApp = false)
{
$data['isTitle'] = true;
if ($data['text']) {
... ... @@ -151,11 +155,13 @@ class CouponFloorProcess
* 单张图片的处理方法
*
* @param $data
* @param bool $isApp
* @return mixed
*/
private static function single_image($data)
private static function single_image($data, $isApp = false)
{
$data[0]['src'] = Images::getImageUrl($data[0]['src'], 0, 0);
$data[0]['url'] = $isApp ? $data[0]['url'] : Helpers::getFilterUrl($data[0]['url']);
$data[0]['isSingleImage'] = true;
return $data[0];
}
... ... @@ -164,14 +170,16 @@ class CouponFloorProcess
* 焦点图
*
* @param $data
* @param bool $isApp
* @return mixed
*/
public static function focus($data)
public static function focus($data, $isApp = false)
{
$result = array();
$result['isFocus'] = true;
foreach ($data as &$item) {
$item['img'] = Images::getImageUrl($item['src'], 0, 0);
$item['url'] = $isApp ? $item['url'] : Helpers::getFilterUrl($item['url']);
}
$result['list'] = $data;
return $result;
... ... @@ -182,9 +190,10 @@ class CouponFloorProcess
* 重构
*
* @param $data
* @param bool $isApp
* @return mixed
*/
public static function image_list($data)
public static function image_list($data, $isApp = false)
{
$result = array();
foreach ($data['list'] as &$image) {
... ... @@ -217,9 +226,10 @@ class CouponFloorProcess
* 重构
*
* @param $data
* @param bool $isApp
* @return mixed
*/
public static function promotion($data)
public static function promotion($data, $isApp = false)
{
$result = array();
$result['newArrival'] = array(
... ... @@ -308,7 +318,7 @@ class CouponFloorProcess
),
);
}
/**
*
* 辅助方法 Debug 数据输出
... ...
... ... @@ -35,7 +35,7 @@ class CouponController extends AbstractAction
}
$resource = CouponData::getCouponRousource($receiveData['code'], $uid);
if (isset($resource['code']) && $resource['code'] === 200) {
$result = CouponFloorProcess::getContent($resource['data']);
$result = CouponFloorProcess::getContent($resource['data'],$this->isApp());
} else {
$result['noData'] = true;
}
... ...