24h SMS update marker

This commit is contained in:
Rainer Gümpelein 2022-03-15 13:05:21 +01:00
parent df954371f2
commit b7de896e71
3 changed files with 24 additions and 11 deletions

View file

@ -1477,7 +1477,7 @@ sub bikes_available(){
$return->{$id}->{Ilockit_GUID} = "$record->{$id}->{txt17}"; $return->{$id}->{Ilockit_GUID} = "$record->{$id}->{txt17}";
$return->{$id}->{Ilockit_ID} = "$record->{$id}->{txt18}"; $return->{$id}->{Ilockit_ID} = "$record->{$id}->{txt18}";
$return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{main_id}"]; $return->{$id}->{bike_group} = ["$dbt->{operator}->{$varenv->{dbname}}->{oprefix}$record->{$id}->{main_id}"];
#if($users_serviceapp->{int09}){ #if($users_serviceapp->{int09})
#shareetool #shareetool
if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} == 187 && scalar(@{$user_tour} >= 1)){ if($q->param('authcookie') && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} && $dbt->{merchant_ids}->{$varenv->{merchant_id}}->{id} == 187 && scalar(@{$user_tour} >= 1)){
my @service_code = split(/\s/,$record->{$id}->{txt23}); my @service_code = split(/\s/,$record->{$id}->{txt23});

View file

@ -44,6 +44,7 @@ my $response_in = {};
my $dbh = ""; my $dbh = "";
my $owner = 181; my $owner = 181;
#used for sending smsAck codes to user
sub sms_ack_digest { sub sms_ack_digest {
my $self = shift; my $self = shift;
my $ctadr = shift; my $ctadr = shift;
@ -99,7 +100,7 @@ sub sms_ack_digest {
return $ret_json; return $ret_json;
} }
#used for sending message if lock_state=locking and after 45 sec no lock_state=locked #used for sending message to user
sub sms_message { sub sms_message {
my $self = shift; my $self = shift;
my $todo = shift; my $todo = shift;

View file

@ -58,6 +58,9 @@ if($todo eq "24h_occupied"){
int10 => 3, int10 => 3,
start_time_interval => "(now() - interval '1 day')", start_time_interval => "(now() - interval '1 day')",
}; };
my $update_pos = {
table => "contenttranspos",
};
my $dt1 = DateTime->now(time_zone => "Europe/Berlin"); my $dt1 = DateTime->now(time_zone => "Europe/Berlin");
@ -76,17 +79,26 @@ if($todo eq "24h_occupied"){
#print $dt1 . ">=" . $dt2_72h_occupied . "|" . $dt1 . ">=" . $dt2_48h_occupied . "|" . $dt1 . ">=" . $dt2_24h_occupied . "\n"; #print $dt1 . ">=" . $dt2_72h_occupied . "|" . $dt1 . ">=" . $dt2_48h_occupied . "|" . $dt1 . ">=" . $dt2_24h_occupied . "\n";
if($dt2){ if($dt2){
if($dt1 >= $dt2_72h_occupied){ if($dt1 >= $dt2_72h_occupied){
if($cttpos->{$pid}->{int33} != 3){
$todo = "72h_occupied"; $todo = "72h_occupied";
$smstrans->sms_message($dt1 >= $dt2_72h_occupied,$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name});
print $dt1 . ">=" . $dt2_72h_occupied . "|$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}\n"; print $dt1 . ">=" . $dt2_72h_occupied . "|$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}\n";
$smstrans->sms_message($todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name});
$dbt->update_one($dbh,$update_pos,"int33=3",$cttpos->{$pid}->{c_id});
}
}elsif($dt1 >= $dt2_48h_occupied){ }elsif($dt1 >= $dt2_48h_occupied){
if($cttpos->{$pid}->{int33} != 2){
$todo = "48h_occupied"; $todo = "48h_occupied";
$smstrans->sms_message($todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name});
print $dt1 . ">=" . $dt2_48h_occupied . "|$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}\n"; print $dt1 . ">=" . $dt2_48h_occupied . "|$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}\n";
}elsif($dt1 >= $dt2_24h_occupied){
$todo = "24h_occupied";
$smstrans->sms_message($todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}); $smstrans->sms_message($todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name});
$dbt->update_one($dbh,$update_pos,"int33=2",$cttpos->{$pid}->{c_id});
}
}elsif($dt1 >= $dt2_24h_occupied){
if($cttpos->{$pid}->{int33} != 1){
$todo = "24h_occupied";
print $dt1 . ">=" . $dt2_24h_occupied . "|$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}\n"; print $dt1 . ">=" . $dt2_24h_occupied . "|$todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name}\n";
$smstrans->sms_message($todo,$hotline,$cttpos->{$pid}->{phone},$cttpos->{$pid}->{ct_name});
$dbt->update_one($dbh,$update_pos,"int33=1",$cttpos->{$pid}->{c_id});
}
} }
} }
sleep 1; sleep 1;