作者 赵彬吉
... ... @@ -19,6 +19,7 @@ use App\Models\GoogleSearch\GoogleCodeCountry;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\AggregateKeyword;
use App\Models\Project\AiBlogTask;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
... ... @@ -66,7 +67,36 @@ class UpdateRoute extends Command
*/
public function handle()
{
return $this->_action();
return $this->keyword_actions();
}
public function keyword_actions(){
$a = new AggregateKeyword();
$list = $a->formatQuery(['status'=>1])->pluck('project_id')->unique()->values()->toArray();
foreach ($list as $v){
echo date('Y-m-d H:i:s').' 执行的项目id:'.$v.PHP_EOL;
ProjectServer::useProject($v);
$keywordModel = new Keyword();
$keyList = $keywordModel->list(['status'=>1],'id',['id','title'],'asc');
foreach ($keyList as $keyV){
echo date('Y-m-d H:i:s').'对应数据id:'.$keyV['id'].PHP_EOL;
$keywordInfo = $keywordModel->read(['id'=>$keyV['id']],['id']);
if($keywordInfo !== false){
$keywordIds = $keywordModel->formatQuery(['id'=>['!=',$keyV['id'],'title'=>$keyV['title']]])->pluck('id')->toArray();
if(!empty($keywordIds)){
echo date('Y-m-d H:i:s').'清空对应重复的关键词....'.PHP_EOL;
$keywordModel->del(['id'=>['in',$keywordIds]]);
$routeMapModel = new RouteMap();
$routeMapModel->del(['source'=>'product_keyword','source_id'=>['in',$keywordIds]]);
}else{
echo date('Y-m-d H:i:s').'无重复关键词..'.PHP_EOL;
}
}else{
echo '当前关键词已被清除'.PHP_EOL;
}
}
DB::disconnect('custom_mysql');
}
}
/**
... ...
... ... @@ -58,8 +58,6 @@ class OptimizeSetKeywordSync extends Command
$item->status = AggregateKeyword::STATUS_FINISH;
$item->save();
}
Common::del_user_cache('product_keyword',$this->user['project_id']);
NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]);
return true;
}
... ... @@ -71,7 +69,7 @@ class OptimizeSetKeywordSync extends Command
*/
public function syncKeyword($project_id, $keywords)
{
$keywords = explode("\n", $keywords);
$keywords = explode("\r\n", $keywords);
$keywords = array_unique(array_filter($keywords));
ProjectServer::useProject($project_id);
$keywordModel = new Keyword();
... ...
... ... @@ -43,6 +43,8 @@ class DomainInfoController extends BaseController
$lists['list'][$k]['company'] = $company;
}
}
$lists['y_status'] = $domainModel->counts(['status'=>1]);
$lists['n_status'] = $domainModel->counts(['status'=>0]);
return $this->response('success', Code::SUCCESS, $lists);
}
... ...
... ... @@ -554,6 +554,8 @@ class ProductController extends BaseController
}
if(!empty($v['og_image'])){
$v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']);
}else{
$v['og_image'] = $v['thumb']['url'] ?? '';
}
if(!empty($v['icon'])){
foreach ($v['icon'] as $icon_k => $icon_v){
... ...
... ... @@ -357,8 +357,10 @@ class ProductLogic extends BaseLogic
$param['thumb'] = Arr::a2s([]);
$param['gallery'] = Arr::a2s([]);
}
if(isset($param['og_image'])){
if(isset($param['og_image']) && !empty($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}else{
$param['og_image'] = $param['thumb']['url'] ?? '';
}
if(isset($param['files'])){
$param['files']['url'] = str_replace_url($param['files']['url'] ?? '');
... ...
... ... @@ -156,8 +156,8 @@ class Keyword extends Base
if(empty($v)){
continue;
}
$info = $this->read(['title'=>$v],['id']);
if($info === false){
$info = $this->read(['title'=>trim($v)],['id']);
if($info == false){
$param['project_id'] = $project_id;
$param['title'] = $v;
$param['first_word'] = $this->first_word($param['title']);
... ...