mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-13 15:16:38 +02:00
service set battery charge
This commit is contained in:
parent
5cfcdb82f7
commit
14d1891695
3 changed files with 42 additions and 9 deletions
|
@ -780,7 +780,7 @@ elsif($q->param('request') eq "service_done"){
|
|||
$rows = $apif->service_update($q,$authraw,$node_template,$service_id);
|
||||
$response->{response_state} = "OK" if($rows > 0);
|
||||
$response->{response_text} = "OK, service_update" if($rows > 0);
|
||||
}
|
||||
}
|
||||
|
||||
#UPDATE bike content state
|
||||
if($q->param('work_id') eq "state" && looks_like_number($bike_id) && $q->param('work_val') =~ /available|maintenance|defect/){
|
||||
|
@ -793,16 +793,43 @@ elsif($q->param('request') eq "service_done"){
|
|||
$response->{response_text} = "OK, bikestate_update to state=$value";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#UPDATE bike battery charge
|
||||
if($q->param('work_id') =~ /smartlock_battery_charge|bike_battery_charge/ && looks_like_number($bike_id) && looks_like_number($q->param('work_val'))){
|
||||
#once again to get node_record template
|
||||
($xresponse->{$article}, $responseraw, $node_template, $crecord) = $apif->service_select($q,$authraw,"","1");
|
||||
my ($bikes_all,$bikes_allraw,$bikes_on_station) = $apif->bikes_all($q,\%varenv,$authraw,"");
|
||||
|
||||
if($q->param('work_id') eq "smartlock_battery_charge"){
|
||||
my $update_hash = { int14 => $q->param('work_val') };
|
||||
$rows = $apif->bikestate_update($authraw,$responseraw->{$service_id}->{cc_id},"",$update_hash);
|
||||
$response->{response_state} = "OK";
|
||||
$response->{response_text} = "OK, bikestate_update " . $q->param('work_id') . " to " . $q->param('work_val');
|
||||
#add-on to log
|
||||
my $action = "txt11=" . $bikes_allraw->{$bike_id}->{int14} . " - " . $q->param('work_val');
|
||||
$apif->service_update($q,$authraw,$node_template,$service_id,$action);
|
||||
}
|
||||
if($q->param('work_id') eq "bike_battery_charge"){
|
||||
my $update_hash = { int19 => $q->param('work_val') };
|
||||
$rows = $apif->bikestate_update($authraw,$responseraw->{$service_id}->{cc_id},"",$update_hash);
|
||||
$response->{response_state} = "OK";
|
||||
$response->{response_text} = "OK, bikestate_update " . $q->param('work_id') . " to " . $q->param('work_val');
|
||||
#add-on to log
|
||||
my $action = "txt12=" . $bikes_allraw->{$bike_id}->{int19} . " - " . $q->param('work_val');
|
||||
$apif->service_update($q,$authraw,$node_template,$service_id,$action);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#redistribution
|
||||
if(($q->param('work_id') eq "int04" || $q->param('work_id') eq "station") && looks_like_number($bike_id) && ($q->param('work_val') || looks_like_number($q->param('work_val')))){
|
||||
$q->param(-name=>'work_id',-value=>"int04") if($q->param('work_id') eq "station");#station db-field is int04
|
||||
my $to_station_id = $1 if($q->param('work_val') =~ /(\d+)/);
|
||||
my ($bikes_all,$bikes_allraw,$bikes_on_station) = $apif->bikes_all($q,\%varenv,$authraw,"");
|
||||
|
||||
#add-on to log redistribute#TODO dedicated db-fieled
|
||||
my $action = "txt10=" . $oprefix . $bikes_allraw->{$bike_id}->{int04} . " - " . $q->param('work_val');
|
||||
|
||||
#add-on to log redistribute
|
||||
my $action = "txt10=" . $bikes_allraw->{$bike_id}->{int04} . " - " . $q->param('work_val');
|
||||
$apif->service_update($q,$authraw,$node_template,$service_id,$action);
|
||||
|
||||
my ($stations_all,$stations_allraw) = $apif->stations_all($q,\%varenv,$bikes_on_station,$authraw);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue