mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01:00
add bike_type json object
This commit is contained in:
parent
036d4dcf50
commit
f02158998f
3 changed files with 49 additions and 29 deletions
|
@ -1070,6 +1070,7 @@ sub booking_update(){
|
||||||
my $auth = shift;
|
my $auth = shift;
|
||||||
my $owner = shift || 0;
|
my $owner = shift || 0;
|
||||||
my $sig_book = shift || {};
|
my $sig_book = shift || {};
|
||||||
|
my $dbh = "";
|
||||||
|
|
||||||
my $state = $q->escapeHTML($q->param('state')) || "";
|
my $state = $q->escapeHTML($q->param('state')) || "";
|
||||||
my $lock_state = $q->escapeHTML($q->param('lock_state')) || "";
|
my $lock_state = $q->escapeHTML($q->param('lock_state')) || "";
|
||||||
|
@ -1925,17 +1926,23 @@ sub bikes_available(){
|
||||||
#$return->{$id}->{description} = "$record->{$id}->{txt01}";
|
#$return->{$id}->{description} = "$record->{$id}->{txt01}";
|
||||||
$return->{$id}->{description} = Encode::encode('utf-8', Encode::decode('iso-8859-1', $record->{$id}->{txt01}));
|
$return->{$id}->{description} = Encode::encode('utf-8', Encode::decode('iso-8859-1', $record->{$id}->{txt01}));
|
||||||
$return->{$id}->{state} = "$dbt->{copri_conf}->{bike_state}->{$record->{$id}->{int10}}";
|
$return->{$id}->{state} = "$dbt->{copri_conf}->{bike_state}->{$record->{$id}->{int10}}";
|
||||||
|
$return->{$id}->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$record->{$id}->{int20}}";
|
||||||
$return->{$id}->{bike_charge} = "$record->{$id}->{int19}" if($record->{$id}->{int19});
|
$return->{$id}->{bike_charge} = "$record->{$id}->{int19}" if($record->{$id}->{int19});
|
||||||
$return->{$id}->{lock_state} = "locked" if($record->{$id}->{int20} == 1);
|
|
||||||
$return->{$id}->{lock_state} = "unlocked" if($record->{$id}->{int20} == 2);
|
#defaults
|
||||||
$return->{$id}->{lock_state} = "locking" if($record->{$id}->{int20} == 3);
|
$return->{$id}->{bike_group} = [];
|
||||||
$return->{$id}->{lock_state} = "unlocking" if($record->{$id}->{int20} == 4);
|
$return->{$id}->{bike_type}->{category} = "city";
|
||||||
#$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{main_id}"];
|
$return->{$id}->{bike_type}->{wheels} = "2";
|
||||||
|
|
||||||
#for station_type_id mapping
|
#for station_type_id mapping
|
||||||
if($record->{$id}->{type_id}){
|
if($record->{$id}->{type_id}){
|
||||||
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{type_id}"];
|
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{type_id}"];
|
||||||
}else{
|
if($record->{$id}->{type_id} == 300101){
|
||||||
$return->{$id}->{bike_group} = [];
|
$return->{$id}->{bike_type}->{category} = "cargo";
|
||||||
|
$return->{$id}->{bike_type}->{wheels} = "2";
|
||||||
|
$return->{$id}->{bike_type}->{wheels} = "3" if($record->{$id}->{txt01} =~ /drei|trike/i);
|
||||||
|
$return->{$id}->{bike_type}->{engine}->{manufacturer} = "dummy" if($record->{$id}->{txt01} =~ /E-/i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if($record->{$id}->{int11} eq "2"){
|
if($record->{$id}->{int11} eq "2"){
|
||||||
$return->{$id}->{system} = "Ilockit";
|
$return->{$id}->{system} = "Ilockit";
|
||||||
|
@ -2070,16 +2077,23 @@ sub bikes_all(){
|
||||||
|
|
||||||
$return->{$id}->{state} = "$dbt->{copri_conf}->{bike_state}->{$record->{$id}->{int10}}";
|
$return->{$id}->{state} = "$dbt->{copri_conf}->{bike_state}->{$record->{$id}->{int10}}";
|
||||||
$return->{$id}->{service_state} = "0";
|
$return->{$id}->{service_state} = "0";
|
||||||
$return->{$id}->{lock_state} = "locked" if($record->{$id}->{int20} == 1);
|
$return->{$id}->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$record->{$id}->{int20}}";
|
||||||
$return->{$id}->{lock_state} = "unlocked" if($record->{$id}->{int20} == 2);
|
|
||||||
$return->{$id}->{lock_state} = "locking" if($record->{$id}->{int20} == 3);
|
#defaults
|
||||||
$return->{$id}->{lock_state} = "unlocking" if($record->{$id}->{int20} == 4);
|
$return->{$id}->{bike_group} = [];
|
||||||
#for bike-station type_id mapping
|
$return->{$id}->{bike_type}->{category} = "city";
|
||||||
if($record->{$id}->{type_id}){
|
$return->{$id}->{bike_type}->{wheels} = "2";
|
||||||
|
|
||||||
|
#for station_type_id mapping
|
||||||
|
if($record->{$id}->{type_id}){
|
||||||
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{type_id}"];
|
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{type_id}"];
|
||||||
}else{
|
if($record->{$id}->{type_id} == 300101){
|
||||||
$return->{$id}->{bike_group} = [];
|
$return->{$id}->{bike_type}->{category} = "cargo";
|
||||||
}
|
$return->{$id}->{bike_type}->{wheels} = "2";
|
||||||
|
$return->{$id}->{bike_type}->{wheels} = "3" if($record->{$id}->{txt01} =~ /drei|trike/i);
|
||||||
|
$return->{$id}->{bike_type}->{engine}->{manufacturer} = "dummy" if($record->{$id}->{txt01} =~ /E-/i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($record->{$id}->{int11} eq "2"){
|
if($record->{$id}->{int11} eq "2"){
|
||||||
$return->{$id}->{system} = "Ilockit";
|
$return->{$id}->{system} = "Ilockit";
|
||||||
|
|
|
@ -295,6 +295,23 @@ sub fetch_rentalfeed {
|
||||||
#$return->{station} = "S3X$ctpos->{int04}";
|
#$return->{station} = "S3X$ctpos->{int04}";
|
||||||
}
|
}
|
||||||
$return->{state} = "$dbt->{copri_conf}->{bike_state}->{$ctpos->{int10}}" || "";
|
$return->{state} = "$dbt->{copri_conf}->{bike_state}->{$ctpos->{int10}}" || "";
|
||||||
|
$return->{lock_state} = "$dbt->{copri_conf}->{lock_state}->{$ctpos->{int20}}";
|
||||||
|
|
||||||
|
#defaults
|
||||||
|
$return->{bike_type}->{category} = "city";
|
||||||
|
$return->{bike_type}->{wheels} = "2";
|
||||||
|
|
||||||
|
#for station_type_id mapping
|
||||||
|
if($ctpos->{int29}){
|
||||||
|
if($ctpos->{int29} == 300101){
|
||||||
|
$return->{bike_type}->{category} = "cargo";
|
||||||
|
$return->{bike_type}->{wheels} = "2";
|
||||||
|
$return->{bike_type}->{wheels} = "3" if($ctpos->{txt01} =~ /drei|trike/i);
|
||||||
|
$return->{bike_type}->{engine}->{manufacturer} = "dummy" if($ctpos->{txt01} =~ /E-/i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$return->{Ilockit_ID} = "$ctpos->{txt18}" if($ctpos->{int11} == 2);
|
||||||
$return->{bike_charge} = "$ctpos->{int19}" if($ctpos->{int19});
|
$return->{bike_charge} = "$ctpos->{int19}" if($ctpos->{int19});
|
||||||
$return->{description} = "$ctpos->{txt01}";
|
$return->{description} = "$ctpos->{txt01}";
|
||||||
$return->{request_time} = "$ctpos->{itime}";
|
$return->{request_time} = "$ctpos->{itime}";
|
||||||
|
@ -304,10 +321,6 @@ sub fetch_rentalfeed {
|
||||||
if($ctpos->{int11}){
|
if($ctpos->{int11}){
|
||||||
($return->{gps}->{latitude},$return->{gps}->{longitude}) = split(/,/,$ctpos->{txt06});
|
($return->{gps}->{latitude},$return->{gps}->{longitude}) = split(/,/,$ctpos->{txt06});
|
||||||
|
|
||||||
#if($ctpos->{txt10} =~ /requested|occupied/)
|
|
||||||
#if($ctpos->{int10} == 2 || $ctpos->{int10} == 3){
|
|
||||||
#2022-04-26 disabled condition
|
|
||||||
if(1==1){
|
|
||||||
#deprecated
|
#deprecated
|
||||||
$return->{tariff_description}->{name} = "$ctpos->{txt04}";
|
$return->{tariff_description}->{name} = "$ctpos->{txt04}";
|
||||||
$return->{tariff_description}->{number} = "$ctpos->{int09}";
|
$return->{tariff_description}->{number} = "$ctpos->{int09}";
|
||||||
|
@ -347,13 +360,6 @@ sub fetch_rentalfeed {
|
||||||
}
|
}
|
||||||
}#end new rental_description
|
}#end new rental_description
|
||||||
|
|
||||||
$return->{Ilockit_ID} = "$ctpos->{txt18}" if($ctpos->{int11} == 2);
|
|
||||||
($return->{gps}->{latitude},$return->{gps}->{longitude}) = split(/,/,$ctpos->{txt06});
|
|
||||||
$return->{lock_state} = "locked" if($ctpos->{int20} == 1);
|
|
||||||
$return->{lock_state} = "unlocked" if($ctpos->{int20} == 2);
|
|
||||||
$return->{lock_state} = "locking" if($ctpos->{int20} == 3);
|
|
||||||
$return->{lock_state} = "unlocking" if($ctpos->{int20} == 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,9 @@ sub tpl(){
|
||||||
if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test" || $users_sharee->{txt08} eq "sigo\@sharee.bike")){
|
if($users_sharee->{c_id} && $R::sharee_edit ne "delete_account2" && ($users_sharee->{c_id} eq $varenv->{superu_id} || $dbt->{copri_conf}->{stage} eq "test" || $users_sharee->{txt08} eq "sigo\@sharee.bike")){
|
||||||
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
|
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
|
||||||
|
|
||||||
#my $api_test = "sharee_fr01"; my $bike="FR1538";
|
my $api_test = "sharee_fr01"; my $bike="FR1538";
|
||||||
#my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test
|
#my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test
|
||||||
my $api_test = "sharee_kn"; my $bike="KN205";
|
#my $api_test = "sharee_kn"; my $bike="KN205";
|
||||||
#my $api_test = "sharee_wue"; my $bike="WUE5525";
|
#my $api_test = "sharee_wue"; my $bike="WUE5525";
|
||||||
#my $api_test = "sharee_sx"; my $bike="S3X1001";
|
#my $api_test = "sharee_sx"; my $bike="S3X1001";
|
||||||
#my $api_test = "sharee_ren"; my $bike="REN2";
|
#my $api_test = "sharee_ren"; my $bike="REN2";
|
||||||
|
|
Loading…
Add table
Reference in a new issue