...
|
...
|
@@ -311,73 +311,22 @@ class ShopProcess |
|
|
*/
|
|
|
private static function hotProducts_APP($data)
|
|
|
{
|
|
|
$condition['productSkn'] = '';
|
|
|
|
|
|
$productSkn = array();
|
|
|
foreach ($data as $val) {
|
|
|
$condition['productSkn'] .= $val['productSkn'] . ',';
|
|
|
$productSkn[] = $val['productSkn'];
|
|
|
}
|
|
|
|
|
|
/* tar modified 160826 根据资源位接口返回的 skn 去查数据,查到后取商品数据,查不到取资源位接口数据 */
|
|
|
$hotProducts = SearchData::searchBySkn($condition);
|
|
|
|
|
|
if (isset($hotProducts['code']) && $hotProducts['code'] === 200 && isset($hotProducts['data']['product_list'])) {
|
|
|
foreach ($hotProducts['data']['product_list'] as $val) {
|
|
|
|
|
|
/* 取第一个设为默认商品 goods */
|
|
|
$defaultGoods = $val['goods_list'][0];
|
|
|
|
|
|
/* 判断是否设置了默认 goods,如果设置了就重新赋值 */
|
|
|
foreach ($val['goods_list'] as $key => $goods) {
|
|
|
if ($goods['is_default'] === 'Y') {
|
|
|
$defaultGoods = $goods;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$goodsCover = $val['goods_list'][0]['images_url'];
|
|
|
|
|
|
if (self::$channel == 1) {
|
|
|
$goodsCover = empty($defaultGoods['cover_1']) ? $defaultGoods['images_url'] : $defaultGoods['cover_1'];
|
|
|
}
|
|
|
|
|
|
if (self::$channel == 2) {
|
|
|
$goodsCover = empty($defaultGoods['cover_2']) ? $defaultGoods['images_url'] : $defaultGoods['cover_2'];
|
|
|
}
|
|
|
$product = DetailData::productBatch($productSkn);
|
|
|
if ($product['code'] === 200 && isset($product['data']['product_list'])) {
|
|
|
|
|
|
/* 如果还是没取到,取 product 默认图片 */
|
|
|
if (empty($goodsCover)) {
|
|
|
$goodsCover = $val['default_images'];
|
|
|
}
|
|
|
|
|
|
$goods = array(
|
|
|
'url' => Helpers::getUrlBySkc($val['product_id'], $val['goods_list'][0]['goods_id'], $val['cn_alphabet']),
|
|
|
'img' => Helpers::getImageUrl($goodsCover, 235, 314),
|
|
|
'productName' => $val['product_name'],
|
|
|
'salesPrice' => '¥' . $val['sales_price'],
|
|
|
'presentPrice' => '¥' . $val['sales_price']
|
|
|
);
|
|
|
if (!empty(self::$appVersion)) {
|
|
|
$goods['url'] .= '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":' . $val['product_skn'] . '}}';
|
|
|
}
|
|
|
foreach ($product['data']['product_list'] as $key => $value) {
|
|
|
$goods = Helpers::formatProduct($value, false, false, false, 235, 314, self::$appVersion);
|
|
|
//店铺人气商品不须要其它标签、即将售罄
|
|
|
$goods['tags'] = array();
|
|
|
$goods['is_soon_sold_out'] = false;
|
|
|
$goods['tags']['is_hot'] = true;
|
|
|
self::$shopData['hotList'][] = $goods;
|
|
|
}
|
|
|
} else {
|
|
|
$productSkn = array();
|
|
|
foreach ($data as $val) {
|
|
|
$productSkn[] = $val['productSkn'];
|
|
|
}
|
|
|
|
|
|
$product = DetailData::productBatch($productSkn);
|
|
|
if ($product['code'] === 200 && isset($product['data']['product_list'])) {
|
|
|
|
|
|
foreach ($product['data']['product_list'] as $key => $value) {
|
|
|
$goods = Helpers::formatProduct($value, false, false, false, 235, 314, self::$appVersion);
|
|
|
//店铺人气商品不须要其它标签、即将售罄
|
|
|
$goods['tags'] = array();
|
|
|
$goods['is_soon_sold_out'] = false;
|
|
|
$goods['tags']['is_hot'] = true;
|
|
|
self::$shopData['hotList'][] = $goods;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|