作者 lyh

gx数据

... ... @@ -93,12 +93,12 @@ class GeoQuestionResLogic extends BaseLogic
$keywordUrlCount = 0;
$keywordArr = [];
$questionResModel = new GeoQuestionLog();
$resList = $questionResModel->list(['project_id'=>$this->user['project_id']],['keywords_num','url_num']);
$resList = $questionResModel->list(['project_id'=>$this->user['project_id']],['keywords','url','keywords_num','url_num']);
foreach ($resList as $resItem){
$keywordUrlCount += count(array_filter($resItem['keywords_num'], fn($v) => $v != 0));
$keywordUrlCount += count(array_filter($resItem['url_num'], fn($v) => $v != 0));
$keywordUrlCount += count($resItem['keywords']);
$keywordUrlCount += count($resItem['url']);
foreach ($resItem['keywords_num'] as $key => $value) {
$keywordArr[$key] = ($keywordArr[$key] ?? 0) + 1;
$keywordArr[$key] = ($keywordArr[$key] ?? 0) + (($value != 0) ? 1 : 0);
}
}
$data = [
... ...
... ... @@ -24,6 +24,51 @@ class GeoQuestionLog extends Base
protected $table = 'gl_geo_question_log';
/**
* @remark :geo提交关键字获取器
* @name :getUrlAttribute
* @author :lyh
* @method :post
* @time :2025/7/3 9:53
*/
public function getKeywordsAttribute($value)
{
if($value){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :geo提交网址获取器
* @name :getUrlAttribute
* @author :lyh
* @method :post
* @time :2025/7/3 9:52
*/
public function getUrlAttribute($value)
{
if($value){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :geo提交结果获取器
* @name :getUrlAttribute
* @author :lyh
* @method :post
* @time :2025/7/3 9:52
*/
public function getTextAttribute($value)
{
if($value){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :命中的关键词数量
* @name :getKeywordsNumAttribute
* @author :lyh
... ... @@ -52,4 +97,5 @@ class GeoQuestionLog extends Base
}
return $value;
}
}
... ...