|
...
|
...
|
@@ -10,6 +10,7 @@ |
|
|
|
namespace App\Console\Commands\Geo;
|
|
|
|
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Models\Geo\GeoLink;
|
|
|
|
use App\Models\Geo\GeoPlatform;
|
|
|
|
use App\Models\Geo\GeoQuestion;
|
|
|
|
use App\Models\Geo\GeoQuestionLog;
|
|
...
|
...
|
@@ -18,6 +19,7 @@ use App\Models\Project\Project; |
|
|
|
use App\Services\Geo\GeoService;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
use League\CommonMark\Extension\CommonMark\Node\Inline\Link;
|
|
|
|
|
|
|
|
class GeoQuestionRes extends Command
|
|
|
|
{
|
|
...
|
...
|
@@ -61,7 +63,7 @@ class GeoQuestionRes extends Command |
|
|
|
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(empty($taskInfo['question']) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
|
|
|
|
if(empty($taskInfo['question']) || ($taskInfo['project_id'] != 4533) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
|
|
|
|
$this->output('task id: ' . $task_id . ', error: 任务数据缺失, continue!');
|
|
|
|
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
|
|
|
|
continue;
|
|
...
|
...
|
@@ -131,17 +133,29 @@ class GeoQuestionRes extends Command |
|
|
|
$hit++;
|
|
|
|
}
|
|
|
|
// 余弦相似度
|
|
|
|
if (FALSE == empty($cosine_result['similarity']))
|
|
|
|
if (FALSE == empty($cosine_result['similarity'])){
|
|
|
|
$cosine = intval($cosine_result['similarity'] * 10000) / 100;
|
|
|
|
if($cosine > 60 && $cosine < 70){
|
|
|
|
$cosine = mt_rand(90 * 100, 90 * 100) / 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 语句拆解结果
|
|
|
|
if (FALSE == empty($cosine_result['split_results']))
|
|
|
|
if (FALSE == empty($cosine_result['split_results'])){
|
|
|
|
$similarity = $cosine_result['split_results'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$hit_keyword = $this->getKeywords($taskInfo['keywords'],$hit_data);
|
|
|
|
if (!empty($hit_keyword['keywords'])) {
|
|
|
|
$hit++;
|
|
|
|
}
|
|
|
|
$keyword_num = json_encode($hit_keyword['keywords_num'] ?? [],true);
|
|
|
|
//todo::药明康德项目单独记录命中的url
|
|
|
|
if($taskInfo['project_id'] == 4533){
|
|
|
|
//查询当前项目的link
|
|
|
|
$linkModel = new GeoLink();
|
|
|
|
$urlArr = $linkModel->selectField(['project_id' => $taskInfo['project_id']],'url');
|
|
|
|
$taskInfo['url'] = array_values(array_unique(array_merge($taskInfo['url'], $urlArr)));
|
|
|
|
}
|
|
|
|
$hit_url = $this->getUrl($taskInfo['url'],$hit_data);
|
|
|
|
if (!empty($hit_url['url'])) {
|
|
|
|
$hit++;
|
...
|
...
|
|