瀏覽代碼

Merge branch 'develop'

develop
Fabien Normand 2 年之前
父節點
當前提交
9b8305ebe4
共有 2 個檔案被更改,包括 20 行新增10 行删除
  1. +11
    -10
      Component/CitiesComponent.php
  2. +9
    -0
      Resources/assets/functions/tools.js

+ 11
- 10
Component/CitiesComponent.php 查看文件

@@ -85,19 +85,20 @@ class CitiesComponent

public function callAddressApi($query)
{
if(is_null($query)) {
$query = '';
}
$resultsToReturn = [];

if(!is_null($query)) {
$provider = $this->getGeocoderProvider() ;
$query = GeocodeQuery::create($query)->withData('type', 'housenumber');
$results = $provider->geocodeQuery($query);

$provider = $this->getGeocoderProvider() ;
$query = GeocodeQuery::create($query)->withData('type', 'housenumber');
$results = $provider->geocodeQuery($query);
$resultsToReturn = array();
foreach($results as $result) {
if ($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) {
$resultsToReturn[] = $result;
foreach($results as $result) {
if ($result->getStreetNumber() && strlen($result->getStreetNumber()) > 0) {
$resultsToReturn[] = $result;
}
}
}

return $resultsToReturn;
}


+ 9
- 0
Resources/assets/functions/tools.js 查看文件

@@ -65,6 +65,15 @@ export class SovTools {
else return null;
}

static formatNumberWithoutRounding(number, toFixed) {
if (number){
let factor = Math.pow(10, toFixed);
return Math.floor(number * factor) / factor
}else{
return null
}
}

static formatNumberWithoutFixed(number) {
if (typeof number == 'string') number = number.replace(',', '.');
if (number) return Number(number);

Loading…
取消
儲存