Authored by hf

code review by hf: do cuxiao huodong christmas second times

@@ -23,16 +23,16 @@ class Yohobuy @@ -23,16 +23,16 @@ class Yohobuy
23 // const SERVICE_URL = 'http://service.api.yohobuy.com/'; 23 // const SERVICE_URL = 'http://service.api.yohobuy.com/';
24 // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 24 // const YOHOBUY_URL = 'http://www.yohobuy.com/';
25 25
26 -// const API_URL = 'http://apih5.yoho.cn/';  
27 -// const API_URL2 = 'http://apih5.yoho.cn/';  
28 -// const SERVICE_URL = 'http://serviceh5.yoho.cn/';  
29 -// const YOHOBUY_URL = 'http://www.yohobuy.com/';  
30 -  
31 - /* 测试环境 */  
32 - const API_URL = 'http://testapi.yoho.cn:28078/';  
33 - const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; 26 + const API_URL = 'http://apih5.yoho.cn/';
  27 + const API_URL2 = 'http://apih5.yoho.cn/';
  28 + const SERVICE_URL = 'http://serviceh5.yoho.cn/';
34 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 29 const YOHOBUY_URL = 'http://www.yohobuy.com/';
35 30
  31 +// /* 测试环境 */
  32 +// const API_URL = 'http://testapi.yoho.cn:28078/';
  33 +// const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
  34 +// const YOHOBUY_URL = 'http://www.yohobuy.com/';
  35 +
36 /** 36 /**
37 * 私钥列表 37 * 私钥列表
38 * 38 *
@@ -34,10 +34,12 @@ class DetailModel @@ -34,10 +34,12 @@ class DetailModel
34 $baseInfo = DetailData::baseInfo($productId, $uid); 34 $baseInfo = DetailData::baseInfo($productId, $uid);
35 35
36 // 商品名称 36 // 商品名称
37 - if (isset($baseInfo['productName'])) {  
38 - $result['goodsName'] = $baseInfo['productName']; 37 + if (empty($baseInfo['productName'])) {
  38 + return $result;
39 } 39 }
40 40
  41 + $result['goodsName'] = $baseInfo['productName'];
  42 +
41 // 商品促销短语 43 // 商品促销短语
42 if (!empty($baseInfo['salesPhrase'])) { 44 if (!empty($baseInfo['salesPhrase'])) {
43 $result['goodsSubtitle'] = $baseInfo['salesPhrase']; 45 $result['goodsSubtitle'] = $baseInfo['salesPhrase'];
@@ -178,7 +180,7 @@ class DetailModel @@ -178,7 +180,7 @@ class DetailModel
178 // 商品的尺码列表 180 // 商品的尺码列表
179 if (isset($value['goodsSizeBoList'])) { 181 if (isset($value['goodsSizeBoList'])) {
180 foreach ($value['goodsSizeBoList'] as $size) { 182 foreach ($value['goodsSizeBoList'] as $size) {
181 - $sizeList[ $value['colorId'] ][] = array( 183 + $sizeList[$value['colorId']][] = array(
182 'id' => $size['id'], 184 'id' => $size['id'],
183 'skuId' => $size['goodsSizeSkuId'], 185 'skuId' => $size['goodsSizeSkuId'],
184 'goodsId' => $size['goodsId'], 186 'goodsId' => $size['goodsId'],
@@ -188,7 +190,7 @@ class DetailModel @@ -188,7 +190,7 @@ class DetailModel
188 ); 190 );
189 $colorStorageNum += intval($size['goodsSizeStorageNum']); 191 $colorStorageNum += intval($size['goodsSizeStorageNum']);
190 $sizeStorageStr .= $size['goodsSizeStorageNum'] . '/'; 192 $sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
191 - $colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum']; 193 + $colorStorageGroup[$size['sizeName']][$value['colorName']] = $size['goodsSizeStorageNum'];
192 } 194 }
193 195
194 // 颜色分组 196 // 颜色分组
@@ -203,19 +205,22 @@ class DetailModel @@ -203,19 +205,22 @@ class DetailModel
203 } 205 }
204 206
205 // 缩略图 207 // 缩略图
206 - $thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) ); 208 + $thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60));
207 209
208 - foreach ($sizeList as &$sizeArr) {  
209 - $sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) ); 210 + // 添加尺码对应的各个颜色的库存量
  211 + foreach ($sizeList as $colorId => $sizeArr) {
  212 + foreach ($sizeArr as $key => $value) {
  213 + $sizeList[$colorId][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[$value['name']]));
  214 + }
210 } 215 }
211 216
212 // 商品库存总数 217 // 商品库存总数
213 $totalStorageNum += $colorStorageNum; 218 $totalStorageNum += $colorStorageNum;
214 } 219 }
215 220
216 - // 统计尺码对应的各个颜色的库存量 221 + // 格式化尺码对应的各个颜色分组
217 foreach ($colorGroup as $value) { 222 foreach ($colorGroup as $value) {
218 - $sizeGroup[]['size'] = $sizeList[ $value['colorId'] ]; 223 + $sizeGroup[]['size'] = $sizeList[ $value['id'] ];
219 } 224 }
220 225
221 // 商品图: 多个 226 // 商品图: 多个
@@ -360,10 +365,9 @@ class DetailModel @@ -360,10 +365,9 @@ class DetailModel
360 foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) { 365 foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
361 $item = array(); 366 $item = array();
362 $sizeNameList[] = array('param' => $value['sizeName']); 367 $sizeNameList[] = array('param' => $value['sizeName']);
363 - if ($boyReference && ($gender == 1 || $gender == 3) ) { 368 + if ($boyReference && ($gender == 1 || $gender == 3)) {
364 $referenceList[] = array('param' => empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName']); 369 $referenceList[] = array('param' => empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName']);
365 - }  
366 - elseif ($girlReference && ($gender == 2 || $gender == 3) ) { 370 + } elseif ($girlReference && ($gender == 2 || $gender == 3)) {
367 $referenceList[] = array('param' => empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName']); 371 $referenceList[] = array('param' => empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName']);
368 } 372 }
369 foreach ($value['sortAttributes'] as $attr) { 373 foreach ($value['sortAttributes'] as $attr) {