Files
FloatBackOfffice/CRONS/batch/batch_quote_file_check.php
dev-chiefworks f76abffdcd first commit
2022-05-31 16:21:53 -04:00

44 lines
1.5 KiB
PHP

<?php
$job_name = pathinfo(__FILE__, PATHINFO_FILENAME);
echo "[".date("Y-m-d H:i:s")."] ".$job_name." job is starting.\n";
set_time_limit(0); // No limit!
require('../../backend.php');
require('../common/QuoteApi.php');
$httpAuthToken = $savvyext->cfgReadChar('system.oauth2_token');
$encryptionAlg = $savvyext->cfgReadChar('encryption.algorithm');
$encryptionKey = $savvyext->cfgReadChar('encryption.key');
$encryptionIV = $savvyext->cfgReadChar('encryption.iv');
$baseURL = $savvyext->cfgReadChar('system.api_url');
$db_host = $savvyext->cfgReadChar('database.host');
$db_name = $savvyext->cfgReadChar('database.name');
$db_user = $savvyext->cfgReadChar('database.user');
$db_pass = $savvyext->cfgReadChar('database.pass');
$db_port = $savvyext->cfgReadLong('database.port');
$connstr = "host=${db_host} port=${db_port} dbname=${db_name} user=${db_user} password=${db_pass}";
$conn = pg_connect($connstr);
$country = 'SG';
$member_id = 0;
// ComfortDelGro & Gojek
$transport_providers = [4,5];
// Grab
$transport_providers = [3];
QuoteApi::$job_name = $job_name;
$q = "select id,automation_id from quotes where id>=11462 and id<=13761 and (cost<1 or cost is null)";
$q = "select id,automation_id from quotes where id>=11462 and id<=13761 and (cost<1 or cost is null)";
$r = pg_query($conn,$q);
while ($f=pg_fetch_assoc($r)) {
list($res,$cost) = QuoteApi::check_quote($f["id"]);
echo "[".date("Y-m-d H:i:s")."] ".$f["id"]."/".$f["automation_id"]." => ".$cost."\n";
}
echo "[".date("Y-m-d H:i:s")."] ".$job_name." job complete.\n";