mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01:00
sig bike status refactor
This commit is contained in:
parent
31ecc83c1e
commit
68b58e0345
6 changed files with 36 additions and 15 deletions
|
@ -1197,9 +1197,7 @@ sub booking_update(){
|
|||
#my $ct_state = $state;
|
||||
my $ct_state = $record_pos->{int10};#2020-07-25 changed because ct_state cannot be canceled
|
||||
|
||||
#2020-09-24 requested will be all done by net_booking
|
||||
#6 = "canceled"|3 = "occupied"|1 = "available"
|
||||
#if($state && $state =~ /$dbt->{copri_conf}->{bike_state}->{6}|$dbt->{copri_conf}->{bike_state}->{3}|$dbt->{copri_conf}->{bike_state}->{1}/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0)
|
||||
if($state_key && ($state_key == 6 || $state_key == 3 || $state_key == 1) && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
|
||||
|
||||
#set rent state if lock_system 2=Ilockit || 3=sigo
|
||||
|
@ -1212,6 +1210,7 @@ sub booking_update(){
|
|||
|
||||
$update_pos->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
|
||||
$update_pos->{txt26} = $q->escapeHTML($user_agent) if($user_agent);
|
||||
$update_pos->{txt27} = $q->escapeHTML($q->param('app_debug')) if($q->param('app_debug'));
|
||||
|
||||
#if($state =~ /canceled/ && $record_pos->{txt10} =~ /requested/)
|
||||
if($state_key == 6 && $record_pos->{int10} == 2){
|
||||
|
@ -1467,6 +1466,7 @@ sub booking_update(){
|
|||
$update_pos->{int14} = $q->escapeHTML($q->param('voltage')) if($q->param('voltage'));
|
||||
$update_pos->{txt21} = $q->escapeHTML($q->param('user_device')) if($q->param('user_device'));
|
||||
$update_pos->{txt26} = $q->escapeHTML($user_agent) if($user_agent);
|
||||
$update_pos->{txt27} = $q->escapeHTML($q->param('app_debug')) if($q->param('app_debug'));
|
||||
|
||||
my $lock_value = 0;
|
||||
if($lock_state eq "locked"){
|
||||
|
|
|
@ -466,12 +466,18 @@ elsif($q->param('request') eq "bikes_available"){
|
|||
$bw->log("Y bikes_available by c_id $authraw->{c_id}, Tarif:",$authraw->{txt30},"");
|
||||
|
||||
#sig first save
|
||||
#if($varenv{syshost} eq "shareeapp-sx"){
|
||||
# (my $response_bikes_disabled,my $return2copri->{bikes}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
# $tk->sigbike_cupdate($return2copri->{bikes});
|
||||
#}
|
||||
#$response->{bikes} = $apif->bikes_available($q,\%varenv,$authraw);
|
||||
if($varenv{syshost} eq "shareeapp-sx"){
|
||||
(my $response_bikes_disabled,my $return2copri->{bikes}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
($response->{bikes},my $return2copri->{bikes}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
$tk->sigbike_cupdate($return2copri->{bikes});
|
||||
}
|
||||
}else{
|
||||
$response->{bikes} = $apif->bikes_available($q,\%varenv,$authraw);
|
||||
}
|
||||
}
|
||||
if(ref($response->{bikes}) ne "HASH"){
|
||||
$response->{response_state} = "Failure 5003: cannot find any user defined bike tariff";
|
||||
$response->{response_text} = "Abbruch, es konnte kein gültiger Tarif gefunden werden";
|
||||
|
@ -674,12 +680,19 @@ elsif($q->param('request') eq "stations_available"){
|
|||
$response = { %$response, %$auth };
|
||||
|
||||
#sig first save
|
||||
#if($varenv{syshost} eq "shareeapp-sx"){
|
||||
# (my $response_stations_disabled,my $return2copri->{stations}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
# $tk->sigstation_cupdate($return2copri->{stations});
|
||||
#}
|
||||
#($response->{stations}, my $response_raw) = $apif->stations_available($q,\%varenv,$authraw,"");
|
||||
if($varenv{syshost} eq "shareeapp-sx"){
|
||||
(my $response_stations_disabled,my $return2copri->{stations}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
($response->{stations},my $return2copri->{stations}) = $si->sig_available($q,\%varenv,$authraw);
|
||||
$tk->sigstation_cupdate($return2copri->{stations});
|
||||
}
|
||||
}else{
|
||||
($response->{stations}, my $response_raw) = $apif->stations_available($q,\%varenv,$authraw,"");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#user_feedback / user_minianswer of user_miniquery
|
||||
|
|
|
@ -192,8 +192,10 @@ sub sig_available {
|
|||
$response_out->{$bike}->{description} = "E-Lastenrad";
|
||||
$response_out->{$bike}->{gps}->{latitude} = "$resp->{state}->{lat}" || "";
|
||||
$response_out->{$bike}->{gps}->{longitude} = "$resp->{state}->{lon}" || "";
|
||||
$response_out->{$bike}->{state} = "defect";
|
||||
$response_out->{$bike}->{lock_state} = "locked";
|
||||
|
||||
$response_out->{$bike}->{state} = "defect";
|
||||
if($resp->{status} && $resp->{status} =~ /ACTIVE|PRIVATE/i){
|
||||
if(uc($resp->{reservation_state}) eq "RESERVED"){
|
||||
$response_out->{$bike}->{state} = "requested";
|
||||
}elsif(uc($resp->{reservation_state}) eq "ACTIVE-RENTAL"){
|
||||
|
@ -202,8 +204,7 @@ sub sig_available {
|
|||
}elsif(!$resp->{reservation_state}){
|
||||
$response_out->{$bike}->{state} = "available";
|
||||
}
|
||||
|
||||
if($resp->{status} && $resp->{status} eq "MAINTENANCE"){
|
||||
}elsif($resp->{status} && $resp->{status} eq "MAINTENANCE"){
|
||||
$response_out->{$bike}->{state} = "maintenance";
|
||||
}
|
||||
|
||||
|
|
|
@ -705,6 +705,12 @@ sub fetch_record(){
|
|||
$where .= " and ct.$key $op $value";
|
||||
}
|
||||
}
|
||||
if($key =~ /^(type_id)$/){
|
||||
if(looks_like_number($value)){
|
||||
$where .= " and nd.$key $op $value";
|
||||
}
|
||||
}
|
||||
|
||||
if($varenv{systype} && $varenv{systype} eq "azn" && $key =~ /start_time|end_time/){
|
||||
if($key =~ /start_time/){
|
||||
$where .= " and (ct.end_time >= '$fetch->{start_time}' AND ct.start_time <= '$fetch->{end_time}')";
|
||||
|
|
1
copri4/main/src/scripts/statistik_dailystation.pl
Symbolic link
1
copri4/main/src/scripts/statistik_dailystation.pl
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../../sharee.bike/copri-bike/main/src/scripts/statistik_dailystation.pl
|
|
@ -43,11 +43,11 @@ sub tpl(){
|
|||
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
|
||||
|
||||
#my $api_test = "sharee_fr01"; my $bike="FR1538";
|
||||
#my $api_test = "sharee_fr01"; my $bike="FR1005";#E-Lastenrad (bike_group=300101, bike_node=300102)
|
||||
my $api_test = "sharee_fr01"; my $bike="FR1005";#E-Lastenrad (bike_group=300101, bike_node=300102)
|
||||
#my $api_test = "sharee_fr01"; my $bike="FR4781";#Tracking and BVB test
|
||||
#my $api_test = "sharee_kn"; my $bike="KN1011";
|
||||
#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";
|
||||
|
||||
print $q->div({-style=>'float:right;text-align:right;height:25px;padding:6px 15px;background-color:white'},$q->a({-style=>"background-color:#ffffff;color:#$bgcolor1;", -href=>"$varenv->{metahost}/src/scripts/tests/index.pl?sessionid=$coo\&api_test=$api_test\&bike=$bike", -target=>'_blank'}," [ tests --> $api_test ] "),"$users_sharee->{txt08}",$q->a({-style=>"color:#$bgcolor1;", -href=>"logout_sharee$session"},"logout")),"\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue