create filter and bigdata resume sync
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Enums\ImportDatasourceStatus;
|
||||
use App\Models\BigdataResume;
|
||||
use App\Models\GlobalSetting;
|
||||
use App\Models\ImportDatasource;
|
||||
use App\Models\PbgTaskIndexIntegrations;
|
||||
@@ -28,10 +29,10 @@ class ServiceSIMBG
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->email = trim((string) GlobalSetting::where('key','SIMBG_EMAIL')->first()->value);
|
||||
$this->password = trim((string) GlobalSetting::where('key','SIMBG_PASSWORD')->first()->value);
|
||||
$this->simbg_host = trim((string)GlobalSetting::where('key','SIMBG_HOST')->first()->value);
|
||||
$this->fetch_per_page = trim((string)GlobalSetting::where('key','FETCH_PER_PAGE')->first()->value);
|
||||
$this->email = trim((string) GlobalSetting::where('key','SIMBG_EMAIL')->firstOrFail()->value);
|
||||
$this->password = trim((string) GlobalSetting::where('key','SIMBG_PASSWORD')->firstOrFail()->value);
|
||||
$this->simbg_host = trim((string)GlobalSetting::where('key','SIMBG_HOST')->firstOrFail()->value);
|
||||
$this->fetch_per_page = trim((string)GlobalSetting::where('key','FETCH_PER_PAGE')->firstOrFail()->value);
|
||||
$this->service_client = new ServiceClient($this->simbg_host);
|
||||
}
|
||||
|
||||
@@ -59,8 +60,6 @@ class ServiceSIMBG
|
||||
];
|
||||
|
||||
$res = $this->service_client->get($url, $headers);
|
||||
|
||||
Log::info("response index integration", ['res' => $res]);
|
||||
|
||||
if (empty($res->original['success']) || !$res->original['success']) {
|
||||
// Log error
|
||||
@@ -183,8 +182,22 @@ class ServiceSIMBG
|
||||
'created_at' => now(),
|
||||
];
|
||||
|
||||
$this->syncIndexIntegration($item['uid'], $token);
|
||||
$this->syncTaskDetailSubmit($item['uid'], $token);
|
||||
$save_integration = $this->syncIndexIntegration($item['uid'], $token);
|
||||
if (!$save_integration) {
|
||||
$importDatasource->update([
|
||||
'status' => ImportDatasourceStatus::Failed->value,
|
||||
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
||||
]);
|
||||
}
|
||||
|
||||
$save_detail = $this->syncTaskDetailSubmit($item['uid'], $token);
|
||||
if( !$save_detail ) {
|
||||
$importDatasource->update([
|
||||
'status' => ImportDatasourceStatus::Failed->value,
|
||||
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
||||
]);
|
||||
}
|
||||
|
||||
$savedCount++;
|
||||
} catch (Exception $e) {
|
||||
$failedCount++;
|
||||
@@ -213,6 +226,8 @@ class ServiceSIMBG
|
||||
'message' => "Successfully processed: $savedCount, Failed: $failedCount"
|
||||
]);
|
||||
|
||||
BigdataResume::generateResumeData($importDatasource->id);
|
||||
|
||||
Log::info("syncTaskList completed", ['savedCount' => $savedCount, 'failedCount' => $failedCount]);
|
||||
|
||||
return $this->resSuccess(['savedCount' => $savedCount, 'failedCount' => $failedCount]);
|
||||
|
||||
Reference in New Issue
Block a user