remote jobs
This commit is contained in:
@ -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.
|
||||
|
@ -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 . '<br><br>' . $html = Html::a('Только "удаленная работа"', \yii\helpers\Url::to([
|
||||
'/hh/hh/get-jobs-remote',
|
||||
'id' => $model->id
|
||||
]), [
|
||||
'class' => 'btn btn-success'
|
||||
]);
|
||||
return $html;
|
||||
},
|
||||
],
|
||||
|
||||
|
@ -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())
|
||||
?>
|
||||
<div class="hh-view">
|
||||
|
||||
|
Reference in New Issue
Block a user