diff --git a/backend/modules/hh/controllers/HhController.php b/backend/modules/hh/controllers/HhController.php
index 19faeec..b96c27c 100644
--- a/backend/modules/hh/controllers/HhController.php
+++ b/backend/modules/hh/controllers/HhController.php
@@ -136,6 +136,20 @@ class HhController extends Controller
return $this->redirect(['/hh/hh']);
}
+ public function actionGetJobsRemote($id)
+ {
+ $model = \common\models\Hh::findOne($id);
+ $jobs = HHService::run()->company($model->hh_id)->getJobs();
+ $count = 0;
+ foreach ((array)$jobs as $job) {
+ if(HhJob::createFromHHRemote($job)){
+ $count++;
+ }
+ }
+ Yii::$app->session->setFlash('success', "Получено $count новых вакансий");
+ return $this->redirect(['/hh/hh']);
+ }
+
/**
* Finds the Hh model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
diff --git a/backend/modules/hh/views/hh/index.php b/backend/modules/hh/views/hh/index.php
index 0901c19..7eadc1d 100644
--- a/backend/modules/hh/views/hh/index.php
+++ b/backend/modules/hh/views/hh/index.php
@@ -34,12 +34,19 @@ $this->params['breadcrumbs'][] = $this->title;
'class' => 'yii\grid\DataColumn',
'format' => 'raw',
'value' => function ($model) {
- return Html::a('Получить вакансии', \yii\helpers\Url::to([
+ $html = Html::a('Получить все вакансии', \yii\helpers\Url::to([
'/hh/hh/get-jobs',
'id' => $model->id
]), [
'class' => 'btn btn-success'
]);
+ $html = $html . '
' . $html = Html::a('Только "удаленная работа"', \yii\helpers\Url::to([
+ '/hh/hh/get-jobs-remote',
+ 'id' => $model->id
+ ]), [
+ 'class' => 'btn btn-success'
+ ]);
+ return $html;
},
],
diff --git a/backend/modules/hh/views/hh/view.php b/backend/modules/hh/views/hh/view.php
index 03a7e22..33bf172 100644
--- a/backend/modules/hh/views/hh/view.php
+++ b/backend/modules/hh/views/hh/view.php
@@ -9,7 +9,8 @@ use yii\widgets\DetailView;
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'hh.ru', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
-//\common\classes\Debug::dd(\common\hhapi\core\service\HHService::run()->company($model->hh_id)->get())
+//\common\classes\Debug::prn(\common\hhapi\core\service\HHService::run()->vacancy(28246746)->get());
+//\common\classes\Debug::dd(\common\hhapi\core\service\HHService::run()->company($model->hh_id)->getJobs())
?>