Exemple #1
0
 public function actionSearch()
 {
     $return = array();
     $results = Yii::$app->HpApi->queryTextIndex($_POST['query']);
     if ($results) {
         foreach ($results['documents'] as $document) {
             $candidate_file_id = str_replace('candidateFileID_', '', $document['title']);
             $Resumes = Resumes::find()->where(array('candidate_file_id' => $candidate_file_id))->one();
             if ($Resumes) {
                 $CandidatesFiles = $Resumes->candidatesFiles;
                 $ResumesFaces = $Resumes->resumesFaces;
                 if ($CandidatesFiles && $ResumesFaces) {
                     if ($ResumesFaces->width) {
                         $finalImage = '/home/ubuntu/workspace/basic/uploads/' . $CandidatesFiles->candidate_id . '/crop_' . $CandidatesFiles->server_filename;
                         if (file_exists($finalImage)) {
                             $return[$CandidatesFiles->candidate_id][] = array('content' => $document['content'], 'url_image' => Url::to('@web/uploads/' . $CandidatesFiles->candidate_id . '/crop_' . $CandidatesFiles->server_filename, true), 'face_top_position' => $ResumesFaces->top_position, 'face_left_position' => $ResumesFaces->left_position, 'face_width' => $ResumesFaces->width, 'face_height' => $ResumesFaces->height, 'resumes_id' => $ResumesFaces->resume_id);
                         }
                     }
                 }
             }
         }
     }
     $return = json_encode($return);
     echo $return;
 }
Exemple #2
0
 public function getResumes()
 {
     return $this->hasOne(Resumes::className(), ['id' => 'resume_id']);
 }
Exemple #3
0
 public function getResumeStatus()
 {
     $resumeModel = Resumes::find()->where(array('finished_time' => null))->orderBy('id asc')->one();
     if ($resumeModel) {
         $hpStatus = Yii::$app->HpApi->getStatus($resumeModel->hp_job_id);
         if ($hpStatus['status'] == 'finished') {
             //['actions'][0]['result']['text_block'][0]['text']
             $resumeModel->finished_time = new Expression('NOW()');
             $resumeModel->save();
             $addIndex = Yii::$app->HpApi->addToIndex($hpStatus['actions'][0]['result']['text_block'][0]['text'], $resumeModel->candidate_file_id);
         }
     }
 }
Exemple #4
0
 public function getResumes()
 {
     return $this->hasOne(Resumes::className(), ['candidate_file_id' => 'id']);
 }