|
...
|
...
|
@@ -9,6 +9,7 @@ |
|
|
|
|
|
|
|
namespace App\Http\Logic\Bside\GoogleKeywordInsight;
|
|
|
|
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\GoogleKeywordInsight\GoogleKeywordInsight;
|
|
|
|
use App\Services\GoogleKeywordInsightService;
|
|
...
|
...
|
@@ -32,7 +33,7 @@ class GoogleKeywordInsightLogic extends BaseLogic |
|
|
|
* @time :2025/3/25 14:36
|
|
|
|
*/
|
|
|
|
public function getGoogleInsight(){
|
|
|
|
$data = $this->model->read(['project_id'=>$this->user['project_id'],'search'=>$this->param['keyword']]);
|
|
|
|
$data = $this->model->read(['search'=>$this->param['keyword']]);
|
|
|
|
if($data === false){
|
|
|
|
$this->service = new GoogleKeywordInsightService();
|
|
|
|
$data = $this->service->requestUrl($this->param['keyword']);
|
|
...
|
...
|
@@ -71,9 +72,14 @@ class GoogleKeywordInsightLogic extends BaseLogic |
|
|
|
public function saveInsightDetail($keyword,$data){
|
|
|
|
$saveData = [];
|
|
|
|
foreach ($data as $val){
|
|
|
|
$zh_text = Translate::tran($val['text'], 'zh');
|
|
|
|
if(empty($zh_text)){
|
|
|
|
$zh_text = $val['text'];
|
|
|
|
}
|
|
|
|
$saveData[] = [
|
|
|
|
'search'=>$keyword,
|
|
|
|
'text'=>$val['text'],
|
|
|
|
'zh_text'=>$zh_text,
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'volume'=>$val['volume'],
|
|
|
|
'competition_level'=>$val['competition_level'],
|
...
|
...
|
|