Authored by hf

code review by hf: do cuxiao huodong christmas second times

... ... @@ -23,16 +23,16 @@ class Yohobuy
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const API_URL = 'http://apih5.yoho.cn/';
const API_URL2 = 'http://apih5.yoho.cn/';
const SERVICE_URL = 'http://serviceh5.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
// /* 测试环境 */
// const API_URL = 'http://testapi.yoho.cn:28078/';
// const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/**
* 私钥列表
*
... ...
... ... @@ -34,10 +34,12 @@ class DetailModel
$baseInfo = DetailData::baseInfo($productId, $uid);
// 商品名称
if (isset($baseInfo['productName'])) {
$result['goodsName'] = $baseInfo['productName'];
if (empty($baseInfo['productName'])) {
return $result;
}
$result['goodsName'] = $baseInfo['productName'];
// 商品促销短语
if (!empty($baseInfo['salesPhrase'])) {
$result['goodsSubtitle'] = $baseInfo['salesPhrase'];
... ... @@ -178,7 +180,7 @@ class DetailModel
// 商品的尺码列表
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeList[ $value['colorId'] ][] = array(
$sizeList[$value['colorId']][] = array(
'id' => $size['id'],
'skuId' => $size['goodsSizeSkuId'],
'goodsId' => $size['goodsId'],
... ... @@ -188,7 +190,7 @@ class DetailModel
);
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
$colorStorageGroup[$size['sizeName']][$value['colorName']] = $size['goodsSizeStorageNum'];
}
// 颜色分组
... ... @@ -203,19 +205,22 @@ class DetailModel
}
// 缩略图
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60));
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
// 添加尺码对应的各个颜色的库存量
foreach ($sizeList as $colorId => $sizeArr) {
foreach ($sizeArr as $key => $value) {
$sizeList[$colorId][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[$value['name']]));
}
}
// 商品库存总数
$totalStorageNum += $colorStorageNum;
}
// 统计尺码对应的各个颜色的库存量
// 格式化尺码对应的各个颜色分组
foreach ($colorGroup as $value) {
$sizeGroup[]['size'] = $sizeList[ $value['colorId'] ];
$sizeGroup[]['size'] = $sizeList[ $value['id'] ];
}
// 商品图: 多个
... ... @@ -360,10 +365,9 @@ class DetailModel
foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
$item = array();
$sizeNameList[] = array('param' => $value['sizeName']);
if ($boyReference && ($gender == 1 || $gender == 3) ) {
if ($boyReference && ($gender == 1 || $gender == 3)) {
$referenceList[] = array('param' => empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName']);
}
elseif ($girlReference && ($gender == 2 || $gender == 3) ) {
} elseif ($girlReference && ($gender == 2 || $gender == 3)) {
$referenceList[] = array('param' => empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName']);
}
foreach ($value['sortAttributes'] as $attr) {
... ...