|
|
|
@ -82,23 +82,12 @@ class Identity extends BaseService |
|
|
|
|
|
|
|
|
|
private function cheapPrice($data) |
|
|
|
|
{ |
|
|
|
|
$one_data = []; |
|
|
|
|
foreach ($data as $value) { |
|
|
|
|
if ($value['month'] == 1) { |
|
|
|
|
$one_data = $value; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$one_data = $data[0]; |
|
|
|
|
foreach ($data as $key => $value) { |
|
|
|
|
$data[$key]['cheap_price'] = 0; |
|
|
|
|
if (!empty($one_data)) { |
|
|
|
|
if ($value['month'] > 1) { |
|
|
|
|
$price = $value['month'] * $one_data['price']; |
|
|
|
|
$data[$key]['cheap_price'] = $price - $value['price']; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($key > 0) { |
|
|
|
|
$price = $value['month'] * $data[$key - 1]['price']; |
|
|
|
|
$price = $value['month'] * $one_data['price']; |
|
|
|
|
$data[$key]['cheap_price'] = $price - $value['price']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|