Authored by 毕凯

Merge branch 'release/4.3' of git.dev.yoho.cn:web/yohobuywap into release/4.3

@@ -66,26 +66,25 @@ class Yohobuy @@ -66,26 +66,25 @@ class Yohobuy
66 public static function clientType() 66 public static function clientType()
67 { 67 {
68 if(self::isMobile()) { 68 if(self::isMobile()) {
69 - return 'h5'; 69 + // 苹果设备
  70 + if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
  71 + return 'iphone';
  72 + }
  73 + // 苹果IPAD
  74 + elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
  75 + return 'ipad';
  76 + }
  77 + elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'android')) {
  78 + return 'android';
  79 + }
  80 + // 其它
  81 + else {
  82 + return 'h5';
  83 + }
70 } 84 }
71 else { 85 else {
72 return 'web'; 86 return 'web';
73 } 87 }
74 -// // 苹果设备  
75 -// if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {  
76 -// return 'iphone';  
77 -// }  
78 -// // 苹果IPAD  
79 -// elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {  
80 -// return 'ipad';  
81 -// }  
82 -// elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'android')) {  
83 -// return 'android';  
84 -// }  
85 -// // 其它  
86 -// else {  
87 -// return 'android';  
88 -// }  
89 } 88 }
90 89
91 /** 90 /**
@@ -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']['url'] : Helpers::getFilterUrl($item['image']['url']);
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) {
@@ -201,7 +210,11 @@ class CouponFloorProcess @@ -201,7 +210,11 @@ class CouponFloorProcess
201 $image['src'] = str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $image['src']); 210 $image['src'] = str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $image['src']);
202 } 211 }
203 } 212 }
204 - $image['url'] = empty($image['url']) ? 'javascript:void(0);' : $image['url']; 213 + if($isApp){
  214 + $image['url'] = empty($image['url']) ? 'javascript:void(0);' : $image['url'];
  215 + }else{
  216 + $image['url'] = empty($image['url']) ? 'javascript:void(0);' : Helpers::getFilterUrl($image['url']);
  217 + }
205 } 218 }
206 $result['isImageList'] = true; 219 $result['isImageList'] = true;
207 $result['imageList'] = array( 220 $result['imageList'] = array(
@@ -217,9 +230,10 @@ class CouponFloorProcess @@ -217,9 +230,10 @@ class CouponFloorProcess
217 * 重构 230 * 重构
218 * 231 *
219 * @param $data 232 * @param $data
  233 + * @param bool $isApp
220 * @return mixed 234 * @return mixed
221 */ 235 */
222 - public static function promotion($data) 236 + public static function promotion($data, $isApp = false)
223 { 237 {
224 $result = array(); 238 $result = array();
225 $result['newArrival'] = array( 239 $result['newArrival'] = array(
@@ -308,7 +322,7 @@ class CouponFloorProcess @@ -308,7 +322,7 @@ class CouponFloorProcess
308 ), 322 ),
309 ); 323 );
310 } 324 }
311 - 325 +
312 /** 326 /**
313 * 327 *
314 * 辅助方法 Debug 数据输出 328 * 辅助方法 Debug 数据输出
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
@@ -116,7 +116,6 @@ function limitUsername() { @@ -116,7 +116,6 @@ function limitUsername() {
116 nameVal = $name.html(), 116 nameVal = $name.html(),
117 nameSize = nameVal.length, 117 nameSize = nameVal.length,
118 bytesCount = 0, 118 bytesCount = 0,
119 - bcount = 0,  
120 newName = ''; 119 newName = '';
121 120
122 var i, code; 121 var i, code;
@@ -131,16 +130,9 @@ function limitUsername() { @@ -131,16 +130,9 @@ function limitUsername() {
131 } 130 }
132 131
133 if (bytesCount > 8) { 132 if (bytesCount > 8) {
134 - newName += '..';  
135 - }  
136 -  
137 - for (i = 0; i < nameSize; i++) {  
138 - code = nameVal.charAt(i);  
139 - bcount = bytesCountAction(code, bcount);  
140 -  
141 - if (bcount > bytesCount - 2) {  
142 - newName += code;  
143 - } 133 + newName += '..' + nameVal.charAt(nameSize - 1);
  134 + } else {
  135 + newName = nameVal;
144 } 136 }
145 137
146 $name.html(newName); 138 $name.html(newName);
@@ -944,7 +944,8 @@ @@ -944,7 +944,8 @@
944 white-space: nowrap; 944 white-space: nowrap;
945 text-overflow: ellipsis; 945 text-overflow: ellipsis;
946 overflow: hidden; 946 overflow: hidden;
947 - height: 30px; 947 + height: 38px;
  948 + line-height: 38px;
948 } 949 }
949 950
950 .ranking-rg { 951 .ranking-rg {
@@ -49,18 +49,18 @@ @@ -49,18 +49,18 @@
49 float: left; 49 float: left;
50 text-align: center; 50 text-align: center;
51 line-height: 180px; 51 line-height: 180px;
52 - font-size: 100px; 52 + font-size: 86px;
53 } 53 }
54 p{ 54 p{
55 width: 59.517241%; 55 width: 59.517241%;
56 height: auto; 56 height: auto;
57 - margin: 0 3% 12px; 57 + margin: 0 12px;
58 float: left; 58 float: left;
59 &:first-of-type{ 59 &:first-of-type{
60 - margin-top: 0.75rem;  
61 - font-size: 32px; 60 + margin-top: 30px;
  61 + font-size: 27.4px;
62 height: auto; 62 height: auto;
63 - min-height: 82px; 63 + min-height: 80px;
64 display: -webkit-box; 64 display: -webkit-box;
65 -webkit-line-clamp: 2; 65 -webkit-line-clamp: 2;
66 -webkit-box-orient: vertical; 66 -webkit-box-orient: vertical;
@@ -34,7 +34,9 @@ @@ -34,7 +34,9 @@
34 <p class="beside-icon sub-content"> 34 <p class="beside-icon sub-content">
35 <span class="sub-title">物流信息</span> 35 <span class="sub-title">物流信息</span>
36 <span>物流公司:{{logisticsCompany}}</span> 36 <span>物流公司:{{logisticsCompany}}</span>
37 - <span>快递单号:{{logisticsNum}}</span> 37 + {{#if logisticsNum}}
  38 + <span>快递单号:{{logisticsNum}}</span>
  39 + {{/if}}
38 </p> 40 </p>
39 <span class="iconfont icon-right">&#xe614;</span> 41 <span class="iconfont icon-right">&#xe614;</span>
40 </a> 42 </a>
@@ -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 }
@@ -19,6 +19,7 @@ use Api\Yohobuy; @@ -19,6 +19,7 @@ use Api\Yohobuy;
19 */ 19 */
20 class StarClassModel 20 class StarClassModel
21 { 21 {
  22 + public static $_isApp = false;
22 23
23 /* 星潮教室首页楼层资源的位置码 */ 24 /* 星潮教室首页楼层资源的位置码 */
24 const CODE_FLOOR_STARCLASS_INDEX = '8adc27fcf5676f356602889afcfd2a8e'; 25 const CODE_FLOOR_STARCLASS_INDEX = '8adc27fcf5676f356602889afcfd2a8e';
@@ -31,8 +32,10 @@ class StarClassModel @@ -31,8 +32,10 @@ class StarClassModel
31 * @param $uid 32 * @param $uid
32 * @return array 33 * @return array
33 */ 34 */
34 - public static function getStarClass($uid) 35 + public static function getStarClass($uid, $isApp)
35 { 36 {
  37 + self::$_isApp = $isApp;
  38 +
36 $result = array(); 39 $result = array();
37 //头部导航 40 //头部导航
38 $result['headTab'] = self::getHeadTab('index'); 41 $result['headTab'] = self::getHeadTab('index');
@@ -102,8 +105,9 @@ class StarClassModel @@ -102,8 +105,9 @@ class StarClassModel
102 * 星专题 105 * 星专题
103 * @return array 106 * @return array
104 */ 107 */
105 - public static function getspecial() 108 + public static function getspecial($isApp)
106 { 109 {
  110 + self::$_isApp = $isApp;
107 $result = array(); 111 $result = array();
108 //头部导航 112 //头部导航
109 $result['headTab'] = self::getHeadTab('special'); 113 $result['headTab'] = self::getHeadTab('special');
@@ -165,7 +169,7 @@ class StarClassModel @@ -165,7 +169,7 @@ class StarClassModel
165 foreach ($data['data']['list']['artList'] as $key => $value) { 169 foreach ($data['data']['list']['artList'] as $key => $value) {
166 //获得原尺寸图片 170 //获得原尺寸图片
167 $collocationList[$key]['img'] = Helpers::getOriginalImg($value['src']); 171 $collocationList[$key]['img'] = Helpers::getOriginalImg($value['src']);
168 - $collocationList[$key]['url'] = $value['url']; 172 + $collocationList[$key]['url'] = $isApp ? $value['url'] : Helpers::getFilterUrl($value['url']);
169 $collocationList[$key]['title'] = $value['title']; 173 $collocationList[$key]['title'] = $value['title'];
170 $collocationList[$key]['content'] = $value['intro']; 174 $collocationList[$key]['content'] = $value['intro'];
171 $collocationList[$key]['time'] = $value['publish_time']; 175 $collocationList[$key]['time'] = $value['publish_time'];
@@ -307,9 +311,10 @@ class StarClassModel @@ -307,9 +311,10 @@ class StarClassModel
307 */ 311 */
308 public static function single_name_image($data) 312 public static function single_name_image($data)
309 { 313 {
  314 + $isApp = self::$_isApp;
310 $result = array(); 315 $result = array();
311 316
312 - $result['url'] = $data['url']; 317 + $result['url'] = $isApp ? $data['url'] : Helpers::getFilterUrl($data['url']);
313 $result['img'] = Helpers::getOriginalImg($data['src']); 318 $result['img'] = Helpers::getOriginalImg($data['src']);
314 $result['title'] = $data['title']; 319 $result['title'] = $data['title'];
315 $result['subject'] = true; 320 $result['subject'] = true;
@@ -325,10 +330,11 @@ class StarClassModel @@ -325,10 +330,11 @@ class StarClassModel
325 */ 330 */
326 public static function focus($data) 331 public static function focus($data)
327 { 332 {
  333 + $isApp = self::$_isApp;
328 $result = array(); 334 $result = array();
329 335
330 foreach ($data as $key=>$value) { 336 foreach ($data as $key=>$value) {
331 - $result['banner'][$key]['url'] = $value['url']; 337 + $result['banner'][$key]['url'] = $isApp ? $value['url'] : Helpers::getFilterUrl($value['url']);
332 $result['banner'][$key]['img'] = Helpers::getOriginalImg($value['src']); 338 $result['banner'][$key]['img'] = Helpers::getOriginalImg($value['src']);
333 $result['banner'][$key]['bgColor'] = $value['bgColor']; 339 $result['banner'][$key]['bgColor'] = $value['bgColor'];
334 $result['banner'][$key]['title'] = $value['title']; 340 $result['banner'][$key]['title'] = $value['title'];
@@ -346,12 +352,14 @@ class StarClassModel @@ -346,12 +352,14 @@ class StarClassModel
346 */ 352 */
347 public static function title_image($data) 353 public static function title_image($data)
348 { 354 {
  355 + $isApp = self::$_isApp;
  356 +
349 $result = array(); 357 $result = array();
350 358
351 $result['title']['title'] = $data['title']; 359 $result['title']['title'] = $data['title'];
352 $result['title']['more_url'] = $data['more_url']; 360 $result['title']['more_url'] = $data['more_url'];
353 $result['title']['moreName'] = $data['more_name']; 361 $result['title']['moreName'] = $data['more_name'];
354 - $result['subjectBanner']['url'] = $data['image']['url']; 362 + $result['subjectBanner']['url'] = $isApp ? $data['image']['url'] : Helpers::getFilterUrl($data['image']['url']);
355 $result['subjectBanner']['img'] = Helpers::getOriginalImg($data['image']['src']); 363 $result['subjectBanner']['img'] = Helpers::getOriginalImg($data['image']['src']);
356 $result['starSubject'] = true; 364 $result['starSubject'] = true;
357 365
@@ -365,10 +373,11 @@ class StarClassModel @@ -365,10 +373,11 @@ class StarClassModel
365 */ 373 */
366 public static function single_image($data) 374 public static function single_image($data)
367 { 375 {
  376 + $isApp = self::$_isApp;
368 $result = array(); 377 $result = array();
369 378
370 $result['videoImg'] = Helpers::getOriginalImg($data[0]['src']); 379 $result['videoImg'] = Helpers::getOriginalImg($data[0]['src']);
371 - $result['videoUrl'] = $data[0]['url']; 380 + $result['videoUrl'] = $isApp ? $data[0]['url'] : Helpers::getFilterUrl($data[0]['url']);
372 $result['alt'] = $data[0]['alt']; 381 $result['alt'] = $data[0]['alt'];
373 $result['title'] = $data[0]['title']; 382 $result['title'] = $data[0]['title'];
374 $result['video'] = true; 383 $result['video'] = true;
@@ -383,6 +392,7 @@ class StarClassModel @@ -383,6 +392,7 @@ class StarClassModel
383 */ 392 */
384 public static function match_image($data) 393 public static function match_image($data)
385 { 394 {
  395 + $isApp = self::$_isApp;
386 $result = array(); 396 $result = array();
387 397
388 //title 398 //title
@@ -392,13 +402,13 @@ class StarClassModel @@ -392,13 +402,13 @@ class StarClassModel
392 402
393 //两张大图 403 //两张大图
394 foreach ($data['top_image'] as $key=>$value) { 404 foreach ($data['top_image'] as $key=>$value) {
395 - $result['collocationBigImg'][$key]['url'] = $value['url']; 405 + $result['collocationBigImg'][$key]['url'] = $isApp ? $value['url']: Helpers::getFilterUrl($value['url']);
396 $result['collocationBigImg'][$key]['img'] = Helpers::getOriginalImg($value['src']); 406 $result['collocationBigImg'][$key]['img'] = Helpers::getOriginalImg($value['src']);
397 } 407 }
398 408
399 //n张小图 409 //n张小图
400 foreach ($data['list'] as $key=>$value) { 410 foreach ($data['list'] as $key=>$value) {
401 - $result['collocationList'][$key]['url'] = $value['url']; 411 + $result['collocationList'][$key]['url'] = $isApp ? $value['url'] : Helpers::getFilterUrl($value['url']);
402 $result['collocationList'][$key]['img'] = Helpers::getOriginalImg($value['src']); 412 $result['collocationList'][$key]['img'] = Helpers::getOriginalImg($value['src']);
403 } 413 }
404 414
@@ -33,15 +33,16 @@ class StarClassController extends AbstractAction @@ -33,15 +33,16 @@ class StarClassController extends AbstractAction
33 } 33 }
34 } 34 }
35 //设置头部公共导航 35 //设置头部公共导航
36 - $isApp = $this->getCookie('isApp', false);  
37 -  
38 - if (!($isApp || $this->_isApp)) { 36 + $app = $this->getCookie('isApp', false);
  37 + $isApp = $app || $this->_isApp;
  38 + if (!$isApp) {
39 $this->setNavHeader('星潮教室', true, false); 39 $this->setNavHeader('星潮教室', true, false);
40 } 40 }
41 41
42 $this->setTitle('星潮教室', false, ''); 42 $this->setTitle('星潮教室', false, '');
43 //调用模型获得星潮教室首页数据 43 //调用模型获得星潮教室首页数据
44 - $data = StarClassModel::getStarClass($uid); 44 + $data = StarClassModel::getStarClass($uid, $isApp);
  45 +
45 //渲染模板 46 //渲染模板
46 $this->_view->display('index', array( 47 $this->_view->display('index', array(
47 'trendClassHome' => $data, 48 'trendClassHome' => $data,
@@ -66,7 +67,7 @@ class StarClassController extends AbstractAction @@ -66,7 +67,7 @@ class StarClassController extends AbstractAction
66 $this->setTitle('星潮教室', false, ''); 67 $this->setTitle('星潮教室', false, '');
67 68
68 //调用模型获得星专题数据 69 //调用模型获得星专题数据
69 - $data = StarClassModel::getspecial(); 70 + $data = StarClassModel::getspecial($isApp);
70 71
71 //渲染模板 72 //渲染模板
72 $this->_view->display('subject', array( 73 $this->_view->display('subject', array(