作者 ZhengBing He

log

... ... @@ -86,7 +86,7 @@ class RemainDay extends Command
* @time :2025/4/2 10:48
*/
public function saveRemainDay(){
$list = $this->project->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR]]],'id',['id','type','uptime','remain_day','is_remain_today','pause_days','finish_remain_day']);
$list = $this->project->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','uptime','remain_day','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day']);
foreach ($list as $item){
$deploy_build = $this->deployBuild->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
... ... @@ -123,19 +123,15 @@ class RemainDay extends Command
//白帽版本的系统
if($deploy_build['seo_plan'] == 1){
if($deploy_build['seo_service_duration'] != 0){
if($item['uptime']){
$diff = time() - strtotime($item['uptime']);
$compliance_day = floor($diff / (60 * 60 * 24));
if($item['bm_finish_remain_day']){
$compliance_day = (int)$item['bm_finish_remain_day'];
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
}else{
$seo_remain_day = $deploy_build['seo_service_duration'];
}
// if($seo_remain_day < 0){
// $seo_remain_day = 0;
// }
if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}else{
//同时包括白帽版本+默认版本的项目
$this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]);
... ...
... ... @@ -79,11 +79,11 @@ class RankDataLog extends BaseCommands
$this->output('保存排名数据:ID'.$log->project_id . ',APINO' . $log->api_no);
if(Str::endsWith($log->api_no, '_bmseo')){
//白帽版
(new RankDataLogic())->save_rank_bmseo($log->project_id, $log->api_no, $res);
$is_compliance = (new RankDataLogic())->save_rank_bmseo($log->project_id, $log->api_no, $res);
}else{
$is_compliance = (new RankDataLogic())->save_rank($log->project_id, $log->api_no, $res, null, $log->lang);
$log->is_compliance = $is_compliance;
}
$log->is_compliance = $is_compliance;
$log->status = 1;
$log->save();
... ...
... ... @@ -4,12 +4,16 @@ namespace App\Console\Commands\Tdk;
use App\Helper\Arr;
use App\Models\Blog\BlogCategory;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\Keyword;
use App\Models\Project\KeywordPrefix;
use App\Models\Project\Project;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\Template\BCustomTemplate;
use App\Services\ProjectServer;
use App\Utils\LogUtils;
use Illuminate\Console\Command;
... ... @@ -55,11 +59,14 @@ class RerunSeoTdk extends Command
*/
public function handle()
{
$project_ids = Project::where('type', Project::TYPE_TWO)->pluck('id')->toArray();
$where = [
'id' => 624
];
$project_ids = Project::where('type', Project::TYPE_TWO)->where($where)->pluck('id')->toArray();
foreach ($project_ids as $project_id){
try {
ProjectServer::useProject($project_id);
$this->judgeAnomalies($project_id);
$this->changeCompanyName($project_id);
DB::disconnect('custom_mysql');
}catch (\Exception $e){
dump($e->getMessage());
... ... @@ -68,6 +75,25 @@ class RerunSeoTdk extends Command
}
/**
* 换了公司英文名的
* @author zbj
* @date 2025/7/18
*/
public function changeCompanyName($project_id){
$row1 = BCustomTemplate::where('description', 'like', '%BlueQ Biotechnology%')->update(['description' => '']);
$row2 = Category::where('seo_des', 'like', '%BlueQ Biotechnology%')->update(['seo_des' => '']);
$row3 = Keyword::where('seo_description', 'like', '%BlueQ Biotechnology%')->update(['seo_description' => '']);
$row4 = Keyword::where('keyword_content', 'like', '%BlueQ Biotechnology%')->update(['keyword_content' => '']);
$row5 = BlogCategory::where('seo_des', 'like', '%BlueQ Biotechnology%')->update(['seo_des' => '']);
$row6 = NewsCategory::where('seo_des', 'like', '%BlueQ Biotechnology%')->update(['seo_des' => '']);
$row7 = CustomModuleCategory::where('seo_description', 'like', '%BlueQ Biotechnology%')->update(['seo_description' => '']);
dump($row1,$row2,$row3,$row4,$row5,$row6,$row7);
}
/**
* 判断seo_title 前缀有wholesale或cheap或buy的词,后缀也有 manufacturer,factory,exporter,company
* 判断关键词最后一个词是前缀的词,前后缀都不拼
* @author zbj
... ...
... ... @@ -24,6 +24,7 @@ class Kernel extends ConsoleKernel
$schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
$schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
$schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次
$schedule->command('ai_domain')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次(同步ai域名)
$schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息
$schedule->command('update_seo_tdk_crontab')->dailyAt('20:00')->withoutOverlapping(1); //更新上线项目TDK
$schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
... ...
... ... @@ -320,7 +320,8 @@ class NewsController extends BaseController
],[
'keyword.required' => 'keyword不能为空',
]);
$data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],true);
$data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.str_replace(' ', '+', $this->param['keyword']),true);
if(isset($data['data']['p'][0]) && !empty($data['data']['p'][0])){
$data['data']['p'][0] = str_replace('&nbsp' ,' ',$data['data']['p'][0]);
}
... ...
... ... @@ -174,7 +174,7 @@ class CustomTemplateLogic extends BaseLogic
$six_read = $this->param['six_read'] ?? 0;//5.0数据时,是否按6.0显示
if($is_upgrade == 0 || $six_read == 0) {
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
if(($this->param['url'] == 'news') || ($this->param['url'] == 'product') || ($this->param['url'] == 'blog')){
if(($this->param['url'] == 'news') || ($this->param['url'] == 'products') || ($this->param['url'] == 'blog')){
$this->fail('不允许创建路由为:'.$this->param['url']);
}
}
... ...
... ... @@ -22,6 +22,7 @@ use App\Models\RankData\IndexedPages;
use App\Models\RankData\IndexedPages as IndexedPagesModel;
use App\Models\RankData\RankData;
use App\Models\RankData\RankDataBmseo;
use App\Models\RankData\RankDataLog;
use App\Models\RankData\RankWeek;
use App\Models\RankData\RankWeek as RankWeekModel;
use App\Models\RankData\RecommDomain;
... ... @@ -709,6 +710,28 @@ class RankDataLogic extends BaseLogic
$first_ten_pages_num ++;
}
}
//保证关键词数
$keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
if($keyword_num){
$is_compliance = $first_page_num >= $keyword_num;
}else{
$is_compliance = 0;
}
if ($keyword_num && $is_compliance) {
Log::channel('rank_data')->info('项目' . $project_id . '白帽版:关键词达标'. $keyword_num .' - ' . $first_page_num);
$compliance_log = RankDataLog::where('api_no', $api_no)->where('date', date('Y-m-d'))->where('is_compliance', 1)->first();
if (!$compliance_log) {
$compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
Project::where('id', $project_id)->update(['bm_is_remain_today' => 1, 'bm_finish_remain_day' => $compliance_day + 1]);
Log::channel('rank_data')->info('项目' . $project_id . '白帽版:达标天数+1:' . ($compliance_day + 1));
}
}else {
Log::channel('rank_data')->info('项目' . $project_id . '白帽版:关键词未达标'. $keyword_num .' - ' . $first_page_num);
}
$where = [
'project_id' => $project_id,
'api_no' => $api_no,
... ... @@ -728,7 +751,7 @@ class RankDataLogic extends BaseLogic
$model->updated_date = date('Y-m-d');
$model->save();
return true;
return $is_compliance;
}
/**
... ...