|
@@ -438,7 +438,7 @@ class Api
|
|
|
}
|
|
|
|
|
|
# 获取价值
|
|
|
- public function getPrice($type, $area)
|
|
|
+ public function getPrice($type, $area, $relation = false)
|
|
|
{
|
|
|
$price = 0;
|
|
|
$area = explode(',', $area);
|
|
@@ -449,6 +449,21 @@ class Api
|
|
|
$city = Dever::db('area/city')->find($city);
|
|
|
if ($city && $city['level_id'] > 0) {
|
|
|
$level = Dever::db('area/level')->find($city['level_id']);
|
|
|
+ if ($relation) {
|
|
|
+ $relation['where']['area_level_id'] = $level['id'];
|
|
|
+ $relation = Dever::db($relation['table'])->find($relation['where']);
|
|
|
+ if ($relation) {
|
|
|
+ if ($relation['city_price']) {
|
|
|
+ $level['city_price'] = $relation['city_price'];
|
|
|
+ }
|
|
|
+ if ($relation['county_price']) {
|
|
|
+ $level['county_price'] = $relation['county_price'];
|
|
|
+ }
|
|
|
+ if ($relation['town_price']) {
|
|
|
+ $level['town_price'] = $relation['town_price'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$num = 10000;
|
|
|
if ($type == 1) {
|
|
@@ -457,7 +472,7 @@ class Api
|
|
|
if ($city['price'] && $city['price'] == -2) {
|
|
|
$city_price = 0;
|
|
|
} else {
|
|
|
- if ($city['price'] && $city['price'] >= 0) {
|
|
|
+ if (!$relation && $city['price'] && $city['price'] >= 0) {
|
|
|
$city_price = $city['price'];
|
|
|
}
|
|
|
if ($city_price < 0) {
|
|
@@ -479,7 +494,7 @@ class Api
|
|
|
$county = $area[2];
|
|
|
$county = Dever::db('area/county')->find($county);
|
|
|
if ($county) {
|
|
|
- if ($county['price'] && $county['price'] >= 0) {
|
|
|
+ if (!$relation && $county['price'] && $county['price'] >= 0) {
|
|
|
$county_price = $county['price'];
|
|
|
}
|
|
|
/* elseif ($county['level'] == 2) {
|
|
@@ -513,7 +528,7 @@ class Api
|
|
|
$town = $area[3];
|
|
|
$town = Dever::db('area/town')->find($town);
|
|
|
if ($town) {
|
|
|
- if ($town['price'] && $town['price'] > 0) {
|
|
|
+ if (!$relation && $town['price'] && $town['price'] > 0) {
|
|
|
$town_price = $town['price'];
|
|
|
} elseif ($level && $town['type'] > 1) {
|
|
|
$town_price = $level['county_price'];
|