Clients file update
This commit is contained in:
miroman-afk
2021-11-16 15:43:14 +03:00
parent 13a115ba0d
commit 3c8a6b2736
5 changed files with 11 additions and 5 deletions

View File

@@ -64,7 +64,7 @@ class ClientFile extends HRCCommand implements HRCCommandInterface {
$mainThreads = 4;
$countPerThread = ceil($clientsCount / $mainThreads);
$offset = ($urlThread - 1) * $countPerThread;
$clients = Client::with('clientPhone:client_guid')->skip($offset)->take($countPerThread)->get();
$clients = Client::with('clientPhone')->skip($offset)->take($countPerThread)->get();
if (!is_dir($tmp_dirname)) {
mkdir($tmp_dirname, 0755, 'w+');

View File

@@ -12,7 +12,7 @@ class Import extends HRCCommand implements HRCCommandInterface {
public function command($input, $output = null) {
$HRCPortalURL = 'https://portal.hrc.by/';
$folder = 'backup';
$terminals = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->where('work_code', '=', 1)->get();
$terminals = Terminal::where('soft', '=', 1)->where('is_active', '=', 1)->get();
$end_date = date('m/d/Y H:i:s', strtotime($input['end_date']) + 86399);
$start_date = date('m/d/Y H:i:s', strtotime($input['start_date']));
foreach ($terminals as $terminal) {
@@ -48,7 +48,9 @@ class Import extends HRCCommand implements HRCCommandInterface {
];
} else {
foreach ($out as $filename) {
$path = '/backup/' . $filename . '.xml';
$date_file = date('Y-m-d', $filename);
//$path = '/backup/' . $filename . '.xml';
$path = '/Резервная%20копия/' . $date_file . '/exchange/' . $date_file . '/exchange/' . $filename . '.xml';
$download_url = $HRCPortalURL . 'api/cloud/download?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&path=' . $path;
$download = curl_init();