作者 赵彬吉
... ... @@ -63,7 +63,7 @@ class GoogleSearchKeyword extends Command
*/
public function handle(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'type'=>['!=',$projectModel::TYPE_ONE]], 'id', ['id']);
$lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[2,3,4]]], 'id', ['id']);
$domainModel = new DomainInfo();
foreach ($lists as $val) {
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $val['id'] . PHP_EOL;
... ...
... ... @@ -64,7 +64,7 @@ class SendKeyword extends Command
})
->get();
$time = time();
$send_num = [30 => 1000, 60 => 3000, 90 => 6000];
$send_num = [30 => 1000, 50 => 2000, 60 => 4000, 70 => 6000];
$ban_domain = $this->banDomain();
foreach ($projects as $item) {
if (empty($item->is_auto_keywords))
... ...
... ... @@ -51,7 +51,7 @@ class GeneratePage extends Command
{
$noticeModel = new NoticeLog();
while (true){
$noticeInfo = $noticeModel->read(['status'=>0,'type'=>$noticeModel::GENERATE_PAGE]);
$noticeInfo = $noticeModel->read(['status'=>0,'type'=>$noticeModel::GENERATE_PAGE,'start_at'=>['<=',date('Y-m-d H:i:s')]]);
if (empty($noticeInfo)) {
sleep(10);
continue;
... ...
... ... @@ -189,7 +189,7 @@ class SyncProject extends Command
if(isset($data[$param])){
return $data[$param];
}else{
return 1;
return 0;
}
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Helper\Common;
use App\Helper\Gpt;
use App\Models\Ai\AiCommand;
use App\Models\Ai\AiTdkErrorLog;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateNotify;
use App\Models\Domain\DomainInfo;
use App\Models\Mail\Mail;
... ... @@ -258,7 +259,8 @@ class UpdateSeoTdk extends Command
'url' => [],
'language'=> [],
];
http_post($url, json_encode($param));
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$url,'c_params'=>$param]),date('Y-m-d H:i:s',time()+300));
// http_post($url, json_encode($param));
echo getmypid() . ' ' . '更新中请稍后, 更新完成将会发送站内信通知更新结果!'. PHP_EOL;
}
public function seo_tdk($project_id, $task_id)
... ...
... ... @@ -1206,6 +1206,9 @@ function paginateArray($array, $page = 1, $pageSize = 20) {
* @time :2025/4/3 16:19
*/
function getDomain($url) {
if(empty($url)){
return $url;
}
$parsedUrl = parse_url($url);
return $parsedUrl['host'] ?? $url; // 如果解析失败,返回原始 URL
}
... ...
... ... @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Aside\Collect;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\CollectLogic;
use App\Http\Logic\Aside\Collect\CollectLogic;
/**
... ...
... ... @@ -32,7 +32,7 @@ class InquiryForwardController extends BaseController
$this->map['message'] = ['like', '%' . $this->map['message'] . '%'];
}
if (isset($this->param['start_date']) && isset($this->param['end_date'])) {
$this->map['inquiry_date'] = ['between', [$this->map['start_date'] . ' 00:00:00', $this->map['end_date'] . ' 23:59:59']];
$this->map['inquiry_date'] = ['between', [$this->map['start_date'] . ' 00:00:00', $this->map['end_date'] . ' 00:00:00']];
unset($this->map['start_date']);
unset($this->map['end_date']);
} elseif (isset($this->param['start_date'])) {
... ...
... ... @@ -85,6 +85,9 @@ class CustomModuleContentController extends BaseController
if(!empty($v['image'])){
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['og_image'])){
$v['og_image'] = getImageUrl($v['og_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
}
if(!empty($v['video'])){
$v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0);
$v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
... ...
... ... @@ -39,7 +39,7 @@ class GoogleKeywordInsightController extends BaseController
]);
$logic->getGoogleInsight();
$detailModel = new GoogleKeywordInsightDetail();
$data = $detailModel->lists(['search'=>$this->param['keyword']],$this->page,$this->row);
$data = $detailModel->lists(['search'=>$this->param['keyword']],$this->page,$this->row,'id',['*'],'asc');
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -25,14 +25,19 @@ class GoogleLinkController extends BaseController
*/
public function getLink(){
$linkModel = new GoogleLink();
$lists = $linkModel->lists($this->map,$this->page,$this->row,'id',['url','moz_da','status','google_search','date','project_id','domain']);
$this->map['project_id'] = $this->user['project_id'];
$this->map['status'] = 1;
$this->map['date'] = ['>=', date('Y-m-d 00:00:00', strtotime('-7 days'))];
$lists = $linkModel->lists($this->map,$this->page,$this->row,'id',['url','moz_da','status','url_domain','google_search','date','project_id','domain']);
if(empty($lists['list'])){
$linkService = new GoogleLinkService();
$data = $linkService->linkPageData($this->user['domain'],$this->user['project_id']);
$lists = paginateArray($data,$this->page,$this->row);
if(is_array($data)){
$lists = paginateArray($data,$this->page,$this->row);
}else{
$this->response('success');
}
}
$lists['y_total'] = $linkModel->counts(['status'=>1]);
$lists['n_total'] = $linkModel->counts(['status'=>0]);
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -36,13 +36,13 @@ class GoogleSearchController extends BaseController
]);
//查询详情数据
$searchDetailModel = new GoogleSearchDetail();
$this->map['project_id']= 711;
$data = $searchDetailModel->lists($this->map,$this->page,$this->row,'clicks',['keys','click_rate','impressions_rate']);
$this->map['project_id'] = $this->user['project_id'];
$data = $searchDetailModel->lists($this->map,$this->page,$this->row,'impressions',['keys','click_rate','impressions_rate']);
if(!empty($data)){
if($this->param['type'] == 'country'){
$codeCountryModel = new GoogleCodeCountry();
foreach ($data['list'] as $key => $val){
$val['zh_country'] = $codeCountryModel->getCodeCountry($val['keys']);
$val['zh_country'] = $codeCountryModel->getCodeCountry($val['keys']) ?? $val['keys'];
$val['click_rate'] = number_format($val['click_rate'] * 100, 2); // 保留 2 位小数
$val['impressions_rate'] = number_format($val['impressions_rate'] * 100, 2);
$data['list'][$key] = $val;
... ...
... ... @@ -552,6 +552,9 @@ class ProductController extends BaseController
$v['gallery'][$gallery_k] = $gallery_v;
}
}
if(!empty($v['og_image'])){
$v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']);
}
if(!empty($v['icon'])){
foreach ($v['icon'] as $icon_k => $icon_v){
$icon_v = getImageUrl($icon_v,$this->user['storage_type'] ?? 0,$this->user['project_location']);
... ...
<?php
namespace App\Http\Logic\Aside;
namespace App\Http\Logic\Aside\Collect;
use App\Http\Logic\Logic;
use App\Models\Blog\Blog;
... ...
... ... @@ -29,7 +29,10 @@ class ProcessRecordsLogic extends BaseLogic
];
}
$data['project_company'] = $project['company'] ?? '';
$data['project_plan'] = Project::planMap()[$project['deploy_build']['plan']];
$plan = Project::planMap();
$seo_plan = Project::seoMap();
$data['project_plan'] = $plan[$project['deploy_build']['plan']] ?? 0;
$data['project_seo_plan'] = $seo_plan[$project['deploy_build']['seo_plan']] ?? 0;
$data['project_service_duration'] = $project['deploy_build']['service_duration'] ?? '';
$data['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');;
$data['test_domain'] = $project['deploy_build']['test_domain'] ?? '';
... ...
... ... @@ -138,7 +138,6 @@ class CustomTemplateLogic extends BaseLogic
$condition['source'] = $this->getType(BTemplate::COMMON_FOOTER);
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
$template_id = $this->getTemplateId();
//取默认首页的
$condition['source'] = BTemplate::SOURCE_COM;
$footerComInfo = $bTemplateComModel->read($condition);
... ...
... ... @@ -16,7 +16,6 @@ class BlogCategoryLogic extends BaseLogic
public function __construct()
{
parent::__construct();
$this->model = new BlogCategoryModel();
$this->param = $this->requestAll;
}
... ...
... ... @@ -100,6 +100,7 @@ class BlogLogic extends BaseLogic
$blogLabelLogic = new BlogLabelLogic();
$info['label_name'] = $blogLabelLogic->getLabelName($info['label_id']);
$info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
$info['og_image'] = getImageUrl($info['og_image'],$this->user['storage_type'],$this->user['project_location']);
return $this->success($info);
}
... ... @@ -183,6 +184,12 @@ class BlogLogic extends BaseLogic
}else{
$param['category_id'] = '';
}
if(isset($param['image'])){
$param['image'] = str_replace_url($param['image'] ?? '');
}
if(isset($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}
if(isset($this->param['release_at']) && !empty(($this->param['release_at'])) && ($this->param['status'] == 3)){
if($this->param['release_at'] < date('Y-m-d 23:59:59')){
$this->fail('发布时间需大于当天');
... ...
... ... @@ -226,6 +226,9 @@ class CustomModuleContentLogic extends BaseLogic
if(isset($param['image']) && !empty($param['image'])){
$param['image'] = str_replace_url($param['image']);
}
if(isset($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}
if(isset($param['video'])){
$param['video']['url'] = str_replace_url($param['video']['url']);
$param['video']['video_image'] = str_replace_url($param['video']['video_image']);
... ...
... ... @@ -75,7 +75,6 @@ class GoogleKeywordInsightLogic extends BaseLogic
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('保存失败,请联系管理员');
}
}
return $this->success(['id'=>$id ?? 0]);
... ...
... ... @@ -192,6 +192,9 @@ class NewsLogic extends BaseLogic
if(isset($param['image'])){
$param['image'] = str_replace_url($param['image'] ?? '');
}
if(isset($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}
if(isset($this->param['text'])){
$param['text'] = $this->handleText($this->param['text']);
}
... ...
... ... @@ -357,6 +357,9 @@ class ProductLogic extends BaseLogic
$param['thumb'] = Arr::a2s([]);
$param['gallery'] = Arr::a2s([]);
}
if(isset($param['og_image'])){
$param['og_image'] = str_replace_url($param['og_image'] ?? '');
}
if(isset($param['files'])){
$param['files']['url'] = str_replace_url($param['files']['url'] ?? '');
$param['files'] = Arr::a2s($param['files'] ?? []);
... ...
... ... @@ -29,7 +29,6 @@ class ProjectCountryLogic extends BaseLogic
}
$lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
$lists['country_sort'] = $this->countrySortFormat($lists['country_sort']);
return $this->success($lists);
}
... ... @@ -116,12 +115,11 @@ class ProjectCountryLogic extends BaseLogic
}
protected function countrySortFormat($country_sort){
if(empty($country_sort)){
$webLanguageModel = new WebLanguage();
$all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id');
$country_sort = implode(',',$all_language_ids);
$webLanguageModel = new WebLanguage();
$idArr = $webLanguageModel->selectField(['id'=>['not in',explode(',',$country_sort)]],'id');
if(!empty($idArr)){
$country_sort = $country_sort.','.implode(',',$idArr);
}
return $country_sort;
}
}
... ...
... ... @@ -29,13 +29,15 @@ class NoticeLog extends Base
* 创建日志
* @param $type
* @param $data
* @param $start_at
* @return mixed
*/
public static function createLog($type, $data)
public static function createLog($type, $data,$start_at=0)
{
$log = new self();
$log->type = $type;
$log->data = $data;
$log->start_at = $start_at ?: date('Y-m-d H:i:s');
return $log->save();
}
... ...
... ... @@ -88,8 +88,10 @@ class GoogleLinkService
public function saveLink($data,$project_id,$domain){
$saveData = [];
foreach ($data as $val){
$timestamp = strtotime($val['created_at']);
$date = date('Y-m-d H:i:s', $timestamp ?? time());
$date = date('Y-m-d 00:00:00', time());
if($val['status'] != 1){
continue;
}
$saveData[] = [
'url'=>$val['url'],
'moz_da'=>$val['mozDA'],
... ... @@ -97,11 +99,15 @@ class GoogleLinkService
'google_search'=>$val['googlesearch'],
'date'=>$date,
'project_id'=>$project_id,
'domain'=>$domain
'domain'=>$domain,
'url_domain'=>getDomain($val['url'] ?? '')
];
}
$linkModel = new GoogleLink();
$linkModel->insertAll($saveData);
if(!empty($saveData)){
$linkModel->del(['project_id'=>$project_id]);
$linkModel->insertAll($saveData);
}
return $saveData;
}
}
... ...
... ... @@ -33,23 +33,31 @@ class RapIdApIService
*/
public function requestUrl($keyword){
$this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey';
$url = $this->url.'/?keyword='.$keyword.'&lang=en';
return $this->curlGoogleApi($url);
$param = [
'keyword'=>$keyword,
'location'=>'US',
'lang'=>'en'
];
$query_string = str_replace('+', '%20', http_build_query($param));
$url = $this->url.'/?'.$query_string;
$data = $this->curlGoogleApi($url);
return $data;
}
/**
* @remark :热门关键词拉取
* @name :requestKeywordUrl
* @remark :备用数据
* @name :keywordResearch
* @author :lyh
* @method :post
* @time :2025/3/27 16:57
* @time :2025/4/10 10:23
*/
public function requestKeywordUrl($keyword){
$this->url = 'https://google-keyword-insight1.p.rapidapi.com/topkeys';
$url = $this->url.'/?keyword='.$keyword.'&location=US&&lang=en';
public function keywordResearch($keyword){
$this->url = 'https://seo-keyword-research.p.rapidapi.com/keynew.php';
$param = ["keyword" => $keyword, 'country' => 'us'];
$query_string = str_replace('+', '%20', http_build_query($param));
$url = $this->url.'/?'.$query_string;
return $this->curlGoogleApi($url);
}
/**
* @remark :请求
* @name :curlGoogleApi
... ...