Authored by hf

code review by hf: fixes bug refs YW-1662 filter exception api return data

... ... @@ -100,20 +100,23 @@ class UserModel
/**
* 处理个人中心页面优选新品数据
*
* @param int $yh_channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
* @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
* @return array|mixed 处理之后的个人中心页面优选新品数据
*/
public static function getPreferenceData($yh_channel)
public static function getPreferenceData($channel)
{
$result = array();
// 调用接口获取个人中心页面优选新品数据
$preferenceData = UserData::preference($yh_channel);
$preferenceData = UserData::preference($channel);
// 处理个人中心页面优选新品数据
if (isset($preferenceData['data']) && !empty($preferenceData['data'])) {
foreach ($preferenceData['data'] as $val) {
$result['recommendList'][] = Helpers::formatProduct($val, false, true, true, 299, 388, false, false);
if (!empty($preferenceData['data'])) {
foreach ($preferenceData['data'] as $value) {
$value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
if (false !== $value) {
$result['recommendList'][] = $value;
}
}
}
... ...
... ... @@ -550,7 +550,10 @@ class DetailModel
$preference = DetailData::preference($productSkn, $channel, $brandId);
if (!empty($preference)) {
foreach ($preference as $value) {
$result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
$value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
if (false !== $value) {
$result['recommendList'][] = $value;
}
}
}
}
... ...