$method($where); $result = array(); if ($data) { foreach ($data as $k => $v) { $data[$k] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']); if ($data[$k]['status'] == 1) { if (!isset($result[$v['id']])) { $result[$v['id']]['id'] = $v['id']; $result[$v['id']]['name'] = $v['name']; $result[$v['id']]['min'] = $data[$k]['min']; $result[$v['id']]['price'] = $v['p_price'] ? $v['p_price'] : 0; $result[$v['id']]['c_price'] = $data[$k]['c_price'] ? $data[$k]['c_price'] : 0; $result[$v['id']]['children'] = array(); } if (isset($data[$k]['attr']) && $data[$k]['attr']) { $result[$v['id']]['children'][] = array ( 'id' => $v['id'] . '-' . $data[$k]['sku_id'], 'name' => $v['name'] . '-' . $data[$k]['sku_name'], 'min' => $data[$k]['min'], 'price' => $v['p_price'] ? $v['p_price'] : 0, 'c_price' => $data[$k]['c_price'] ? $data[$k]['c_price'] : 0, 'end' => true, ); } if (!$result[$v['id']]['children']) { $result[$v['id']]['end'] = true; } } } } return array_values($result); } }