mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-15 08:06:27 +02:00
Tarif refactoring+
This commit is contained in:
parent
292b9754ee
commit
b2e5d72c51
15 changed files with 216 additions and 135 deletions
|
@ -92,12 +92,15 @@ sub utctime {
|
|||
my $time = Time::Piece->strptime($date, "%Y-%m-%dT%H:%M:%S");
|
||||
print FILE "localtime: " . $time->datetime . "\n";#localtime
|
||||
my $utc_epoch = $time->epoch;
|
||||
#$utc_epoch -= 2*60*60;# -2 std
|
||||
#
|
||||
#only -1 hour, because of deviceTime and serverTime differs
|
||||
#'deviceTime' => '2021-10-14T08:19:35.000+0000',
|
||||
#'serverTime' => '2021-10-14T07:19:37.000+0000',
|
||||
$utc_epoch -= 1*60*60;# -1 std
|
||||
|
||||
#TODO
|
||||
$utc_epoch -= 2*60*60;# -2 std (Sommerzeit)
|
||||
#$utc_epoch -= 1*60*60;# -1 std (Winterzeit)
|
||||
|
||||
$utc_epoch += $latency;
|
||||
$time = gmtime($utc_epoch);#epoch
|
||||
print FILE "utctime: " . $time->datetime . "\n";#utc zulu date time
|
||||
|
|
|
@ -43,9 +43,14 @@ my %varenv = $cf->envonline($syshost);
|
|||
my $lang = "de";
|
||||
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
||||
|
||||
my $api_file = "/var/www/copri4/shareeconf/apikeys.cfg";
|
||||
my $aconf = Config::General->new($api_file);
|
||||
my %apikeyconf = $aconf->getall;
|
||||
#print "---> " . $apikeyconf{Ilockitcloud}->{username} . "\n";
|
||||
|
||||
my $ua = LWP::UserAgent->new;
|
||||
$ua->agent("sharee APIclient");
|
||||
$ua->credentials( 'tracking.ilockit.bike:443', 'api', 'r.guempelein@sharee.bike', 'mohj2ooN');
|
||||
$ua->credentials( 'tracking.ilockit.bike:443', 'api', "$apikeyconf{Ilockitcloud}->{username}", "$apikeyconf{Ilockitcloud}->{passwd}");
|
||||
|
||||
my $json = JSON->new->allow_nonref;
|
||||
my $response_in = {};
|
||||
|
@ -55,6 +60,7 @@ my $owner = 183;
|
|||
my $todo = $ARGV[1];
|
||||
#my $deviceId = $ARGV[2] || "";
|
||||
my $pos_id = $ARGV[2] || "";
|
||||
my $sleep = $ARGV[3] || "";
|
||||
|
||||
open(FILE,">>$varenv{logdir}/Ilockit_tracking.log");
|
||||
print FILE "\n\n*** $now_dt\n";
|
||||
|
@ -87,8 +93,9 @@ sub utctime {
|
|||
my $time = Time::Piece->strptime($date, "%Y-%m-%dT%H:%M:%S");
|
||||
print FILE "localtime: " . $time->datetime . "\n";#localtime
|
||||
my $utc_epoch = $time->epoch;
|
||||
#$utc_epoch -= 2*60*60;# -2 std (Sommerzeit)
|
||||
$utc_epoch -= 1*60*60;# -1 std (Winterzeit)
|
||||
#TODO
|
||||
$utc_epoch -= 2*60*60;# -2 std (Sommerzeit)
|
||||
#$utc_epoch -= 1*60*60;# -1 std (Winterzeit)
|
||||
$utc_epoch += $latency;
|
||||
$time = gmtime($utc_epoch);#epoch
|
||||
print FILE "utctime: " . $time->datetime . "\n";#utc zulu date time
|
||||
|
@ -111,7 +118,8 @@ sub get_pos {
|
|||
|
||||
|
||||
if($todo eq "get_tripsum" && $pos_id){
|
||||
print FILE "trying $todo && $pos_id" . "\n";
|
||||
print FILE "trying $todo && $pos_id | sleep $sleep" . "\n";
|
||||
sleep $sleep if($sleep);
|
||||
my $rows = &get_tripsum($pos_id);
|
||||
print FILE "got rows $rows" . "\n";
|
||||
}else{
|
||||
|
|
|
@ -39,7 +39,7 @@ if($todo eq "sigo_available"){
|
|||
print $0 . Dumper($return) . "\n";
|
||||
}
|
||||
|
||||
if($todo eq "sigo_reserve"){
|
||||
if($todo eq "sigo_booking"){
|
||||
my $auth = { c_id => 1842 };
|
||||
#my $bikeId = "380116b5-0522-43da-ab66-477744a731a3";# bike 1150
|
||||
my $bike = "SX1150";# bike 1150 from app booking_request
|
||||
|
|
|
@ -34,6 +34,7 @@ my %varenv = $cf->envonline();
|
|||
|
||||
my $operator_key = $q->param('api_test');
|
||||
my $bike = $q->param('bike');
|
||||
#my $bike = "FR4781";
|
||||
|
||||
my $lang = "de";
|
||||
my $dyn_js = "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue