mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-23 04:06:27 +01:00
sig minor changes
This commit is contained in:
parent
b959c0b2c0
commit
a0872ed063
6 changed files with 66 additions and 55 deletions
|
@ -171,6 +171,7 @@ div#Oline {
|
||||||
font-size:16px;
|
font-size:16px;
|
||||||
line-height:2.0;
|
line-height:2.0;
|
||||||
max-width:750px;
|
max-width:750px;
|
||||||
|
padding:0.2em 0;
|
||||||
text-align:left;
|
text-align:left;
|
||||||
}
|
}
|
||||||
.content_float2 {
|
.content_float2 {
|
||||||
|
|
|
@ -1699,7 +1699,12 @@ sub rentals(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#sig update station_lock_state=locked to cancel once miniquery
|
#sig update station_lock_state=locked to cancel once miniquery
|
||||||
elsif($record->{$id}->{int11} && $record->{$id}->{int11} == 3 && $record->{$id}->{int28} && $record->{$id}->{int28} == 3){
|
elsif($record->{$id}->{int11} && $record->{$id}->{int11} == 3){
|
||||||
|
|
||||||
|
#$return->{state} = "requested";#used once in App after sig rental-end push-notify
|
||||||
|
$return->{$id}->{rentalId} = "$record->{$id}->{txt11}";
|
||||||
|
|
||||||
|
if($record->{$id}->{int28} && $record->{$id}->{int28} == 3){
|
||||||
|
|
||||||
#only for project=Bayern and developer enabled
|
#only for project=Bayern and developer enabled
|
||||||
if(($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $auth->{int23} < 4) || ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 11765 || $auth->{c_id} == 1843 || $auth->{c_id} == 38883)){
|
if(($dbt->{operator}->{$varenv{dbname}}->{project} eq "Bayern" && $auth->{int23} < 4) || ($auth->{c_id} == 1842 || $auth->{c_id} == 5781 || $auth->{c_id} == 11765 || $auth->{c_id} == 1843 || $auth->{c_id} == 38883)){
|
||||||
|
@ -1722,6 +1727,7 @@ sub rentals(){
|
||||||
|
|
||||||
#there seems some methodes which needs state, thats because disabled
|
#there seems some methodes which needs state, thats because disabled
|
||||||
#$return->{state} = "requested";#used once in App after sig rental-end push-notify
|
#$return->{state} = "requested";#used once in App after sig rental-end push-notify
|
||||||
|
$return->{$id}->{rentalId} = "$record->{$id}->{txt11}";
|
||||||
|
|
||||||
my $update_pos = {
|
my $update_pos = {
|
||||||
table => "contenttranspos",
|
table => "contenttranspos",
|
||||||
|
@ -1732,6 +1738,7 @@ sub rentals(){
|
||||||
$bw->log("sig update int28 station_lock_state=locked to cancel once miniquery",$update_pos,"");
|
$bw->log("sig update int28 station_lock_state=locked to cancel once miniquery",$update_pos,"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}#end rentals
|
}#end rentals
|
||||||
|
|
|
@ -264,7 +264,9 @@ elsif($q->param('request') eq "booking_request"){
|
||||||
if($ct_bike->{int11} == 3){
|
if($ct_bike->{int11} == 3){
|
||||||
$sig_book = $si->sig_booking(\%varenv,"reserve",$authraw,$ct_bike,"");
|
$sig_book = $si->sig_booking(\%varenv,"reserve",$authraw,$ct_bike,"");
|
||||||
$sig_book->{bikeId} = "$ct_bike->{txt22}";
|
$sig_book->{bikeId} = "$ct_bike->{txt22}";
|
||||||
$sig_book->{reservationId} = "$R::reservationId" if($R::reservationId);#only for cmd tests
|
#we only need rentalId because of reserve/end uses rentalId
|
||||||
|
#$sig_book->{reservationId} = "$R::reservationId" if($R::reservationId);#only for cmd tests
|
||||||
|
$sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests
|
||||||
}
|
}
|
||||||
$response_book = $apif->booking_request($q,\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$sig_book);
|
$response_book = $apif->booking_request($q,\%varenv,$authraw,$bike,$ct_bike,$ct_tariff,$aowner,$gps,$sig_book);
|
||||||
}elsif(!$ct_tariff->{barcode}){
|
}elsif(!$ct_tariff->{barcode}){
|
||||||
|
@ -361,9 +363,6 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
|
||||||
my $booking_values = {};
|
my $booking_values = {};
|
||||||
|
|
||||||
if($ctpos->{int11} == 3){
|
if($ctpos->{int11} == 3){
|
||||||
#this sig request is still not defined
|
|
||||||
#$response->{response_state} = "Failure: sig bike reservation can not be canceled on sig";
|
|
||||||
#$response->{response_text} = "Abbruch, die Reservierung kann nicht storniert werden";
|
|
||||||
$sig_book = $si->sig_booking(\%varenv,"reserve_end",$authraw,"",$ctpos);
|
$sig_book = $si->sig_booking(\%varenv,"reserve_end",$authraw,"",$ctpos);
|
||||||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
|
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -176,21 +176,16 @@ sub sig_available {
|
||||||
$response_out->{$bike}->{gps}->{longitude} = "$resp->{state}->{lon}" || "";
|
$response_out->{$bike}->{gps}->{longitude} = "$resp->{state}->{lon}" || "";
|
||||||
$response_out->{$bike}->{bike_charge} = "$resp->{energy_level}" || "0";
|
$response_out->{$bike}->{bike_charge} = "$resp->{energy_level}" || "0";
|
||||||
$response_out->{$bike}->{state} = "defect";
|
$response_out->{$bike}->{state} = "defect";
|
||||||
|
$response_out->{$bike}->{lock_state} = "locked";
|
||||||
if(uc($resp->{reservation_state}) eq "RESERVED"){
|
if(uc($resp->{reservation_state}) eq "RESERVED"){
|
||||||
$response_out->{$bike}->{state} = "requested";
|
$response_out->{$bike}->{state} = "requested";
|
||||||
}elsif(uc($resp->{reservation_state}) eq "ACTIVE-RENTAL"){
|
}elsif(uc($resp->{reservation_state}) eq "ACTIVE-RENTAL"){
|
||||||
|
$response_out->{$bike}->{lock_state} = "unlocked";
|
||||||
$response_out->{$bike}->{state} = "occupied";
|
$response_out->{$bike}->{state} = "occupied";
|
||||||
}elsif(!$resp->{reservation_state}){
|
}elsif(!$resp->{reservation_state}){
|
||||||
$response_out->{$bike}->{state} = "available";
|
$response_out->{$bike}->{state} = "available";
|
||||||
}
|
}
|
||||||
|
|
||||||
#1. change can take up to 2 mins to reflect
|
|
||||||
#2. When a customer will start a reservation, it will always be unlock,
|
|
||||||
#Sigo software automatically handle this condition
|
|
||||||
$response_out->{$bike}->{lock_state} = "unlocked";
|
|
||||||
if($resp->{lock}->{status} eq "locked"){
|
|
||||||
$response_out->{$bike}->{lock_state} = "locked";
|
|
||||||
}
|
|
||||||
$response_out->{$bike}->{system} = "sigo";
|
$response_out->{$bike}->{system} = "sigo";
|
||||||
$response_out->{$bike}->{bike_group} = ["SX300102"];#E-Lastenrad
|
$response_out->{$bike}->{bike_group} = ["SX300102"];#E-Lastenrad
|
||||||
$response_out->{$bike}->{unlock_allowed} = "1";
|
$response_out->{$bike}->{unlock_allowed} = "1";
|
||||||
|
@ -305,9 +300,9 @@ sub sig_booking {
|
||||||
#reservation end, this sig request is still not defined. maybe end by rentalId
|
#reservation end, this sig request is still not defined. maybe end by rentalId
|
||||||
#int10 state will be set on booking_request
|
#int10 state will be set on booking_request
|
||||||
elsif($todo eq "reserve_end"){
|
elsif($todo eq "reserve_end"){
|
||||||
$endpoint .= "reserve/end";
|
$endpoint .= "bikes/reserve/end";
|
||||||
%json = (
|
%json = (
|
||||||
reservationId => "$ctpos->{txt10}",
|
rentalId => "$ctpos->{txt11}",
|
||||||
email => "$ctadr->{txt08}"
|
email => "$ctadr->{txt08}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -315,8 +310,8 @@ sub sig_booking {
|
||||||
#int10 state will be set on main booking_update
|
#int10 state will be set on main booking_update
|
||||||
elsif($todo eq "rental"){
|
elsif($todo eq "rental"){
|
||||||
$endpoint .= "rental";
|
$endpoint .= "rental";
|
||||||
#my $sig_bikeId = $ctpos->{txt22} || $ct_bike->{txt22};
|
my $sig_bikeId = $ctpos->{txt22} || $ct_bike->{txt22};
|
||||||
my $sig_bikeId = "380116b5-0522-43da-ab66-477744a731a3";
|
#my $sig_bikeId = "380116b5-0522-43da-ab66-477744a731a3";
|
||||||
%json = (
|
%json = (
|
||||||
bikeId => "$sig_bikeId",
|
bikeId => "$sig_bikeId",
|
||||||
email => "$ctadr->{txt08}"
|
email => "$ctadr->{txt08}"
|
||||||
|
@ -386,25 +381,31 @@ sub sig_booking {
|
||||||
owner => "169",
|
owner => "169",
|
||||||
};
|
};
|
||||||
|
|
||||||
#TODO try it with user_bikes_available
|
#reservation and rental will return only on success! "rentalId"
|
||||||
#on sig api states maybe not just in time available
|
if($sig_book->{rentalId}){
|
||||||
#check and save sig bike states
|
$update_pos->{txt11} = "$sig_book->{rentalId}";
|
||||||
#$q->param(-name=>'request',-value=>"bikes_available");
|
}
|
||||||
#(my $response->{bikes},my $return2copri) = $self->sig_available($q,$varenv,$ctadr);
|
#without rentalId, bike will be available and unlocked!
|
||||||
#my $ctrows = 0;
|
elsif(($todo eq "reserve" || $todo eq "rental") && !$sig_book->{rentalId}){
|
||||||
#$ctrows = $tk->sigbike_cupdate($return2copri);
|
$update_pos->{int10} = 1;
|
||||||
#print FILE "<--- ctrows:$ctrows, update content state with:" . Dumper($return2copri) . "\n";
|
$update_pos->{int20} = 1;
|
||||||
|
|
||||||
#foreach my $sid (keys (%{$return2copri})){
|
#if($ct_bike->{c_id}){
|
||||||
# $update_pos->{int10} = "$return2copri->{$sid}->{int10}" if($return2copri->{$sid}->{int10});
|
my $update_content = {
|
||||||
# $update_pos->{int20} = "$return2copri->{$sid}->{int20}" if($return2copri->{$sid}->{int20});
|
table => "content",
|
||||||
|
mtime => "now()",
|
||||||
|
owner => "169",
|
||||||
|
int10 => 1,
|
||||||
|
int20 => 1,
|
||||||
|
c_id => $ctpos->{cc_id},
|
||||||
|
};
|
||||||
|
$rows = $dbt->update_record($dbh,$update_content,$update_content);
|
||||||
|
print FILE "<--- rows: $rows, update_content: $ctpos->{cc_id}, with:" . Dumper($update_content) . "\n";
|
||||||
#}
|
#}
|
||||||
|
}
|
||||||
$update_pos->{txt10} = "$sig_book->{reservationId}" if($sig_book->{reservationId});
|
#$update_pos->{txt10} = "$sig_book->{reservationId}" if($sig_book->{reservationId});#never used
|
||||||
$update_pos->{txt11} = "$sig_book->{rentalId}" if($sig_book->{rentalId});
|
|
||||||
$update_pos->{txt25} = "$ctpos->{txt25}\n$sig_book->{return_state}";# if($sig_book->{return_state});
|
$update_pos->{txt25} = "$ctpos->{txt25}\n$sig_book->{return_state}";# if($sig_book->{return_state});
|
||||||
$rows = $dbt->update_record($dbh,$update_pos,$ctpos);
|
$rows = $dbt->update_record($dbh,$update_pos,$ctpos);
|
||||||
|
|
||||||
print FILE "<--- rows: $rows, update_pos: $ctpos->{c_id}, with:" . Dumper($update_pos) . "\n";
|
print FILE "<--- rows: $rows, update_pos: $ctpos->{c_id}, with:" . Dumper($update_pos) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -647,7 +647,7 @@ sub collect_post(){
|
||||||
$sth = $dbh->prepare($sql);
|
$sth = $dbh->prepare($sql);
|
||||||
}else{
|
}else{
|
||||||
#rental pos with capture booking ct.state
|
#rental pos with capture booking ct.state
|
||||||
$sql = "SELECT cp.*, ct.state FROM $fetch->{table_pos} cp, $fetch->{table} ct WHERE $cp_where and $poscid IN (SELECT ct.c_id FROM relation rel, $fetch->{table} ct WHERE rel.content_id=ct.c_id and $ct_where) order by cp.mtime ASC";#mtime aufsteigend get last (newest) entry
|
$sql = "SELECT cp.*, ct.state FROM $fetch->{table_pos} cp, $fetch->{table} ct WHERE $cp_where and cp.ct_id=ct.c_id and $poscid IN (SELECT ct.c_id FROM relation rel, $fetch->{table} ct WHERE rel.content_id=ct.c_id and $ct_where) order by cp.mtime ASC";#mtime aufsteigend get last (newest) entry
|
||||||
$sth = $dbh->prepare($sql);
|
$sth = $dbh->prepare($sql);
|
||||||
}
|
}
|
||||||
$bw->log("DBtank collect_post $source",$sql,"") if($debug);
|
$bw->log("DBtank collect_post $source",$sql,"") if($debug);
|
||||||
|
@ -1375,7 +1375,7 @@ sub insert_pos(){
|
||||||
my $sth;
|
my $sth;
|
||||||
#Verleihräder
|
#Verleihräder
|
||||||
if($ct->{template_id} && $ct->{template_id} == 205){#Leihrad_list
|
if($ct->{template_id} && $ct->{template_id} == 205){#Leihrad_list
|
||||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt01,txt08,txt02,txt09,txt12,itime,start_time,end_time,int02,int03,int06,int04,txt05,txt06,txt07,int10,int12,int13,owner,int07,txt04,int09,int17,int15,int16,int11,int18,int19,txt17,txt18,int20,int25,int34,txt22,txt10,int35,int36,int37,time01,time02) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$ct->{txt01}','$user_name','$ct->{txt02}','$ctadr->{txt09}','$prefix',now(),now(),'$endRental','$unit_price','$menge','$station','$station','$ct->{txt06}','$ct->{txt06}','$ct->{txt07}','$status','$from_main_id','$deviceId','$owner','$rabatt','$tariff_desc','$tariff_nr','$daymax_price','$abo_price','$free_hours','$ct->{int11}','$sharing_type','$bike_charge','$ct->{txt17}','$ct->{txt18}','$ct->{int20}','$trackon','$staff','$sig_book->{bikeId}','$sig_book->{reservationId}','$unit_price1','$unit_price2','$start_price','$unit_time','$free_time') RETURNING c_id");
|
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt01,txt08,txt02,txt09,txt12,itime,start_time,end_time,int02,int03,int06,int04,txt05,txt06,txt07,int10,int12,int13,owner,int07,txt04,int09,int17,int15,int16,int11,int18,int19,txt17,txt18,int20,int25,int34,txt22,txt10,txt11,int35,int36,int37,time01,time02) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','$ct->{barcode}','$ct->{txt01}','$user_name','$ct->{txt02}','$ctadr->{txt09}','$prefix',now(),now(),'$endRental','$unit_price','$menge','$station','$station','$ct->{txt06}','$ct->{txt06}','$ct->{txt07}','$status','$from_main_id','$deviceId','$owner','$rabatt','$tariff_desc','$tariff_nr','$daymax_price','$abo_price','$free_hours','$ct->{int11}','$sharing_type','$bike_charge','$ct->{txt17}','$ct->{txt18}','$ct->{int20}','$trackon','$staff','$sig_book->{bikeId}','$sig_book->{reservationId}','$sig_book->{rentalId}','$unit_price1','$unit_price2','$start_price','$unit_time','$free_time') RETURNING c_id");
|
||||||
}else{
|
}else{
|
||||||
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int02,int03,txt01,txt06,txt07,int10,int12,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','0','$user_name','$ctadr->{txt09}',now(),'$unit_price','1','$ct->{txt01}','$ct->{txt06}','$ct->{txt07}','0','$from_main_id','$owner') RETURNING c_id");
|
$sth = $dbh->prepare("INSERT INTO contenttranspos (ct_id,cc_id,ca_id,ct_name,barcode,txt08,txt09,itime,int02,int03,txt01,txt06,txt07,int10,int12,owner) VALUES ('$ctt_id','$ct->{c_id}','$ctadr->{c_id}','$ct_name','0','$user_name','$ctadr->{txt09}',now(),'$unit_price','1','$ct->{txt01}','$ct->{txt06}','$ct->{txt07}','0','$from_main_id','$owner') RETURNING c_id");
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ my $lang = "de";
|
||||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||||
my $dbh = "";
|
my $dbh = "";
|
||||||
|
|
||||||
|
my $interval_min = "15";
|
||||||
|
$interval_min = $ARGV[1] if($ARGV[1] && $ARGV[1] =~ /^\d+$/);
|
||||||
|
|
||||||
#set available if requestes older than 15 minute
|
#set available if requestes older than 15 minute
|
||||||
my $return={};
|
my $return={};
|
||||||
my $pref = {
|
my $pref = {
|
||||||
|
@ -40,7 +43,7 @@ my $pref = {
|
||||||
#txt10 => "requested",
|
#txt10 => "requested",
|
||||||
int10 => "2",
|
int10 => "2",
|
||||||
owner => "!=::199",#don't select LV api requested bikes
|
owner => "!=::199",#don't select LV api requested bikes
|
||||||
start_time => "<=::(now() - interval '15 minutes')",
|
start_time => "<=::(now() - interval '$interval_min minutes')",
|
||||||
};
|
};
|
||||||
my $record_cp = $dbt->fetch_tablerecord($dbh,$pref);
|
my $record_cp = $dbt->fetch_tablerecord($dbh,$pref);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue