...
|
...
|
@@ -20,50 +20,32 @@ class NewSaleProcess |
|
|
public static function newSaleData($products)
|
|
|
{
|
|
|
$result = array();
|
|
|
$noTab = true;
|
|
|
$productsLi = array();
|
|
|
$tabItem = array();
|
|
|
|
|
|
foreach ($products as $single) {
|
|
|
if (empty($single)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
// 处理Filter
|
|
|
if(isset($single['filter'])) {
|
|
|
$result['filter'] = ListProcess::getFilterData($single['filter']);
|
|
|
}
|
|
|
|
|
|
// 处理Tabs
|
|
|
$noTab = true;
|
|
|
if (isset($single['tabs']) && $noTab) {
|
|
|
$result['tabs'] = array();
|
|
|
foreach ($single['tabs'] as $key => $one) {
|
|
|
$tabItem = array();
|
|
|
$tabItem['title'] = $one;
|
|
|
$tabItem['dataId'] = $key;
|
|
|
if ($key === 1) {
|
|
|
$tabItem['focus'] = true;
|
|
|
}
|
|
|
$result['tabs'][] = $tabItem;
|
|
|
// 处理Tabs
|
|
|
if (isset($products['tabs'])) {
|
|
|
$result['tabs'] = array();
|
|
|
foreach ($products['tabs'] as $key => $one) {
|
|
|
$tabItem = array();
|
|
|
$tabItem['title'] = $one;
|
|
|
$tabItem['dataId'] = $key;
|
|
|
if ($key === 1) {
|
|
|
$tabItem['focus'] = true;
|
|
|
}
|
|
|
$noTab = false;
|
|
|
$result['tabs'][] = $tabItem;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 处理商品
|
|
|
$productsLi = array();
|
|
|
if (isset($single['product_list'])) {
|
|
|
foreach ($single['product_list'] as $value) {
|
|
|
$productsLi['goods'][] = Helpers::formatProduct($value, true, false, false);
|
|
|
}
|
|
|
}
|
|
|
// 处理Filter
|
|
|
if(isset($products['filter'])) {
|
|
|
$result['filter'] = ListProcess::getFilterData($products['filter']);
|
|
|
}
|
|
|
|
|
|
// 对于第一个productsLi添加show字段
|
|
|
if (!isset($result['goodsContainer'][0])) {
|
|
|
$productsLi['show'] = true;
|
|
|
}
|
|
|
// 处理商品
|
|
|
if (isset($products['product_list'])) {
|
|
|
foreach ($products['product_list'] as $single) {
|
|
|
|
|
|
$result['goodsContainer'][] = $productsLi;
|
|
|
$result['goods'][] = Helpers::formatProduct($single, true, false, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
|