mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-11 22:37:27 +02:00
enhance booking_update logging
This commit is contained in:
parent
0857601751
commit
7dcf48db2c
3 changed files with 24 additions and 22 deletions
|
@ -1153,26 +1153,30 @@ sub booking_update(){
|
|||
$gps_data->{longitude} = $1 if($longitude_in =~ /(\d+\.\d+)/);
|
||||
$gps_data->{gps} = "$gps_data->{latitude},$gps_data->{longitude}" if($gps_data->{latitude} && $gps_data->{longitude});
|
||||
}
|
||||
|
||||
my $gps_age = 0;
|
||||
$gps_age = $1 if($q->param('gps_age') && $q->param('gps_age') =~ /^(\d+)/);#in milisec
|
||||
$gps_data->{gps_age_minutes} = $gps_age / 1000 / 60 if($gps_age);
|
||||
$gps_data->{gps_accuracy} = $1 if($q->param('gps_accuracy') && $q->param('gps_accuracy') =~ /^(\d+)/);#in meters
|
||||
|
||||
my $update_pos = {
|
||||
table => "contenttranspos",
|
||||
mtime => "now()",
|
||||
};
|
||||
|
||||
my $logging = "log booking_update bike:$bike, state:$state, lock_state:$lock_state, userID:$auth->{c_id}, gps:$gps_data->{gps}";
|
||||
my $lock_charge = $q->param('voltage') || "";
|
||||
my $gps_age_minutes = "";
|
||||
$gps_age_minutes = $gps_data->{gps_age_minutes} if($q->param('gps_age'));
|
||||
my $logging = "log booking_update bike:$bike, userID:$auth->{c_id}, state:$state, lock_state:$lock_state, lock_charge:$lock_charge, gps:$gps_data->{gps}, gps_age_minutes:$gps_age_minutes";
|
||||
$bw->log("$logging",$auth->{c_id},"");
|
||||
$update_pos->{txt24} = $record_pos->{txt24} . "\n$logging";
|
||||
my $log_stamp = strftime "%d.%m.%Y %H:%M:%S", localtime;
|
||||
$update_pos->{txt24} = $record_pos->{txt24} . "\n- $log_stamp $logging";
|
||||
$dbt->update_record($dbh,$update_pos,$record_pos);
|
||||
|
||||
my $Ilockit_GUID = "";
|
||||
$Ilockit_GUID = $q->escapeHTML($q->param('Ilockit_GUID')) if($q->param('Ilockit_GUID') && $q->param('Ilockit_GUID') =~ /\w+-\w+-\w+-\w+$/);
|
||||
#$update_pos->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
||||
$update_cc->{txt17} = $Ilockit_GUID if($Ilockit_GUID);
|
||||
|
||||
my $gps_age = 0;
|
||||
$gps_age = $1 if($q->param('gps_age') =~ /^(\d+)/);#in milisec
|
||||
$gps_data->{gps_age_minutes} = $gps_age / 1000 / 60 if($gps_age);
|
||||
$gps_data->{gps_accuracy} = $1 if($q->param('gps_accuracy') =~ /^(\d+)/);#in meters
|
||||
|
||||
|
||||
#2022-10-02 manage lock_state before state
|
||||
if($lock_state && $lock_state =~ /locking|locked|unlocking|unlocked/ && $record_pos->{cc_id} && $record_pos->{cc_id} > 0){
|
||||
$booking_values = $self->smartlock($q,$varenv,$auth,$owner,$record_pos,$record_cc,$gps_data,$booking_values);
|
||||
|
@ -1183,7 +1187,7 @@ sub booking_update(){
|
|||
};
|
||||
$record_pos = $dbt->fetch_tablerecord($dbh,$booking_pos);
|
||||
my $if_gps = $gps_data->{gps} || "";
|
||||
$bw->log("smartlock lock_state $bike $lock_state | int10 $record_pos->{int10} | int20 $record_pos->{int20} | if_gps $if_gps",$booking_values,"");
|
||||
$bw->log("log smartlock lock_state $bike $lock_state | int10 $record_pos->{int10} | int20 $record_pos->{int20} | if_gps $if_gps",$booking_values,"");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
|||
$response = {%$response, %$booking_values};
|
||||
|
||||
}
|
||||
elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || ($q->param('lock_state') && $q->param('lock_state') =~ /locking|locked|unlocking|unlocked/))){
|
||||
elsif($q->param('request') eq "booking_update" && (($q->param('state') && $q->param('state') =~ /occupied|available/) || $q->param('lock_state'))){
|
||||
my $booking_values = {};
|
||||
|
||||
#update on sig
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue