Browse code

adaugat timestamp in tabela get433info

Liviu Pislaru authored on 15/09/2018 21:33:00
Showing 1 changed files
... ...
@@ -108,7 +108,7 @@ while (my $mqttMessage = <$SUB> ) {
108 108
       if ($queue eq "RESULT"){ # topic nou sonoff v6.2.1 sonoff bridge
109 109
         my $decoded = decode_json($json);
110 110
         if (exists $decoded->{'RfReceived'}{'Data'}){
111
-          addRF ($topic, $decoded->{'RfReceived'}{'Sync'}, $decoded->{'RfReceived'}{'Low'}, $decoded->{'RfReceived'}{'High'}, $decoded->{'RfReceived'}{'Data'});
111
+          addRF ($topic, $decoded->{'RfReceived'}{'Sync'}, $decoded->{'RfReceived'}{'Low'}, $decoded->{'RfReceived'}{'High'}, $decoded->{'RfReceived'}{'Data'}, "now()");
112 112
           my $script="php /admin/scripts/mqttparser/rf433.php $topic $decoded->{'RfReceived'}{'Data'}";
113 113
           runSCRIPT ($script);
114 114
         }
... ...
@@ -242,9 +242,9 @@ sub delDB {
242 242
 sub addRF {
243 243
   (my $topic, my $sync, my $low, my $high, my $data) = @_;
244 244
   (my $user, my $devid) = split /\-/, $topic;
245
-  my $query = "insert into get433info values (?, ?, ?, ?, ?, ?) on duplicate key update data=?";
245
+  my $query = "insert into get433info values (?, ?, ?, ?, ?, ?, ?) on duplicate key update log=?";
246 246
   my $sth = $dbh->prepare($query) or die "Can't prepare $query: $dbh->errstr\n";
247
-  $sth->execute("$user", "$devid", "$sync", "$low", "$high", "$data", "$data");
247
+  $sth->execute("$user", "$devid", "$sync", "$low", "$high", "$data", "now()" ,"now()");
248 248
   $sth->finish();
249 249
   return;
250 250
 }