作者 刘锟

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

<?php
/**
* @remark :
* @name :AiBlogAuthorId.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:57
*/
namespace App\Console\Commands\Ai;
use App\Models\Domain\DomainInfo;
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
use App\Services\AiBlogService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
class AiBlogAuthorId extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'save_ai_blog_author_id';
/**
* The console command description.
*
* @var string
*/
protected $description = '拉取对应作者的页面';
public $route = [];
public function handle(){
while (true){
//获取任务id
$task_id = $this->getTaskId();
if(empty($task_id)){
sleep(300);
continue;
}
$this->_action($task_id);
}
}
public function getTaskId()
{
$task_id = Redis::rpop('ai_blog_author_id');
if (empty($task_id)) {
$aiBlogTaskModel = new AiBlogTaskModel();
$ids = $aiBlogTaskModel->formatQuery(['status'=>$aiBlogTaskModel::STATUS_RUNNING, 'type'=>$aiBlogTaskModel::TYPE_AUTHOR_ID])->pluck('id');
if(!empty($ids)){
foreach ($ids as $id) {
Redis::lpush('ai_blog_author_id', $id);
}
}
$task_id = Redis::rpop('ai_blog_author_id');
}
return $task_id;
}
/**
* @remark :执行方法
* @name :_action
* @author :lyh
* @method :post
* @time :2025/5/26 16:06
*/
public function _action($task_id){
$aiBlogTaskModel = new AiBlogTaskModel();
$item = $aiBlogTaskModel->read(['id'=>$task_id]);
if($item === false){
echo '当前数据不存在.'.$item['id'].PHP_EOL;
return true;
}
$aiBlogService = new AiBlogService($item['project_id']);
ProjectServer::useProject($item['project_id']);
$aiBlogService->author_id = $item['task_id'];
$result = $aiBlogService->getAuthorDetail();
if(isset($result['status']) && $result['status'] == 200){
//当前作者的页面
$aiBlogAuthorModel = new AiBlogAuthorModel();
$authorInfo = $aiBlogAuthorModel->read(['author_id'=>$item['task_id']],['id','route']);
if($authorInfo !== false && !empty($result['data']['section'])){
$this->route[] = $authorInfo['route'];
$aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$item['task_id']]);
}
}
DB::disconnect('custom_mysql');
$aiBlogTaskModel->edit(['status'=>2],['id'=>$task_id]);
$this->sendCPost($item['project_id']);
return true;
}
/**
* @remark :通知C端
* @name :sendCPost
* @author :lyh
* @method :post
* @time :2025/5/26 16:21
*/
public function sendCPost($project_id){
$domainModel = new DomainInfo();
$domain = $domainModel->getProjectIdDomain($project_id);
$c_url = $domain.'api/update_page/';
$param = [
'project_id' => $project_id,
'type' => 1,
'route' => 3,
'url' => $this->route,
'language'=> [],
'is_sitemap' => 0
];
$res = http_post($c_url, json_encode($param,true));
echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
}
... ...
... ... @@ -42,7 +42,8 @@ class RemainDay extends Command
1703,
1893,
2066,
2250
2250,
2193
];//需要单独处理的项目
/**
* The console command description.
... ... @@ -126,11 +127,12 @@ class RemainDay extends Command
}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']]);
// 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']]);
}else{
//同时包括白帽版本+默认版本的项目
$this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]);
... ... @@ -174,10 +176,10 @@ class RemainDay extends Command
}
}
$extend_type = 0;
if($remain_day < 0 && $deploy_build['service_duration'] != 0){
$remain_day = 0;
$extend_type = Project::TYPE_FIVE;
}
// if($remain_day < 0 && $deploy_build['service_duration'] != 0){
// $remain_day = 0;
// $extend_type = Project::TYPE_FIVE;
// }
$this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
return true;
}
... ...
... ... @@ -52,14 +52,55 @@ class LyhImportTest extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
ProjectServer::useProject(2140);
ProjectServer::useProject(3951);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',2140);
$this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',3951);
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :3951项目导入产品
* @name :import3951Product
* @author :lyh
* @method :post
* @time :2025/5/24 11:32
*/
public function import3951Product($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);
$saveData = [];
foreach ($line_of_text as $k => $val){
if($k < 1){
continue;
}
if(empty($val[0])){
echo '跳过的名称:'.$val[0];
continue;
}
$saveData[] = [
'title'=>$val[0],
'thumb' => json_encode(['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]],true),
'gallery' => json_encode([['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]]],true)
];
}
}
/**
* @remark :导入产品分类
* @name :productCategory
* @author :lyh
... ...
... ... @@ -15,6 +15,7 @@ use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Com\NoticeLog;
use App\Models\Com\V6WeeklyReport;
use App\Models\Product\Category;
use App\Models\Project\AiBlogTask;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
... ... @@ -23,6 +24,8 @@ use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplateMain;
use App\Models\Template\TemplateTypeMain;
use App\Models\Visit\Visit;
use App\Models\WebSetting\WebLanguage;
use App\Models\WebSetting\WebSetting;
... ... @@ -51,9 +54,38 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
dd(111);
return true;
}
public function _actionTemplateMain(){
$data = [];
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
foreach ($lists as $val){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $val['id'] . PHP_EOL;
ProjectServer::useProject($val['id']);
$bTemplateMainModel = new BTemplateMain();
$info = $bTemplateMainModel->read(['type'=>2,'is_list'=>1],['id']);
$categoryModel = new Category();
$count = $categoryModel->counts(['id'=>['>',0]]);
if(($info === false) && ($count > 0)){
$mainModel = new TemplateTypeMain();
$mainInfo = $mainModel->read(['type'=>2,'is_list'=>1]);
$main_html = $mainInfo['main_html'];
$main_css = "<style id='globalsojs-styles'></style>";
//写入一条初始数据
$bTemplateMainModel->addReturnId(['type'=>2,'is_list'=>1,'is_custom'=>0,'project_id'=>$val['id'],'main_html'=>$main_html,'main_css'=>$main_css]);
$data[] = $val['id'];
}
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . '结束--项目的id:'. $val['id'] . PHP_EOL;
}
dd($data);
}
public function _action_ai_blog(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
$lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
foreach ($lists as $val) {
$aiSettingInfo = $this->getSetting($val['id']);
if($aiSettingInfo === false){
... ...
... ... @@ -35,6 +35,7 @@ class UpdateKeyword extends Command
public function handle(){
dd(1111);
while (true){
$keywordPageModel = new KeywordPage();
$lists = $keywordPageModel->list(['status'=>0]);
... ... @@ -74,19 +75,40 @@ class UpdateKeyword extends Command
return false;
}
$number = count($text);
$randomNumber = rand(0, $number - 1);
if($updateObject['type'] == 0){//更新所有关键字
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]);
//获取所有关键字的id
$idArr = $keywordModel->selectField(['id'=>['>',0]],'id');
if($info['update_method'] != 1){
$idArr = shuffle($idArr);
}
$result = $this->splitArrayIntoParts($idArr,$number);
foreach ($result as $key => $val){
$keywordModel->edit(['keyword_content'=>$text[$key]],['id'=>['in',$val]]);
}
}else{
//按传递的关键字更新
if(!empty($updateObject['keyword'])){
$updateObject['keyword'] = (array)$updateObject['keyword'];
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>['in',$updateObject['keyword']]]);
foreach ($updateObject['keyword'] as $key => $item){
if($info['update_method'] != 1){
$randomNumber = rand(0, $number - 1);
}else{
$randomNumber = $text[$key] ?? rand(0, $number - 1);
}
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
}
}
//按给定的数量更新
if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){
$keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray();
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['id'=>['in',$keywordIdArr]]);
foreach ($keywordIdArr as $key => $item){
if($info['update_method'] != 1){
$randomNumber = rand(0, $number - 1);
}else{
$randomNumber = $text[$key] ?? rand(0, $number - 1);
}
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
}
}
}
return true;
... ... @@ -108,4 +130,21 @@ class UpdateKeyword extends Command
return true;
}
public function splitArrayIntoParts(array $data, int $parts): array
{
$count = count($data);
// 每份的最小长度(向下取整)
$minSize = intdiv($count, $parts);
// 余数(说明有一些数组项要平均分配给前面的几份)
$remainder = $count % $parts;
$result = [];
$start = 0;
for ($i = 0; $i < $parts; $i++) {
$size = $minSize + ($i < $remainder ? 1 : 0);
$result[] = array_slice($data, $start, $size);
$start += $size;
}
return $result;
}
}
... ...
<?php
use App\Helper\Translate;
use App\Models\File\Image;
use App\Models\File\File as FileModel;
use App\Models\Project\DeployOptimize;
... ... @@ -851,7 +852,7 @@ function getCustomRouteMap($module_route,$route = '')
* @method :post
* @time :2023/11/10 14:29
*/
function getRouteMap($source,$source_id,$is_upgrade = 0){
function getRouteMap($source,$source_id,$is_upgrade = 0, $returnModel = false){
$route = '';
$routeMapModel = new RouteMap();
$info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]);
... ... @@ -878,6 +879,9 @@ function getRouteMap($source,$source_id,$is_upgrade = 0){
$route = $info['route'];
}
}
if($returnModel){
return $info;
}
return $route;
}
... ... @@ -1237,4 +1241,115 @@ function getDomain($url) {
}
/**
* 解析url的 route
* @param $pathInfo
* @return string
* @author zbj
* @date 2025/5/24
*/
function analysisRoute($pathInfo)
{
$language = '';
$router = "";
$page = null;
$pathArr = explode("/", $pathInfo);
$pathArr = array_filter($pathArr);
$first = array_shift($pathArr);
$last = array_pop($pathArr);
$other = implode("/", $pathArr);
$first = $first == "zh-ct" ? "zh-TW" : $first;
$tlsLang = array_keys(Translate::$tls_list);
if (in_array($first, $tlsLang)) {
$language = $first;
$first = '';
}
$lastIsRoute = RouteMap::select("id")->where("route", $last)->first();
if (is_numeric($last) && empty($lastIsRoute)) {
$page = $last;
$last = '';
}
$router_array = compact('first', 'other', 'last');
$router_array = array_filter($router_array);
//解析路由5.0 + 6.0
$keyword = new \App\Models\Product\Keyword();
$topSearchRoute = $keyword->product_keyword_route;
if (isset($router_array['first'])) {
if (isset($router_array['other'])) {
if ($router_array['other'] == "page") {
$router = $router_array['first'];
} else {
$otherArr = explode("/", $router_array['other']);
$otherArr = array_filter($otherArr);
if (count($otherArr) >= 1) {
$router = $otherArr[0];
}
}
} else {
if (isset($router_array['last'])) {
if (in_array($router_array['first'], $topSearchRoute)) {
$router = $router_array['first'];
$page = (int)$router_array['last'];
} else {
$router = $router_array['last'];
}
} else {
$router = $router_array['first'];
}
}
} else {
if (isset($router_array['last'])) {
if ($router_array['last'] != "page") {
if (isset($router_array['other']) && in_array($router_array['other'], $topSearchRoute)) {
$router = $router_array['other'];
$page = (int)$router_array['last'];
} else {
$router = $router_array['last'];
}
} else {
$otherArr = explode("/", $router_array['other']);
$otherArr = array_filter($otherArr);
if (count($otherArr) == 1) {
$router = $otherArr[0];
} else {
$router = $otherArr[1];
}
}
} else {
if (!empty($router_array)) {
$otherArr = explode("/", $router_array['other']);
$otherArr = array_filter($otherArr);
if (count($otherArr) == 3) {
$router = $otherArr[1];
} else {
$router = $otherArr[0];
}
}
}
}
//路由算法处理,路由只有一级,route_map表中route(规定),不考虑小语种
//新增考虑小语种,判断是否小语种访问,有页面不说,当nginx 404页面之后进程序,生成当前小语种页面
$lang = $language;
if ($page == null) {
if ($router != null) {
if ($lang != null) {
$tlsLang = array_keys(Translate::$tls_list);
$isLang = in_array($lang, $tlsLang);
if (!$isLang) {
$router = $lang;
}
}
} else {
$tlsLang = array_keys(Translate::$tls_list);
$isLang = in_array($lang, $tlsLang);
if (!$isLang) {
$router = $lang;
}
}
}
return $router;
}
... ...
... ... @@ -23,6 +23,7 @@ use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\OnlineCheck;
use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
use App\Models\Project\ProjectKeyword;
use App\Models\RouteMap\RouteMap;
use App\Models\User\User;
... ... @@ -538,4 +539,21 @@ class PrivateController extends BaseController
];
return $this->success($result);
}
/**
* 获取项目信息,通过商户号
* @param Request $request
* @return false|string
*/
public function getProjectByMchId(Request $request)
{
$mch_id = intval($request->input('mch_id'));
$project_setting = ProjectAiSetting::where(['mch_id' => $mch_id])->first();
if (empty($project_setting))
return $this->error('商户号未匹配到项目');
$domain = DomainInfo::where(['status' => 1, 'project_id' => $project_setting->project_id])->first();
if (empty($domain))
return $this->error('项目未匹配到域名');
return $this->success(['domain' => $domain->domain]);
}
}
... ...
... ... @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Project\OptimizeCheckList;
use App\Models\Project\OptimizeCheckLog;
use Illuminate\Http\Request;
... ... @@ -44,6 +45,7 @@ class CheckLogController extends BaseController
]);
$field = ['id','check_id','date','status','images','result','created_at'];
$this->map['status'] = 1;
$this->map['type'] = $this->map['type'] ?? 1;
$lists = $this->model->lists($this->map,$this->page,$this->row,'id',$field);
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -80,6 +82,11 @@ class CheckLogController extends BaseController
'project_id.required' => 'project_id不能为空', 'check_id.required' => '问题id不能为空',
'date.required' => '时间不能为空', 'result.required' => '检查结果不能为空',
]);
$checkListModel = new OptimizeCheckList();
$listInfo = $checkListModel->read(['id'=>$this->param['check_id']],['id','type']);
if($listInfo !== false){
$this->param['type'] = $listInfo['type'];
}
$this->param = $this->model->saveHandleParam($this->param,$this->manage['id']);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
... ...
... ... @@ -195,6 +195,7 @@ class OptimizeController extends BaseController
'gl_project.remain_day AS remain_day',
'gl_project.seo_remain_day AS seo_remain_day',
'gl_project.robots AS robots',
'gl_project.is_analysis AS is_analysis',
'gl_project.is_minor_languages AS is_minor_languages',
'gl_project.is_translate AS is_translate',
'gl_project.is_translate_tag AS is_translate_tag',
... ... @@ -593,5 +594,23 @@ class OptimizeController extends BaseController
$this->response('success',Code::SUCCESS,$resultData);
}
/**
* @remark :是否开启泛解析
* @name :saveIsAnalysis
* @author :lyh
* @method :post
* @time :2025/5/24 14:48
*/
public function saveIsAnalysis(){
$this->request->validate([
'id' => 'required',
'is_analysis' => 'required',
], [
'id.required' => '项目id不能为空',
'is_analysis.required' => 'is_analysis不能为空',
]);
$projectModel = new Project();
$data = $projectModel->edit(['is_analysis'=>$this->param['is_analysis']],['id'=>$this->param['id']]);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\ASide\APublicModel;
use App\Models\Channel\Channel;
use App\Models\Domain\DomainInfo;
use App\Models\Manage\Manage;
use App\Models\Manage\ManageHr;
use App\Models\Project\Project;
use App\Models\Project\ProjectRenew;
use App\Models\Task\Task;
... ... @@ -36,7 +37,7 @@ class RenewProjectController extends BaseController
->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
if(!empty($lists)){
$lists = $lists->toArray();
$manageModel = new Manage();
$manageModel = new ManageHr();
$domainModel = new DomainInfo();
foreach ($lists['list'] as $k=>$item){
$item = $this->handleParam($item,$manageModel,$domainModel);
... ... @@ -122,7 +123,7 @@ class RenewProjectController extends BaseController
->with('project_after')->paginate($this->row, ['*'], 'page', $this->page);
if(!empty($lists)){
$lists = $lists->toArray();
$manageModel = new Manage();
$manageModel = new ManageHr();
$domainModel = new DomainInfo();
foreach ($lists['list'] as $k=>$item){
$item = $this->handleParam($item,$manageModel,$domainModel);
... ...
... ... @@ -215,9 +215,9 @@ class CNoticeController extends BaseController
$project_id = $this->user['project_id'];
$type = intval($request->input('type', 1));
$route = intval($request->input('page', 1));
if(($this->user['is_upgrade'] == 0) && ($type == 2) && in_array($route,[4,6])){
$this->fail('聚合页翻译请联系管理员');
}
// if(($this->user['is_upgrade'] == 0) && ($type == 2) && in_array($route,[4,6])){
// $this->fail('聚合页翻译请联系管理员');
// }
$url = $request->input('url', []);
$language = $request->input('language', []);
$is_sitemap = intval($request->input('is_sitemap', 0));
... ...
<?php
/**
* @remark :
* @name :NewsExtendController.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:05
*/
namespace App\Http\Controllers\Bside\News;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\News\NewsExtendLogic;
use App\Models\News\NewsExtend;
use Illuminate\Http\Request;
class NewsExtendController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new NewsExtendLogic();
}
/**
* @remark :获取所有扩展字段
* @name :lists
* @author :lyh
* @method :post
* @time :2025/5/26 15:08
*/
public function lists()
{
$lists = $this->logic->list($this->map);
$this->response('success', Code::SUCCESS, $lists);
}
/**
* @remark :保存扩展字段
* @name :save
* @author :lyh
* @method :post
* @time :2025/5/26 15:09
*/
public function save()
{
$this->request->validate([
'title' => 'required',
'type' => 'required',
], [
'title.required' => '字段名称不能为空',
'type.required' => '字段类型不能为空',
]);
$data = $this->logic->extendSave();
$this->response('success', Code::SUCCESS, $data);
}
/**
* @remark :删除扩展字段
* @name :del
* @author :lyh
* @method :post
* @time :2025/5/26 15:43
*/
public function del(){
$this->request->validate([
'id' => 'required',
], [
'id.required' => '主键不能为空',
]);
$data = $this->logic->extendDel();
$this->response('success', Code::SUCCESS, $data);
}
}
... ...
... ... @@ -61,7 +61,9 @@ class ProductController extends BaseController
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
$route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
$v['url'] = $this->user['domain'] . $route['route'];
$v['pv'] = $route['pv'];
$v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
$v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
$v['created_uid_text'] = $userModel->getName($v['created_uid']);
... ... @@ -97,7 +99,9 @@ class ProductController extends BaseController
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
$route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
$v['url'] = $this->user['domain'] . $route['route'];
$v['pv'] = $route['pv'];
$v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
$v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
$v['created_uid_text'] = $userModel->getName($v['created_uid']);
... ...
... ... @@ -471,7 +471,7 @@ class ProjectLogic extends BaseLogic
}
$param['upload_config'] = json_encode($param['upload_config'] ?? []);
$param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []);
unset($param['robots']);//项目不保存robots
unset($param['robots'],$param['is_analysis']);//项目不保存robots
$this->model->edit($param,['id'=>$param['id']]);
Common::del_user_cache($this->model->getTable(),$param['id']);
return $this->success();
... ...
... ... @@ -92,6 +92,8 @@ class AiBlogLogic extends BaseLogic
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'route'=>$this->param['route'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]);
$aiBlogTask = new AiBlogTask();
$aiBlogTask->addReturnId(['type'=>$aiBlogTask::TYPE_AUTHOR_ID,'task_id'=>$this->param['author_id'],'status'=>1,'project_id'=>$this->user['project_id']]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
... ...
... ... @@ -52,7 +52,7 @@ class CustomTemplateLogic extends BaseLogic
$info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
$template_id = $this->getTemplateId();
$html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id);
$html = $this->getTemplateComHtml(empty($info['html']) ? $info['text'] : $info['html'],$info['html_style'],$template_id);
$info['html'] = $this->getHeadFooter($html);
}
return $this->success($info);
... ... @@ -555,6 +555,7 @@ class CustomTemplateLogic extends BaseLogic
'is_visualization' => $info['is_visualization'],
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
'text'=>$info['text'] ?? '',
];
}
}
... ...
<?php
/**
* @remark :
* @name :NewsExtendLogic.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:11
*/
namespace App\Http\Logic\Bside\News;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\News\NewsExtend;
use App\Models\Product\ExtendInfo;
class NewsExtendLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new NewsExtend();
$this->param = $this->requestAll;
}
/**
* @remark :列表页
* @name :list
* @author :lyh
* @method :post
* @time :2025/5/26 15:17
*/
public function list($map){
$data = $this->model->list($map);
return $this->success($data);
}
/**
* @remark :保存扩展字段
* @name :extendSave
* @author :lyh
* @method :post
* @time :2025/5/26 15:13
* @param :id->主键;title->名称
*/
public function extendSave(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$info = $this->model->read(['title'=>$this->param['title']]);
if($info !== false){
$this->fail('当前扩展名称已存在');
}
$this->param['key'] = $this->model->getKey();
$this->param['project_id'] = $this->user['project_id'];
$rs = $this->model->add($this->param);
}
if($rs === false){
$this->fail('error');
}
return $this->success($this->param);
}
/**
* @remark :删除字段
* @name :extendDel
* @author :lyh
* @method :post
* @time :2025/5/26 15:45
* @param :id->主键
*/
public function extendDel(){
$info = $this->model->read(['id'=>$this->param['id']]);
//查看当前扩展字段是否设置了值
$extendInfoModel = new ExtendInfo();
$extendInfo = $extendInfoModel->read(['key'=>$info['key']]);
if($extendInfo !== false){
$this->fail('当前扩展字段已有产品在使用,不允许删除');
}
$this->model->del(['id'=>$this->param['id']]);
}
}
... ...
... ... @@ -489,14 +489,10 @@ class ProductLogic extends BaseLogic
foreach ($data as $k => $v){
$map = [];
$cateModel = new Category();
$status = [];
if($v != 3){
$status = ['status'=>$v];
}
$cateList = $cateModel->list($status,'id',['id','pid']);
$cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
$this->param['featured_status'] = $this->param['featured_status'] ?? 0;
if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
$featured_ids = $cateModel->where('title', 'Featured')->pluck('id')->toArray();
$featured_ids = $cateModel->formatQuery(['title'=>['in',['Featured','featured']]])->pluck('id')->toArray();
//获取当前的子集
$featured_arr = [];
foreach ($featured_ids as $id){
... ...
... ... @@ -549,7 +549,7 @@ class RankDataLogic extends BaseLogic
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250];//暂停的项目
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193];//暂停的项目
$uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
//一个项目多个api_no
$multiple_api_no_project_ids = [
... ...
<?php
/**
* @remark :
* @name :AiBlogAuthor.php
* @name :AiBlogAuthorId.php
* @author :lyh
* @method :post
* @time :2025/2/21 10:59
... ...
<?php
/**
* @remark :
* @name :NewsExtend.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:08
*/
namespace App\Models\News;
use App\Models\Base;
class NewsExtend extends Base
{
protected $table = 'gl_news_extend';
protected $connection = 'custom_mysql';
const EXTEND_KEY = 'pd_extended_field_';
/**
* @remark :添加扩展字段
* @name :getKey
* @author :lyh
* @method :post
* @time :2025/5/26 15:39
*/
public function getKey($key = self::EXTEND_KEY,$i = 1){
$info = $this->model->read(['key'=>$key.$i]);
if($info !== false){
return $this->getKey($key,$i+1);
}else{
return $key.$i;
}
}
}
... ...
<?php
/**
* @remark :
* @name :NewsExtendInfo.php
* @author :lyh
* @method :post
* @time :2025/5/26 15:49
*/
namespace App\Models\News;
use App\Models\Base;
class NewsExtendInfo extends Base
{
protected $table = 'gl_news_extend_info';
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -197,4 +197,35 @@ class Keyword extends Base
$string_key = array_search($first_title, $this->firstNumWord);
return $string_key ?: 27;
}
public $product_keyword_route = [
"top-search",
"top-search-a",
"top-search-b",
"top-search-c",
"top-search-d",
"top-search-e",
"top-search-f",
"top-search-g",
"top-search-h",
"top-search-i",
"top-search-j",
"top-search-k",
"top-search-l",
"top-search-m",
"top-search-n",
"top-search-o",
"top-search-p",
"top-search-q",
"top-search-r",
"top-search-s",
"top-search-t",
"top-search-u",
"top-search-v",
"top-search-w",
"top-search-x",
"top-search-y",
"top-search-z",
"top-search-0",
];
}
... ...
... ... @@ -26,5 +26,5 @@ class AiBlogTask extends Base
*/
const TYPE_AUTHOR = 1;
const TYPE_BLOG = 2;
const TYPE_VIDEO = 3;
const TYPE_AUTHOR_ID = 3;//根据对应id页面
}
... ...
... ... @@ -9,10 +9,12 @@ use App\Models\Domain\CountryCode;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryForm;
use App\Models\Inquiry\InquiryFormData;
use App\Models\Inquiry\InquiryRelateDomain;
use App\Models\Project\AutoEmail;
use App\Models\Project\AutoEmailLog;
use App\Models\Project\InquiryFilterConfig;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Subscribe\Email;
use App\Models\SyncSubmitTask\SyncSubmitTask;
use App\Models\Visit\Visit;
... ... @@ -20,6 +22,7 @@ use App\Models\WebSetting\WebLanguage;
use App\Models\Workchat\MessagePush;
use App\Utils\LogUtils;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;
... ... @@ -337,6 +340,20 @@ class SyncSubmitTaskService
}
Visit::saveData($visit_data, $visit_data['updated_date']);
//pv
try {
$url_path = trim(parse_url($visit_data['url'], PHP_URL_PATH), '/');
if($url_path){
$route = analysisRoute($url_path);
$row = RouteMap::where('route', $route)->increment('pv');
if(!$row){
Log::channel('visit')->info('route not found:' . $visit_data['url'] );
}
}
}catch (\Exception $e){
Log::channel('visit')->info('pv inc error:' . $visit_data['url'], [$e->getMessage(), $e->getFile(), $e->getLine()]);
}
return true;
}
... ... @@ -383,7 +400,15 @@ class SyncSubmitTaskService
public static function checkIpCountry($domain, $ip, $type){
$project = Project::getProjectByDomain($domain);
if(empty($project)){
throw new InquiryFilterException('项目不存在');
//是否有关联的域名
$relate_domain = InquiryRelateDomain::getRelateDomain($domain);
if(!$relate_domain){
throw new InquiryFilterException('项目不存在1');
}
$project = Project::getProjectByDomain($relate_domain);
if(!$project){
throw new InquiryFilterException('项目不存在2');
}
}
// 访问记录过滤测试环境
... ...
... ... @@ -191,6 +191,12 @@ return [
'level' => 'debug',
'days' => 14,
],
'visit' => [
'driver' => 'daily',
'path' => storage_path('logs/visit/laravel.log'),
'level' => 'debug',
'days' => 14,
],
'ai_blog' => [
'driver' => 'daily',
'path' => storage_path('logs/ai_blog/laravel.log'),
... ...
... ... @@ -73,3 +73,6 @@ Route::any('/addRedirect',[\App\Http\Controllers\Api\NoticeController::class,'ad
Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateController::class, 'inquiry_relate_domain']);
// 通过域名获取项目人员配置
Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']);
// 获取信息通过商户号
Route::any('/get_project_by_mch_id', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectByMchId']);
\ No newline at end of file
... ...
... ... @@ -307,7 +307,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关
Route::any('/getAfterCount', [Aside\Optimize\AfterCountController::class, 'getAfterCount'])->name('admin.optimize_getAfterCount');//售后统计数据
Route::any('/getAfterCountInfo', [Aside\Optimize\AfterCountController::class, 'getAfterCountInfo'])->name('admin.optimize_getAfterCountInfo');//售后统计数据详情
Route::any('/saveIsAnalysis', [Aside\Optimize\OptimizeController::class, 'saveIsAnalysis'])->name('admin.optimize_saveIsAnalysis');//优化中台开启与关闭泛解析
//检查列表
Route::prefix('check_list')->group(function () {
Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists');
... ... @@ -353,12 +353,6 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/save', [Aside\Optimize\ProjectGscController::class, 'save'])->name('admin.gsc_save');
Route::any('/del', [Aside\Optimize\ProjectGscController::class, 'del'])->name('admin.gsc_del');
});
//上线审核
Route::prefix('process')->group(function () {
Route::any('/', [Aside\Optimize\ProcessController::class, 'lists'])->name('admin.process_lists');
Route::any('/save', [Aside\Optimize\ProcessController::class, 'save'])->name('admin.process_save');
});
//询盘
Route::prefix('inquiry')->group(function () {
Route::any('/', [Aside\Optimize\InquiryInfoController::class, 'lists'])->name('admin.inquiry_lists');
... ...
... ... @@ -516,11 +516,6 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/getKeyword', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getKeyword'])->name('month_getKeyword');
});
//更新tdk
Route::prefix('tdk')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk');
});
//导入任务
Route::prefix('import')->group(function () {
Route::any('/add_task', [\App\Http\Controllers\Bside\Import\ImportController::class, 'save'])->name('import_add_task');
... ...