Authored by 郭成尧

图片链接处理

@@ -25,9 +25,10 @@ class CouponFloorProcess @@ -25,9 +25,10 @@ class CouponFloorProcess
25 * 获取楼层数据 25 * 获取楼层数据
26 * 26 *
27 * @param $data 27 * @param $data
  28 + * @param $isApp
28 * @return array 29 * @return array
29 */ 30 */
30 - public static function getContent($data) 31 + public static function getContent($data, $isApp = false)
31 { 32 {
32 $result = array(); 33 $result = array();
33 34
@@ -55,7 +56,7 @@ class CouponFloorProcess @@ -55,7 +56,7 @@ class CouponFloorProcess
55 if ($fun === 'getCoupon' && array_key_exists('template_name', $data[$k - 1]) && $data[$k - 1]['template_name'] === 'text') { 56 if ($fun === 'getCoupon' && array_key_exists('template_name', $data[$k - 1]) && $data[$k - 1]['template_name'] === 'text') {
56 $v['data']['floorTitle'] = $data[$k - 1]['data']; 57 $v['data']['floorTitle'] = $data[$k - 1]['data'];
57 } 58 }
58 - $build = self::$fun($v['data']); 59 + $build = self::$fun($v['data'], $isApp);
59 if (empty($build)) { 60 if (empty($build)) {
60 continue; 61 continue;
61 } 62 }
@@ -69,9 +70,10 @@ class CouponFloorProcess @@ -69,9 +70,10 @@ class CouponFloorProcess
69 * 焦点图处理 70 * 焦点图处理
70 * 71 *
71 * @param $data 72 * @param $data
  73 + * @param $isApp
72 * @return mixed 74 * @return mixed
73 */ 75 */
74 - private static function carousel_banner($data) 76 + private static function carousel_banner($data, $isApp = false)
75 { 77 {
76 if (empty($data['list'])) { 78 if (empty($data['list'])) {
77 return array(); 79 return array();
@@ -91,10 +93,11 @@ class CouponFloorProcess @@ -91,10 +93,11 @@ class CouponFloorProcess
91 * 领券楼层数据处理 93 * 领券楼层数据处理
92 * 94 *
93 * @param $data 95 * @param $data
  96 + * @param bool $isApp
94 * @return array 97 * @return array
95 * @internal param $type 98 * @internal param $type
96 */ 99 */
97 - private static function getCoupon($data) 100 + private static function getCoupon($data, $isApp = false)
98 { 101 {
99 $result = array(); 102 $result = array();
100 if (empty($data)) { 103 if (empty($data)) {
@@ -108,6 +111,7 @@ class CouponFloorProcess @@ -108,6 +111,7 @@ class CouponFloorProcess
108 } 111 }
109 $imageSrc = Images::getImageUrl($item['image']['src'], 0, 0); 112 $imageSrc = Images::getImageUrl($item['image']['src'], 0, 0);
110 $item['image']['src'] = $imageSrc; 113 $item['image']['src'] = $imageSrc;
  114 + $item['image']['url'] = $isApp ? $item['image']['src'] : Helpers::getFilterUrl($item['image']['src']);
111 switch ($item['status']) { 115 switch ($item['status']) {
112 case 1: 116 case 1:
113 $item['isGet'] = true; 117 $item['isGet'] = true;
@@ -137,7 +141,7 @@ class CouponFloorProcess @@ -137,7 +141,7 @@ class CouponFloorProcess
137 * @param $data 141 * @param $data
138 * @return bool 142 * @return bool
139 */ 143 */
140 - private static function text($data) 144 + private static function text($data, $isApp = false)
141 { 145 {
142 $data['isTitle'] = true; 146 $data['isTitle'] = true;
143 if ($data['text']) { 147 if ($data['text']) {
@@ -151,11 +155,13 @@ class CouponFloorProcess @@ -151,11 +155,13 @@ class CouponFloorProcess
151 * 单张图片的处理方法 155 * 单张图片的处理方法
152 * 156 *
153 * @param $data 157 * @param $data
  158 + * @param bool $isApp
154 * @return mixed 159 * @return mixed
155 */ 160 */
156 - private static function single_image($data) 161 + private static function single_image($data, $isApp = false)
157 { 162 {
158 $data[0]['src'] = Images::getImageUrl($data[0]['src'], 0, 0); 163 $data[0]['src'] = Images::getImageUrl($data[0]['src'], 0, 0);
  164 + $data[0]['url'] = $isApp ? $data[0]['url'] : Helpers::getFilterUrl($data[0]['url']);
159 $data[0]['isSingleImage'] = true; 165 $data[0]['isSingleImage'] = true;
160 return $data[0]; 166 return $data[0];
161 } 167 }
@@ -164,14 +170,16 @@ class CouponFloorProcess @@ -164,14 +170,16 @@ class CouponFloorProcess
164 * 焦点图 170 * 焦点图
165 * 171 *
166 * @param $data 172 * @param $data
  173 + * @param bool $isApp
167 * @return mixed 174 * @return mixed
168 */ 175 */
169 - public static function focus($data) 176 + public static function focus($data, $isApp = false)
170 { 177 {
171 $result = array(); 178 $result = array();
172 $result['isFocus'] = true; 179 $result['isFocus'] = true;
173 foreach ($data as &$item) { 180 foreach ($data as &$item) {
174 $item['img'] = Images::getImageUrl($item['src'], 0, 0); 181 $item['img'] = Images::getImageUrl($item['src'], 0, 0);
  182 + $item['url'] = $isApp ? $item['url'] : Helpers::getFilterUrl($item['url']);
175 } 183 }
176 $result['list'] = $data; 184 $result['list'] = $data;
177 return $result; 185 return $result;
@@ -182,9 +190,10 @@ class CouponFloorProcess @@ -182,9 +190,10 @@ class CouponFloorProcess
182 * 重构 190 * 重构
183 * 191 *
184 * @param $data 192 * @param $data
  193 + * @param bool $isApp
185 * @return mixed 194 * @return mixed
186 */ 195 */
187 - public static function image_list($data) 196 + public static function image_list($data, $isApp = false)
188 { 197 {
189 $result = array(); 198 $result = array();
190 foreach ($data['list'] as &$image) { 199 foreach ($data['list'] as &$image) {
@@ -217,9 +226,10 @@ class CouponFloorProcess @@ -217,9 +226,10 @@ class CouponFloorProcess
217 * 重构 226 * 重构
218 * 227 *
219 * @param $data 228 * @param $data
  229 + * @param bool $isApp
220 * @return mixed 230 * @return mixed
221 */ 231 */
222 - public static function promotion($data) 232 + public static function promotion($data, $isApp = false)
223 { 233 {
224 $result = array(); 234 $result = array();
225 $result['newArrival'] = array( 235 $result['newArrival'] = array(
@@ -308,7 +318,7 @@ class CouponFloorProcess @@ -308,7 +318,7 @@ class CouponFloorProcess
308 ), 318 ),
309 ); 319 );
310 } 320 }
311 - 321 +
312 /** 322 /**
313 * 323 *
314 * 辅助方法 Debug 数据输出 324 * 辅助方法 Debug 数据输出
@@ -35,7 +35,7 @@ class CouponController extends AbstractAction @@ -35,7 +35,7 @@ class CouponController extends AbstractAction
35 } 35 }
36 $resource = CouponData::getCouponRousource($receiveData['code'], $uid); 36 $resource = CouponData::getCouponRousource($receiveData['code'], $uid);
37 if (isset($resource['code']) && $resource['code'] === 200) { 37 if (isset($resource['code']) && $resource['code'] === 200) {
38 - $result = CouponFloorProcess::getContent($resource['data']); 38 + $result = CouponFloorProcess::getContent($resource['data'],$this->isApp());
39 } else { 39 } else {
40 $result['noData'] = true; 40 $result['noData'] = true;
41 } 41 }