Authored by hf

code review by hf: do cuxiao huodong christmas second times

... ... @@ -23,15 +23,15 @@ 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 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 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'];
... ... @@ -159,12 +161,12 @@ class DetailModel
$thumbImageList = array();
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
$colorStorageNum = 0;
$colorStorageNum = 0;
$totalStorageNum = 0; // 总库存数
foreach ($baseInfo['goodsList'] as $value) {
$colorStorageNum = 0;
$sizeStorageStr = '';
// 商品分组
if (isset($value['goodsImagesList'])) {
foreach ($value['goodsImagesList'] as $goods) {
... ... @@ -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,9 +190,9 @@ class DetailModel
);
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
$colorStorageGroup[$size['sizeName']][$value['colorName']] = $size['goodsSizeStorageNum'];
}
// 颜色分组
$colorGroup[] = array(
'id' => $value['colorId'],
... ... @@ -201,21 +203,24 @@ class DetailModel
'sizeNumStr' => rtrim($sizeStorageStr, '/'),
);
}
// 缩略图
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60));
// 添加尺码对应的各个颜色的库存量
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) {
... ...