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; $mainThreads = 4;
$countPerThread = ceil($clientsCount / $mainThreads); $countPerThread = ceil($clientsCount / $mainThreads);
$offset = ($urlThread - 1) * $countPerThread; $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)) { if (!is_dir($tmp_dirname)) {
mkdir($tmp_dirname, 0755, 'w+'); mkdir($tmp_dirname, 0755, 'w+');

View File

@@ -12,7 +12,7 @@ class Import extends HRCCommand implements HRCCommandInterface {
public function command($input, $output = null) { public function command($input, $output = null) {
$HRCPortalURL = 'https://portal.hrc.by/'; $HRCPortalURL = 'https://portal.hrc.by/';
$folder = 'backup'; $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); $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'])); $start_date = date('m/d/Y H:i:s', strtotime($input['start_date']));
foreach ($terminals as $terminal) { foreach ($terminals as $terminal) {
@@ -48,7 +48,9 @@ class Import extends HRCCommand implements HRCCommandInterface {
]; ];
} else { } else {
foreach ($out as $filename) { 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_url = $HRCPortalURL . 'api/cloud/download?api=2.0&project_code=hrc&code=' . $terminal['key'] . '&path=' . $path;
$download = curl_init(); $download = curl_init();

View File

@@ -11,6 +11,6 @@ class Client extends Model {
* Get clients phone. * Get clients phone.
*/ */
public function clientPhone() { public function clientPhone() {
return $this->hasOne('App\Component\Models\ClientsPhone', 'client_guid', 'user_code'); return $this->belongsTo('App\Component\Models\ClientsPhone', 'user_code', 'client_guid');
} }
} }

View File

@@ -11,6 +11,6 @@ class ClientsPhone extends Model {
* Get clients. * Get clients.
*/ */
public function client() { public function client() {
return $this->hasOne('App\Component\Models\Clients', 'user_code', 'client_guid'); return $this->belongsTo('App\Component\Models\Clients', 'user_code', 'client_guid');
} }
} }

View File

@@ -16,6 +16,10 @@
}); });
}; };
$scope.createReport = function () {
};
$scope.update = function () { $scope.update = function () {
$scope.getOrders(); $scope.getOrders();
}; };