GoogleKeywordInsightDetail.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @remark :
* @name :GoogleKeywordInsightDetail.php
* @author :lyh
* @method :post
* @time :2025/3/25 14:33
*/
namespace App\Models\GoogleKeywordInsight;
use App\Helper\Translate;
use App\Models\Base;
class GoogleKeywordInsightDetail extends Base
{
protected $table = 'gl_google_insight_detail';
/**
* @remark :保存洞察数据详情
* @name :saveInsightDetail
* @author :lyh
* @method :post
* @time :2025/3/25 14:45
*/
public function saveInsightDetail($project_id,$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'=>$project_id,
'volume'=>$val['volume'],
'competition_level'=>$val['competition_level'],
'competition_index'=>$val['competition_index'],
'low_bid'=>$val['low_bid'],
'high_bid'=>$val['high_bid'],
'trend'=>$val['trend'],
];
}
return $this->insertAll($saveData);
}
}