mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 03:36:30 +01:00
counting bikes on station by bike_count
This commit is contained in:
parent
397c3b1917
commit
2a3f579b94
5 changed files with 65 additions and 6 deletions
|
@ -113,6 +113,11 @@ sub sig_available {
|
||||||
if($station && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){
|
if($station && looks_like_number($resp->{site}->{id}) && ref($bike_group) eq "ARRAY" && @{$bike_group}[0]){
|
||||||
print FILE "Station: $station\n\n";
|
print FILE "Station: $station\n\n";
|
||||||
$response_out->{$station}->{station} = "$station";
|
$response_out->{$station}->{station} = "$station";
|
||||||
|
|
||||||
|
if($resp->{status} && $resp->{status} =~ /ACTIVE|PRIVATE/i && !$resp->{reservation_state}){
|
||||||
|
$response_out->{$station}->{bike_count}++;
|
||||||
|
}
|
||||||
|
|
||||||
$response_out->{$station}->{authed} = "$authed";
|
$response_out->{$station}->{authed} = "$authed";
|
||||||
$response_out->{$station}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
$response_out->{$station}->{uri_operator} = "$dbt->{operator}->{$varenv->{dbname}}->{operatorApp}";
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ sub station_information {
|
||||||
$gbfs_station{$station}{station_id} = $response_stations->{shareejson}->{stations}->{$station}->{station};
|
$gbfs_station{$station}{station_id} = $response_stations->{shareejson}->{stations}->{$station}->{station};
|
||||||
$gbfs_station{$station}{name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$response_stations->{shareejson}->{stations}->{$station}->{description}));
|
$gbfs_station{$station}{name} = Encode::encode('utf-8', Encode::decode('iso-8859-1',$response_stations->{shareejson}->{stations}->{$station}->{description}));
|
||||||
$gbfs_station{$station}{capacity} = $response_stations->{shareejson}->{stations}->{$station}->{capacity};
|
$gbfs_station{$station}{capacity} = $response_stations->{shareejson}->{stations}->{$station}->{capacity};
|
||||||
|
$gbfs_station{$station}{bike_count} = $response_stations->{shareejson}->{stations}->{$station}->{bike_count};
|
||||||
$gbfs_station{$station}{lat} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{latitude};
|
$gbfs_station{$station}{lat} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{latitude};
|
||||||
$gbfs_station{$station}{lon} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{longitude};
|
$gbfs_station{$station}{lon} = $response_stations->{shareejson}->{stations}->{$station}->{gps}->{longitude};
|
||||||
#$gbfs_station{$station}{is_charging_station} = 1 if(grep(/300102/, @{$response_stations->{shareejson}->{stations}->{$station}->{station_group}}));#E-L
|
#$gbfs_station{$station}{is_charging_station} = 1 if(grep(/300102/, @{$response_stations->{shareejson}->{stations}->{$station}->{station_group}}));#E-L
|
||||||
|
|
|
@ -488,13 +488,14 @@ sub rpc {
|
||||||
#$update_adr->{txt28} = $val if($key eq "mandate_text" && ($val =~ /SEPA/ || !$val));
|
#$update_adr->{txt28} = $val if($key eq "mandate_text" && ($val =~ /SEPA/ || !$val));
|
||||||
$update_adr->{txt28} = $now_dt . " $todo\n" . $q->escapeHTML($res->content);
|
$update_adr->{txt28} = $now_dt . " $todo\n" . $q->escapeHTML($res->content);
|
||||||
}
|
}
|
||||||
$update_adr->{int12} = 0;#Vde
|
$update_adr->{int12} = 0 if($vde_on_fail != 2);#Vde
|
||||||
$dbt->update_record($dbh,$update_adr,$ctadr) if($ctadr->{c_id} > 0);
|
$dbt->update_record($dbh,$update_adr,$ctadr) if($ctadr->{c_id} > 0);
|
||||||
my $ret = $self->pdfmandat($varenv,$ctadr->{c_id});
|
my $ret = $self->pdfmandat($varenv,$ctadr->{c_id});
|
||||||
print FILE "pdfmandat call generates: $ret\n" if($debug);
|
print FILE "pdfmandat call generates: $ret\n" if($debug);
|
||||||
}elsif($ctadr->{c_id}){
|
}elsif($ctadr->{c_id}){
|
||||||
$update_adr->{int12} = $vde_on_fail;#Vde
|
$update_adr->{int12} = $vde_on_fail;#Vde
|
||||||
}
|
}
|
||||||
|
print FILE "managemandate update_adr:" . Dumper($update_adr) . "\n" if($debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $txidval = "";
|
my $txidval = "";
|
||||||
|
|
|
@ -238,8 +238,8 @@ sub save_account(){
|
||||||
}
|
}
|
||||||
$u_rows = $dbt->update_one($dbh,$update_primary,"txt17='@operators'");
|
$u_rows = $dbt->update_one($dbh,$update_primary,"txt17='@operators'");
|
||||||
}
|
}
|
||||||
#Web-Login|Rabatt|Vde|payone cron-intervall|Ilockit-Admin|miniq
|
#Rabatt|payone cron-intervall|Ilockit-Admin|miniq
|
||||||
elsif($_ =~ /int05|int07|int16|int19|int23/){
|
elsif($_ =~ /int07|int16|int19|int23/){
|
||||||
$u_rows = $dbt->update_one("",$update_primary,"$_=$valxx");
|
$u_rows = $dbt->update_one("",$update_primary,"$_=$valxx");
|
||||||
}
|
}
|
||||||
#user_tour
|
#user_tour
|
||||||
|
@ -442,6 +442,9 @@ sub save_account(){
|
||||||
}
|
}
|
||||||
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
|
$u_rows = $dbt->update_one($dbh,$update_primary,"$_='$valxx'");
|
||||||
}
|
}
|
||||||
|
}elsif($_ eq "int05"){#Web-login
|
||||||
|
$u_rows = $dbt->update_one($dbh,$update_primary,"$_=$valxx");
|
||||||
|
$u_rows = $dbt->update_one($dbh,$update_primary,"txt05=null") if($valxx != 1);
|
||||||
}elsif($_ eq "int12" && $varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
}elsif($_ eq "int12" && $varenv{dbname} ne $dbt->{primary}->{sharee_primary}->{database}->{dbname}){
|
||||||
my $vde_on_fail = 0;
|
my $vde_on_fail = 0;
|
||||||
$vde_on_fail = 2 if($valxx && $valxx == 1);
|
$vde_on_fail = 2 if($valxx && $valxx == 1);
|
||||||
|
@ -503,7 +506,7 @@ sub save_account(){
|
||||||
$ctadr = $dbt->fetch_record($dbh,$authref);
|
$ctadr = $dbt->fetch_record($dbh,$authref);
|
||||||
print FILE "+++ $R::request && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id} \n" if($debug);
|
print FILE "+++ $R::request && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id} \n" if($debug);
|
||||||
|
|
||||||
#if($R::request eq "managemandate" && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id}){
|
#if($R::request eq "managemandate" && $ctadr->{int03} == 1 && $ctadr->{ct_name} eq $ctadr->{c_id})
|
||||||
#fraud workaround
|
#fraud workaround
|
||||||
my $iban = $ctadr->{txt22} || "";
|
my $iban = $ctadr->{txt22} || "";
|
||||||
$iban =~ s/\s//g;
|
$iban =~ s/\s//g;
|
||||||
|
@ -533,7 +536,8 @@ sub save_account(){
|
||||||
if(1==1){
|
if(1==1){
|
||||||
|
|
||||||
$ctt->{txt16} = "$payone_txid";
|
$ctt->{txt16} = "$payone_txid";
|
||||||
$u_rows = $dbt->update_one($dbh,$update_primary,"int12=0");#Vde
|
$vde_on_fail = 0 if($vde_on_fail != 2);
|
||||||
|
$u_rows = $dbt->update_one($dbh,$update_primary,"int12=$vde_on_fail");#Vde
|
||||||
#$payone_txid = $payone->captureSEPA_main(\%varenv,$ctadr,$ctt,$owner);
|
#$payone_txid = $payone->captureSEPA_main(\%varenv,$ctadr,$ctt,$owner);
|
||||||
#int12=0 should be set after capture success in payment module
|
#int12=0 should be set after capture success in payment module
|
||||||
|
|
||||||
|
@ -573,7 +577,7 @@ sub save_account(){
|
||||||
print FILE Dumper($feedb) . "\n" if($debug);
|
print FILE Dumper($feedb) . "\n" if($debug);
|
||||||
close(FILE) if($debug);
|
close(FILE) if($debug);
|
||||||
return ($ret,$feedb);
|
return ($ret,$feedb);
|
||||||
}
|
}#end save_account
|
||||||
|
|
||||||
#insert/save/delete DMS users
|
#insert/save/delete DMS users
|
||||||
sub manage_dmsusers {
|
sub manage_dmsusers {
|
||||||
|
|
|
@ -144,6 +144,8 @@ var icon_red = L.icon({
|
||||||
popupAnchor: [-2, -36]
|
popupAnchor: [-2, -36]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//stations and bikes at all
|
||||||
|
if(1==2){
|
||||||
Promise.all([
|
Promise.all([
|
||||||
fetch(
|
fetch(
|
||||||
"$uri_request/GBFSout?request=stations_available&authcookie=$api_return->{authcookie}"
|
"$uri_request/GBFSout?request=stations_available&authcookie=$api_return->{authcookie}"
|
||||||
|
@ -202,6 +204,52 @@ Promise.all([
|
||||||
|
|
||||||
map.fitBounds(layerGroup.getBounds());
|
map.fitBounds(layerGroup.getBounds());
|
||||||
});
|
});
|
||||||
|
}//end stations and bikes at all
|
||||||
|
|
||||||
|
//Only stations with bike_count
|
||||||
|
Promise.all([
|
||||||
|
fetch(
|
||||||
|
"$uri_request/GBFSout?request=stations_available&authcookie=$api_return->{authcookie}"
|
||||||
|
)]).then(async ([response1]) => {
|
||||||
|
const responseData1 = await response1.json();
|
||||||
|
|
||||||
|
const data1 = responseData1.data.stations;
|
||||||
|
|
||||||
|
const layerGroup = L.featureGroup().addTo(map);
|
||||||
|
data1.forEach(({ lat, lon, name, address, bike_count, station_id: stationId }) => {
|
||||||
|
console.log('Station: ' + stationId , name);
|
||||||
|
|
||||||
|
if(bike_count > 0){
|
||||||
|
layerGroup.addLayer(
|
||||||
|
L.marker([lat, lon], { icon:icon_green }).bindPopup(
|
||||||
|
`<b>Mietradstation: \${name} \${stationId} </b><br/>
|
||||||
|
Verfügbare Mieträder: \${bike_count}
|
||||||
|
`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
layerGroup.addLayer(
|
||||||
|
L.marker([lat, lon], { icon:icon_red }).bindPopup(
|
||||||
|
`<b>Mietradstation: \${name} \${stationId} </b><br/>
|
||||||
|
Aktuell ist kein Mietrad verfügbar
|
||||||
|
`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if('$manlat' && '$manlng'){
|
||||||
|
layerGroup.addLayer(
|
||||||
|
L.marker([$manlat, $manlng]).bindPopup(
|
||||||
|
'$manlat, $manlng'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.fitBounds(layerGroup.getBounds());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Add table
Reference in a new issue