作者 zhl

Merge remote-tracking branch 'origin/master' into zhl

... ... @@ -12,6 +12,7 @@ namespace App\Console\Commands\Ai;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\Domain\DomainInfo;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
... ... @@ -51,6 +52,7 @@ class AiBlogListTask extends Command
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
$this->updateBlogList($aiSettingInfo);
$this->curlDelRoute($project_id);
DB::disconnect('custom_mysql');
return true;
}
... ... @@ -96,4 +98,24 @@ class AiBlogListTask extends Command
}
return true;
}
/**
* @remark :通知C端生成界面
* @name :sendNotice
* @author :lyh
* @method :post
* @time :2025/3/6 11:51
*/
public function curlDelRoute($project_id){
$domainModel = new DomainInfo();
//获取项目域名
$domain = $domainModel->getProjectIdDomain($project_id);
if(!empty($domain)){
$url = $domain.'api/update_page/?project_id='.$project_id.'&route=7';
shell_exec('curl -k "'.$url.'"');
}else{
echo '域名不存在:' . $project_id . PHP_EOL . date('Y-m-d H:i:s');
}
return true;
}
}
... ...
... ... @@ -51,14 +51,63 @@ class LyhImportTest extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
// ProjectServer::useProject(3283);
// echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
ProjectServer::useProject(3283);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$this->importProductCategory('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/zy_boss_pricelistcat_202503131025.csv','3283');
// $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283);
// DB::disconnect('custom_mysql');
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :导入产品分类
* @name :productCategory
* @author :lyh
* @method :post
* @time :2025/3/13 9:58
*/
public function importProductCategory($url,$project_id){
$line_of_text = [];
$opts = [
'http' => [
'method' => 'GET',
'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
];
$file_handle = fopen($url, 'r', null, stream_context_create($opts));
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ',');
}
fclose($file_handle);
$categoryModel = new Category();
foreach ($line_of_text as $k => $val){
if($k < 1){
continue;
}
if(empty($val[1])){
continue;
}
$id = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$val[1],'seo_title'=>$val[0],'seo_keyword'=>$val[2]]);
$pid = 0;
if($val[2] != 0){
//查询上级id
$pidCate = $categoryModel->read(['seo_title'=>$val[2]]);
if($pidCate !== false){
$pid = $pidCate['id'];
}
}
$route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id);
$categoryModel->edit(['route'=>$route,'pid'=>$pid],['id'=>$id]);
echo date('Y-m-d H:i:s') . '产品分类id:'. $id;
}
return true;
}
/**
* @remark :导入分类
* @name :importProductCategory
* @author :lyh
... ... @@ -85,7 +134,6 @@ class LyhImportTest extends Command
$cateModel = new Category();
$productModel = new Product();
$detailModel = new Detail();
$columnModel = new Column();
foreach ($line_of_text as $k => $val){
if($k < 2){
continue;
... ... @@ -106,8 +154,8 @@ class LyhImportTest extends Command
$saveData['content'] = $val[3];
$seo = ['seo_title'=>$val[5]];
$saveData['seo_mate'] = json_encode($seo,true);
$thumb = ['alt'=>'主图','url'=>str_replace('/public','',$val[6])];
$gallery = [['alt'=>'主图','url'=>str_replace('/public','',$val[6])]];
$thumb = ['alt'=>'主图','url'=>str_replace('/public','/upload/p/3283',$val[6])];
$gallery = [['alt'=>'主图','url'=>str_replace('/public','/upload/p/3283',$val[6])]];
$saveData['thumb'] = json_encode($thumb,true);
$saveData['gallery'] = json_encode($gallery,true);
$id = $productModel->addReturnId($saveData);
... ... @@ -127,22 +175,16 @@ class LyhImportTest extends Command
'content'=>json_encode(['content'=>$val[3]])
];
$detailModel->addReturnId($detail);
//扩展描述设置
$detailFaq = [
'column_name'=>'FAQs',
'product_id'=>$id
];
$faqId = $columnModel->addReturnId($detailFaq);
$faqsDetail = json_decode($val[4],true);
$faqContent = '';
if(!empty($faqsDetail) && is_array($faqsDetail)){
$faqContent = '<div>';
foreach ($faqsDetail as $faq_Val){
$faqContent .= "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />";
$faqContent .= "<span>question:".$faq_Val['question'] . "</span><br /><span>" . "answer:".$faq_Val['answer']. "</span><br />";
}
$faqContent .= '</div>';
$detailFaqInfo = [
'product_id'=>$id,
'column_id'=>$faqId,
'column_id'=>1,
'text_type'=>1,
'content'=>json_encode(['content'=>$faqContent])
];
... ...
... ... @@ -226,7 +226,7 @@ class WeekProject extends Command
if(!empty($data['daily_average_num'])){
$content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
}
$content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
$content2 .= PHP_EOL.'全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
}
if(!empty($content2)){
$arr[] = $content2;
... ... @@ -251,7 +251,7 @@ class WeekProject extends Command
$content3 .= '新闻:'.$data['week_news_num'].'条。';
}
}
$content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
$content3 .= PHP_EOL.'全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
}
if(!empty($content3)){
$arr[] = $content3;
... ... @@ -270,7 +270,7 @@ class WeekProject extends Command
$content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
}
if(!empty($content4)){
$content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4;
$content4 = PHP_EOL.'本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4;
}
if(!empty($content4)){
$arr[] = $content4;
... ...
... ... @@ -9,10 +9,6 @@ use App\Http\Requests\Bside\Ai\AiBlogRequest;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class AiBlogController extends BaseController
{
... ...
<?php
/**
* @remark :
* @name :KeywordUrlController.php
* @author :lyh
* @method :post
* @time :2025/3/12 17:01
*/
namespace App\Http\Controllers\Bside\Product;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Product\KeywordUrlLogic;
use App\Models\Product\KeywordUrl;
/**
* @remark :关键词设置
* @name :KeywordUrlController
* @author :lyh
* @method :post
* @time :2025/3/12 17:01
*/
class KeywordUrlController extends BaseController
{
/**
* @remark :关键词设置列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/3/12 17:01
* @param :keyword->关键字
*/
public function lists(KeywordUrl $keywordUrl){
if(isset($this->map['keyword']) && !empty($this->map['keyword'])){
$this->map['keyword'] = ['like','%'.$this->map['keyword'].'%'];
}
$filed = ['id','keyword','url','created_at','updated_at'];
$lists = $keywordUrl->lists($this->map,$this->page,$this->row,$this->order,$filed);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/3/12 17:25
*/
public function info(KeywordUrl $keywordUrl){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'id不能为空',
]);
$lists = $keywordUrl->read(['id'=>$this->param['id']]);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/3/12 17:02
* @param :keyword->关键词; url->对应路由
*/
public function save(KeywordUrlLogic $keywordUrlLogic){
$this->request->validate([
'keyword'=>['required'],
'url'=>['required'],
],[
'keyword.required' => 'keyword不能为空',
'url.required' => 'url不能为空',
]);
$result = $keywordUrlLogic->saveKeywordUrl();
$this->response('success',Code::SUCCESS,$result);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2025/3/12 17:02
*/
public function del(KeywordUrl $keywordUrl){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => 'id不能为空',
]);
$result = $keywordUrl->del($this->param);
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
... ... @@ -202,7 +202,7 @@ class InquiryForwardLogic extends BaseLogic
}
//更改询盘状态及转发数量
$this->model->edit(['status' => InquiryInfo::STATUS_FINISH, 'num' => $num], ['id' => $this->param['id']]);
$this->model->edit(['status' => InquiryInfo::STATUS_FINISH, 'num' => $num, 'operator_id' => $this->manager['id']], ['id' => $this->param['id']]);
DB::commit();
} catch (\Exception $e) {
... ... @@ -364,7 +364,7 @@ class InquiryForwardLogic extends BaseLogic
$status = InquiryInfo::STATUS_INVALID;
$remark = '手动置为无效';
}
$rs = $this->model->edit(['status' => $status, 'remark' => $remark], ['id' => $this->param['id']]);
$rs = $this->model->edit(['status' => $status, 'remark' => $remark, 'operator_id' => $this->manager['id']], ['id' => $this->param['id']]);
if ($rs === false) {
$this->fail('设置失败');
... ...
... ... @@ -243,7 +243,7 @@ class ProjectLogic extends BaseLogic
$aiSettingInfo = $aiSettingModel->read(['project_id'=>$project_id]);
if($aiSettingInfo === false){
$aiBlogService = new AiBlogService();
$result = $aiBlogService->createProject($title,$languageInfo['short'],$projectInfo['company']);
$result = $aiBlogService->createProject($projectInfo['company'] ?? $title,$languageInfo['short'],$projectInfo['company']);
if(isset($result['status']) && $result['status'] == 200){
//查看当前项目是否已有记录
$resData = [
... ...
... ... @@ -6,9 +6,7 @@ use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\Project\AiBlogTask;
use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
... ...
<?php
/**
* @remark :
* @name :KeywordUrlLogic.php
* @author :lyh
* @method :post
* @time :2025/3/12 17:06
*/
namespace App\Http\Logic\Bside\Product;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Product\KeywordUrl;
/**
* @remark :关键词设置
* @name :KeywordUrlLogic
* @author :lyh
* @method :post
* @time :2025/3/12 17:07
*/
class KeywordUrlLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new KeywordUrl();
}
/**
* @remark :保存数据
* @name :saveKeywordUrl
* @author :lyh
* @method :post
* @time :2025/3/12 17:08
*/
public function saveKeywordUrl(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
}
... ...
<?php
/**
* @remark :
* @name :KeywordUrl.php
* @author :lyh
* @method :post
* @time :2025/3/12 16:59
*/
namespace App\Models\Product;
use App\Models\Base;
/**
* @remark :关键词设置
* @name :KeywordUrl
* @author :lyh
* @method :post
* @time :2025/3/12 17:00
*/
class KeywordUrl extends Base
{
//设置关联表名
protected $table = 'gl_keyword_url';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -673,6 +673,14 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'getYoutubeInfo'])->name('youtube_getYoutubeInfo');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'saveYoutube'])->name('youtube_saveYoutube');
});
//seo白帽 关键词设置
Route::prefix('keyword_url')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'lists'])->name('keyword_url_lists');
Route::any('/info', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'info'])->name('keyword_url_info');
Route::any('/save', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'save'])->name('keyword_url_save');
Route::any('/del', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'del'])->name('keyword_url_del');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...