作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2315
... ... @@ -75,8 +75,17 @@ class GeoQuestionRes extends Command
$result_data = $geoService->setWebSearchChatAction($q_item,$p_item);
echo 'success:'.$result_data['code'].PHP_EOL;
if(isset($result_data) && $result_data['code'] == 200){
$keywords = $this->getKeywords($keywordArr,$result_data['text'] ?? []);
$urls = $this->getUrl($urlArr,$result_data['annotations'] ?? []);
$result_data_annotations[] = $result_data['text'];
if(!empty($result_data['annotations'])){
$url = array_column($result_data['annotations'], 'url');
$title = array_column($result_data['annotations'], 'title');
$result_data_annotations = array_merge($url,$title,$result_data_annotations);
dd($result_data['annotations']);
}else{
continue;
}
$keywords = $this->getKeywords($keywordArr,$result_data_annotations ?? []);
$urls = $this->getUrl($urlArr,$result_data_annotations ?? []);
}
}catch (\Exception $e){
echo $e->getMessage().PHP_EOL;
... ... @@ -100,16 +109,9 @@ class GeoQuestionRes extends Command
}else{
$geoResultModel->edit($data,['id'=>$resultInfo['id']]);
}
$data_log = [
'project_id'=>$info['project_id'],
'question_id'=>$info['id'],
'platform'=>$p_item,
'question'=>$q_item,
'text'=>json_encode($result_data ?? [],true),
'type'=>$info['type'] ?? 1
];
//日志记录
$geoLogModel = new GeoQuestionLog();
$geoLogModel->addReturnId($data_log);
$geoLogModel->addReturnId($data);
}
}
//更新下次执行时间
... ... @@ -124,22 +126,13 @@ class GeoQuestionRes extends Command
* @method :post
* @time :2025/7/3 16:38
*/
public function getUrl($urlArr = [],$result_annotations = [],$result_text = []){
public function getUrl($urlArr = [],$result_annotations = []){
$url = [];
if(!empty($urlArr)){
$str = implode(',',$result_annotations);
foreach ($urlArr as $u_item){
if(!empty($result_text)){
if (str_contains($result_text, $u_item)) {
$url[] = $u_item;
}
}
if(!empty($result_annotations)){
foreach ($result_annotations as $a_item){
echo 'url'.$a_item['url_citation']['url'].PHP_EOL.'当前的url:'.$u_item;
if (str_contains($a_item['url_citation']['url'], $u_item) || str_contains($a_item['url_citation']['title'], $u_item)) {
$url[] = $u_item;
}
}
if (str_contains($str, $u_item)) {
$url[] = $u_item;
}
}
}
... ... @@ -156,8 +149,9 @@ class GeoQuestionRes extends Command
public function getKeywords($keywordArr = [],$result_text = []){
$keywords = [];
if(!empty($keywordArr) && !empty($result_text)){
$str = implode(',',$result_text);
foreach ($keywordArr as $k_item){
if (str_contains($result_text, $k_item)) {
if (str_contains($str, $k_item)) {
$keywords[] = $k_item;
}
}
... ...
... ... @@ -46,6 +46,18 @@ class GeoQuestionResController extends BaseController
}
/**
* @remark :获取统计数据
* @name :getCount
* @author :lyh
* @method :post
* @time :2025/7/8 17:18
*/
public function getCount(){
$data = $this->logic->getCount();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取列表数据
* @name :getList
* @author :lyh
... ...
... ... @@ -22,6 +22,19 @@ class GeoQuestionResLogic extends BaseLogic
}
/**
* @remark :获取类型统计数据
* @name :getCount
* @author :lyh
* @method :post
* @time :2025/7/8 17:16
*/
public function getCount(){
$type_1 = $this->model->counts(['type'=>1,'project_id'=>$this->user['project_id']]);
$type_2 = $this->model->counts(['type'=>2,'project_id'=>$this->user['project_id']]);
return $this->success(['type_1'=>$type_1,'type_2'=>$type_2]);
}
/**
* @remark :获取列表页数据
* @name :getResultList
* @author :lyh
... ...
... ... @@ -754,6 +754,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/getList', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class,'getList'])->name('geo_result_getList');
Route::any('/getInfo', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class,'getInfo'])->name('geo_result_getInfo');
Route::any('/getType', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getType'])->name('geo_result_getType');//geo设置类型
Route::any('/getCount', [\App\Http\Controllers\Bside\Geo\GeoQuestionResController::class, 'getCount'])->name('geo_result_getCount');//geo设置类型统计数量
});
});
//无需登录验证的路由组
... ...