作者 ZhengBing He

fix merger 冲突

正在显示 47 个修改的文件 包含 1432 行增加53 行删除
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AiBlogAuthorId.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:57
  8 + */
  9 +
  10 +namespace App\Console\Commands\Ai;
  11 +
  12 +use App\Models\Domain\DomainInfo;
  13 +use App\Models\Project\AiBlogTask as AiBlogTaskModel;
  14 +use App\Models\Ai\AiBlogAuthor as AiBlogAuthorModel;
  15 +use App\Services\AiBlogService;
  16 +use App\Services\ProjectServer;
  17 +use Illuminate\Console\Command;
  18 +use Illuminate\Support\Facades\DB;
  19 +use Illuminate\Support\Facades\Redis;
  20 +
  21 +class AiBlogAuthorId extends Command
  22 +{
  23 + /**
  24 + * The name and signature of the console command.
  25 + *
  26 + * @var string
  27 + */
  28 + protected $signature = 'save_ai_blog_author_id';
  29 +
  30 + /**
  31 + * The console command description.
  32 + *
  33 + * @var string
  34 + */
  35 + protected $description = '拉取对应作者的页面';
  36 +
  37 + public $route = [];
  38 +
  39 + public function handle(){
  40 + while (true){
  41 + //获取任务id
  42 + $task_id = $this->getTaskId();
  43 + if(empty($task_id)){
  44 + sleep(300);
  45 + continue;
  46 + }
  47 + $this->_action($task_id);
  48 + }
  49 + }
  50 +
  51 + public function getTaskId()
  52 + {
  53 + $task_id = Redis::rpop('ai_blog_author_id');
  54 + if (empty($task_id)) {
  55 + $aiBlogTaskModel = new AiBlogTaskModel();
  56 + $ids = $aiBlogTaskModel->formatQuery(['status'=>$aiBlogTaskModel::STATUS_RUNNING, 'type'=>$aiBlogTaskModel::TYPE_AUTHOR_ID])->pluck('id');
  57 + if(!empty($ids)){
  58 + foreach ($ids as $id) {
  59 + Redis::lpush('ai_blog_author_id', $id);
  60 + }
  61 + }
  62 + $task_id = Redis::rpop('ai_blog_author_id');
  63 + }
  64 + return $task_id;
  65 + }
  66 +
  67 + /**
  68 + * @remark :执行方法
  69 + * @name :_action
  70 + * @author :lyh
  71 + * @method :post
  72 + * @time :2025/5/26 16:06
  73 + */
  74 + public function _action($task_id){
  75 + $aiBlogTaskModel = new AiBlogTaskModel();
  76 + $item = $aiBlogTaskModel->read(['id'=>$task_id]);
  77 + if($item === false){
  78 + echo '当前数据不存在.'.$item['id'].PHP_EOL;
  79 + return true;
  80 + }
  81 + $aiBlogService = new AiBlogService($item['project_id']);
  82 + ProjectServer::useProject($item['project_id']);
  83 + $aiBlogService->author_id = $item['task_id'];
  84 + $result = $aiBlogService->getAuthorDetail();
  85 + if(isset($result['status']) && $result['status'] == 200){
  86 + //当前作者的页面
  87 + $aiBlogAuthorModel = new AiBlogAuthorModel();
  88 + $authorInfo = $aiBlogAuthorModel->read(['author_id'=>$item['task_id']],['id','route']);
  89 + if($authorInfo !== false && !empty($result['data']['section'])){
  90 + $this->route[] = $authorInfo['route'];
  91 + $aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$item['task_id']]);
  92 + }
  93 + }
  94 + DB::disconnect('custom_mysql');
  95 + $aiBlogTaskModel->edit(['status'=>2],['id'=>$task_id]);
  96 + $this->sendCPost($item['project_id']);
  97 + return true;
  98 + }
  99 +
  100 + /**
  101 + * @remark :通知C端
  102 + * @name :sendCPost
  103 + * @author :lyh
  104 + * @method :post
  105 + * @time :2025/5/26 16:21
  106 + */
  107 + public function sendCPost($project_id){
  108 + $domainModel = new DomainInfo();
  109 + $domain = $domainModel->getProjectIdDomain($project_id);
  110 + $c_url = $domain.'api/update_page/';
  111 + $param = [
  112 + 'project_id' => $project_id,
  113 + 'type' => 1,
  114 + 'route' => 3,
  115 + 'url' => $this->route,
  116 + 'language'=> [],
  117 + 'is_sitemap' => 0
  118 + ];
  119 + $res = http_post($c_url, json_encode($param,true));
  120 + echo 'notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
  121 + }
  122 +}
@@ -151,7 +151,7 @@ class DomainInfo extends Command @@ -151,7 +151,7 @@ class DomainInfo extends Command
151 $serverIpModel = new ServersIp(); 151 $serverIpModel = new ServersIp();
152 $domainCreateTaskModel = new DomainCreateTask(); 152 $domainCreateTaskModel = new DomainCreateTask();
153 $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 153 $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
154 - $list = $domainModel->where('status', '=', 1)->where('type', '=', 1)->where('certificate_end_time', '<', $end_day)->get()->toArray(); 154 + $list = $domainModel->where('status', '=', 1)->where('type', '!=', 2)->where('certificate_end_time', '<', $end_day)->get()->toArray();
155 foreach ($list as $v) { 155 foreach ($list as $v) {
156 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']); 156 $project_info = $projectModel->read(['id' => $v['project_id'], 'type' => ['!=', Project::TYPE_CLOSE]], ['serve_id', 'project_type']);
157 if (!$project_info) { 157 if (!$project_info) {
@@ -204,7 +204,7 @@ class DomainInfo extends Command @@ -204,7 +204,7 @@ class DomainInfo extends Command
204 $serverIpModel = new ServersIp(); 204 $serverIpModel = new ServersIp();
205 $domainCreateTaskModel = new DomainCreateTask(); 205 $domainCreateTaskModel = new DomainCreateTask();
206 $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期 206 $end_day = date('Y-m-d H:i:s', time() + 3 * 24 * 3600);//3天后到期
207 - $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '=', 1)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray(); 207 + $list = $domainModel->where('status', '=', 1)->where('amp_status', 1)->where('amp_type', '!=', 2)->where('amp_certificate_end_time', '<', $end_day)->get()->toArray();
208 foreach ($list as $v) { 208 foreach ($list as $v) {
209 $domain_array = parse_url($v['domain']); 209 $domain_array = parse_url($v['domain']);
210 $host = $domain_array['host'] ?? $domain_array['path']; 210 $host = $domain_array['host'] ?? $domain_array['path'];
@@ -42,7 +42,8 @@ class RemainDay extends Command @@ -42,7 +42,8 @@ class RemainDay extends Command
42 1703, 42 1703,
43 1893, 43 1893,
44 2066, 44 2066,
45 - 2250 45 + 2250,
  46 + 2193
46 ];//需要单独处理的项目 47 ];//需要单独处理的项目
47 /** 48 /**
48 * The console command description. 49 * The console command description.
@@ -126,11 +127,12 @@ class RemainDay extends Command @@ -126,11 +127,12 @@ class RemainDay extends Command
126 }else{ 127 }else{
127 $seo_remain_day = $deploy_build['seo_service_duration']; 128 $seo_remain_day = $deploy_build['seo_service_duration'];
128 } 129 }
129 - if($seo_remain_day < 0){  
130 - $seo_remain_day = 0;  
131 - }  
132 - if($deploy_build['plan'] == 0 && $seo_remain_day == 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常未0,放入未续费中  
133 - $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]); 130 +// if($seo_remain_day < 0){
  131 +// $seo_remain_day = 0;
  132 +// }
  133 + if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
  134 +// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
  135 + $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
134 }else{ 136 }else{
135 //同时包括白帽版本+默认版本的项目 137 //同时包括白帽版本+默认版本的项目
136 $this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]); 138 $this->project->edit(['seo_remain_day'=>$seo_remain_day],['id'=>$item['id']]);
@@ -174,10 +176,10 @@ class RemainDay extends Command @@ -174,10 +176,10 @@ class RemainDay extends Command
174 } 176 }
175 } 177 }
176 $extend_type = 0; 178 $extend_type = 0;
177 - if($remain_day < 0 && $deploy_build['service_duration'] != 0){  
178 - $remain_day = 0;  
179 - $extend_type = Project::TYPE_FIVE;  
180 - } 179 +// if($remain_day < 0 && $deploy_build['service_duration'] != 0){
  180 +// $remain_day = 0;
  181 +// $extend_type = Project::TYPE_FIVE;
  182 +// }
181 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); 183 $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
182 return true; 184 return true;
183 } 185 }
@@ -52,14 +52,55 @@ class LyhImportTest extends Command @@ -52,14 +52,55 @@ class LyhImportTest extends Command
52 * @time :2023/11/20 15:13 52 * @time :2023/11/20 15:13
53 */ 53 */
54 public function handle(){ 54 public function handle(){
55 - ProjectServer::useProject(2140); 55 + ProjectServer::useProject(3951);
56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
57 - $this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',2140); 57 + $this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',3951);
58 DB::disconnect('custom_mysql'); 58 DB::disconnect('custom_mysql');
59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
60 } 60 }
61 61
62 /** 62 /**
  63 + * @remark :3951项目导入产品
  64 + * @name :import3951Product
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2025/5/24 11:32
  68 + */
  69 + public function import3951Product($url,$project_id){
  70 + $line_of_text = [];
  71 + $opts = [
  72 + 'http' => [
  73 + 'method' => 'GET',
  74 + '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'
  75 + ],
  76 + 'ssl' => [
  77 + 'verify_peer' => false,
  78 + 'verify_peer_name' => false
  79 + ]
  80 + ];
  81 + $file_handle = fopen($url, 'r', null, stream_context_create($opts));
  82 + while (!feof($file_handle)) {
  83 + $line_of_text[] = fgetcsv($file_handle, 0, ',');
  84 + }
  85 + fclose($file_handle);
  86 + $saveData = [];
  87 + foreach ($line_of_text as $k => $val){
  88 + if($k < 1){
  89 + continue;
  90 + }
  91 + if(empty($val[0])){
  92 + echo '跳过的名称:'.$val[0];
  93 + continue;
  94 + }
  95 + $saveData[] = [
  96 + 'title'=>$val[0],
  97 + 'thumb' => json_encode(['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]],true),
  98 + 'gallery' => json_encode([['alt'=>'主图','url'=>'/upload/p/3951/image/',$val[2]]],true)
  99 + ];
  100 + }
  101 + }
  102 +
  103 + /**
63 * @remark :导入产品分类 104 * @remark :导入产品分类
64 * @name :productCategory 105 * @name :productCategory
65 * @author :lyh 106 * @author :lyh
@@ -13,8 +13,10 @@ use App\Console\Commands\Domain\DomainInfo; @@ -13,8 +13,10 @@ use App\Console\Commands\Domain\DomainInfo;
13 use App\Http\Logic\Aside\Project\ProjectLogic; 13 use App\Http\Logic\Aside\Project\ProjectLogic;
14 use App\Models\Ai\AiBlog; 14 use App\Models\Ai\AiBlog;
15 use App\Models\Ai\AiBlogAuthor; 15 use App\Models\Ai\AiBlogAuthor;
  16 +use App\Models\Ai\AiCommand;
16 use App\Models\Com\NoticeLog; 17 use App\Models\Com\NoticeLog;
17 use App\Models\Com\V6WeeklyReport; 18 use App\Models\Com\V6WeeklyReport;
  19 +use App\Models\Product\Category;
18 use App\Models\Project\AiBlogTask; 20 use App\Models\Project\AiBlogTask;
19 use App\Models\Project\DeployBuild; 21 use App\Models\Project\DeployBuild;
20 use App\Models\Project\DeployOptimize; 22 use App\Models\Project\DeployOptimize;
@@ -23,11 +25,14 @@ use App\Models\Project\Project; @@ -23,11 +25,14 @@ use App\Models\Project\Project;
23 use App\Models\Project\ProjectAiSetting; 25 use App\Models\Project\ProjectAiSetting;
24 use App\Models\ProjectAssociation\ProjectAssociation; 26 use App\Models\ProjectAssociation\ProjectAssociation;
25 use App\Models\RouteMap\RouteMap; 27 use App\Models\RouteMap\RouteMap;
  28 +use App\Models\Template\BTemplateMain;
  29 +use App\Models\Template\TemplateTypeMain;
26 use App\Models\Visit\Visit; 30 use App\Models\Visit\Visit;
27 use App\Models\WebSetting\WebLanguage; 31 use App\Models\WebSetting\WebLanguage;
28 use App\Models\WebSetting\WebSetting; 32 use App\Models\WebSetting\WebSetting;
29 use App\Models\Workchat\MessagePush; 33 use App\Models\Workchat\MessagePush;
30 use App\Services\AiBlogService; 34 use App\Services\AiBlogService;
  35 +use App\Services\AiCommandService;
31 use App\Services\ProjectServer; 36 use App\Services\ProjectServer;
32 use Illuminate\Console\Command; 37 use Illuminate\Console\Command;
33 use Illuminate\Support\Facades\Schema; 38 use Illuminate\Support\Facades\Schema;
@@ -51,9 +56,44 @@ class lyhDemo extends Command @@ -51,9 +56,44 @@ class lyhDemo extends Command
51 protected $description = '更新路由'; 56 protected $description = '更新路由';
52 57
53 public function handle(){ 58 public function handle(){
54 - dd(111); 59 + $string = '<p>Wow, the 137th Canton Fair was quite a game changer for EV Charging Pile suppliers! Seriously, it showcased some amazing growth in international participation and trade opportunities. Can you believe it? They reported a record-breaking 288,938 overseas buyers from 219 countries and regions, which is a 17.3% jump compared to the last fair. This kind of surge really highlights just how much the demand for electric vehicle infrastructure is ramping up. Industry forecasts suggest global EV sales could hit around 26 million units by 2030! And get this, export intentions at the fair climbed to a whopping $25.44 billion, marking a 3% increase. It’s clear that this fair has become a vital hub for manufacturers and suppliers in the EV Charging Pile sector, connecting them with international markets. Plus, the online platform keeps the networking going year-round, so companies can tap into new opportunities even after the fair wraps up. As everyone gears up for the 138th Canton Fair, it’s the perfect time for businesses to strategically carve out their space in the ever-growing EV charging scene.</p><img src="https://ecdn6.globalso.com/public/img/2025-05-24/9834757034_0.png" alt="Unlocking Global Opportunities at the 137th Canton Fair for Ev Charging Pile Suppliers" itemprop="image">';
  60 + $promote = AiCommand::where(['key' => 'ai_layout_design'])->first();
  61 + $promote = str_replace("{html}", $string, $promote->ai);
  62 + $aiCommandService = new AiCommandService();
  63 + $result = $aiCommandService->send_layout_design($promote);
  64 + dd($result);
  65 + return true;
  66 + }
  67 +
  68 + public function _actionTemplateMain(){
  69 + $data = [];
  70 + $projectModel = new Project();
  71 + $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
  72 + foreach ($lists as $val){
  73 + echo date('Y-m-d H:i:s') . '开始--项目的id:'. $val['id'] . PHP_EOL;
  74 + ProjectServer::useProject($val['id']);
  75 + $bTemplateMainModel = new BTemplateMain();
  76 + $info = $bTemplateMainModel->read(['type'=>2,'is_list'=>1],['id']);
  77 + $categoryModel = new Category();
  78 + $count = $categoryModel->counts(['id'=>['>',0]]);
  79 + if(($info === false) && ($count > 0)){
  80 + $mainModel = new TemplateTypeMain();
  81 + $mainInfo = $mainModel->read(['type'=>2,'is_list'=>1]);
  82 + $main_html = $mainInfo['main_html'];
  83 + $main_css = "<style id='globalsojs-styles'></style>";
  84 + //写入一条初始数据
  85 + $bTemplateMainModel->addReturnId(['type'=>2,'is_list'=>1,'is_custom'=>0,'project_id'=>$val['id'],'main_html'=>$main_html,'main_css'=>$main_css]);
  86 + $data[] = $val['id'];
  87 + }
  88 + DB::disconnect('custom_mysql');
  89 + echo date('Y-m-d H:i:s') . '结束--项目的id:'. $val['id'] . PHP_EOL;
  90 + }
  91 + dd($data);
  92 + }
  93 +
  94 + public function _action_ai_blog(){
55 $projectModel = new Project(); 95 $projectModel = new Project();
56 - $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']); 96 + $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
57 foreach ($lists as $val) { 97 foreach ($lists as $val) {
58 $aiSettingInfo = $this->getSetting($val['id']); 98 $aiSettingInfo = $this->getSetting($val['id']);
59 if($aiSettingInfo === false){ 99 if($aiSettingInfo === false){
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 namespace App\Console\Commands\Monitor; 8 namespace App\Console\Commands\Monitor;
9 9
10 use App\Models\Domain\DomainInfo; 10 use App\Models\Domain\DomainInfo;
  11 +use App\Models\PackDir\SitePackTask;
11 use App\Models\Product\Keyword; 12 use App\Models\Product\Keyword;
12 use App\Models\Project\DeployOptimize; 13 use App\Models\Project\DeployOptimize;
13 use App\Models\Project\OnlineCheck; 14 use App\Models\Project\OnlineCheck;
@@ -183,14 +184,14 @@ class Supervisory extends Command @@ -183,14 +184,14 @@ class Supervisory extends Command
183 $ids = Project::leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') 184 $ids = Project::leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id')
184 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') 185 ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
185 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') 186 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
186 - ->where('gl_project_deploy_optimize.domain','!=',0) 187 + ->where('b.domain','!=',0)
187 ->where('gl_project.type', Project::TYPE_TWO) 188 ->where('gl_project.type', Project::TYPE_TWO)
188 ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 189 ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
189 ->where('gl_project.delete_status', Project::IS_DEL_FALSE) 190 ->where('gl_project.delete_status', Project::IS_DEL_FALSE)
190 ->where(function ($subQuery) { 191 ->where(function ($subQuery) {
191 $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); 192 $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
192 }) 193 })
193 - ->pluck('gl_project.id') 194 + ->pluck('gl_project.type','gl_project.id')
194 ->toArray(); 195 ->toArray();
195 $project_ids = array_rand($ids, 10); 196 $project_ids = array_rand($ids, 10);
196 return $project_ids; 197 return $project_ids;
@@ -296,6 +297,14 @@ class Supervisory extends Command @@ -296,6 +297,14 @@ class Supervisory extends Command
296 $message[] = '404页面链接: ' . implode(' 、 ', $page_404); 297 $message[] = '404页面链接: ' . implode(' 、 ', $page_404);
297 $message[] = 'TDK错误链接: ' . implode(' 、 ', $tdk_error); 298 $message[] = 'TDK错误链接: ' . implode(' 、 ', $tdk_error);
298 299
  300 + //前一天页面生成失败白帽项目
  301 + $last_day = date('Y-m-d',strtotime('-1 day'));
  302 + $white_project_ids = SitePackTask::where('status',SitePackTask::STATUS_FAL)->where('user_id',0)->whereBetween('created_at', [$last_day.' 00:00:00',$last_day.' 23:59:59'])->pluck('project_id')->toArray();
  303 + if($white_project_ids){
  304 + $white_domain_list = DomainInfo::whereIn('project_id',$white_project_ids)->pluck('domain')->toArray();
  305 + $message[] = '页面生成失败白帽项目: ' . implode(' 、 ', $white_domain_list);
  306 + }
  307 +
299 $msg = implode(PHP_EOL, $message); 308 $msg = implode(PHP_EOL, $message);
300 309
301 $link = 'https://oapi.dingtalk.com/robot/send?access_token=3927b42d072972fcf572e7b01728bf3e1390e08094d6f77c5f28bfd85b19f09f'; 310 $link = 'https://oapi.dingtalk.com/robot/send?access_token=3927b42d072972fcf572e7b01728bf3e1390e08094d6f77c5f28bfd85b19f09f';
@@ -53,11 +53,14 @@ class SyncSubmitTask extends Command @@ -53,11 +53,14 @@ class SyncSubmitTask extends Command
53 } 53 }
54 try { 54 try {
55 //有globalso-domain时,用globalso-domain,兼容白帽版的-海龙 55 //有globalso-domain时,用globalso-domain,兼容白帽版的-海龙
56 - if(!empty($task_info['data']['data']['globalso-domain'])){  
57 - $data = $task_info['data'];  
58 - $data['domain'] = $task_info['data']['data']['globalso-domain'];  
59 - $task_info['data'] = $data; 56 + $data = $task_info['data']['data'];
  57 + if(!empty($data['globalso-domain']) || !empty($data['globalso-domain_host_url'])){
  58 + $task_data = $task_info['data'];
  59 + !empty($data['globalso-domain']) && $task_data['domain'] = $data['globalso-domain'];
  60 + !empty($data['globalso-domain_host_url']) && $task_data['referer'] = $data['globalso-domain_host_url'];
  61 + $task_info['data'] = $task_data;
60 } 62 }
  63 +
61 $project = Project::getProjectByDomain($task_info['data']['domain'] ?? ''); 64 $project = Project::getProjectByDomain($task_info['data']['domain'] ?? '');
62 if(!$project){ 65 if(!$project){
63 //是否有关联的域名 66 //是否有关联的域名
@@ -10,6 +10,7 @@ use App\Models\Subscribe\Smtp; @@ -10,6 +10,7 @@ use App\Models\Subscribe\Smtp;
10 use App\Models\Workchat\MessagePush; 10 use App\Models\Workchat\MessagePush;
11 use App\Services\Aside\ProjectAssociation\ProjectAssociationServices; 11 use App\Services\Aside\ProjectAssociation\ProjectAssociationServices;
12 use Illuminate\Console\Command; 12 use Illuminate\Console\Command;
  13 +use Illuminate\Http\Client\ConnectionException;
13 use Illuminate\Support\Facades\Config; 14 use Illuminate\Support\Facades\Config;
14 use Illuminate\Support\Facades\Mail; 15 use Illuminate\Support\Facades\Mail;
15 16
@@ -44,6 +45,10 @@ class WorkchatMessageSend extends Command @@ -44,6 +45,10 @@ class WorkchatMessageSend extends Command
44 ProjectAssociationServices::getInstance()->sendMessage($task->friend_id, $task->content, $task->content_type); 45 ProjectAssociationServices::getInstance()->sendMessage($task->friend_id, $task->content, $task->content_type);
45 $this->output('推送消息' . $task->id . '成功'); 46 $this->output('推送消息' . $task->id . '成功');
46 $task->status = MessagePush::STATUS_SUCCESS; 47 $task->status = MessagePush::STATUS_SUCCESS;
  48 + }catch (ConnectionException $e){
  49 + $this->output('推送消息' . $task->id . '超时');
  50 + $task->status = MessagePush::STATUS_ERROR;
  51 + $task->remark = '请求超时';
47 }catch (\Exception $e){ 52 }catch (\Exception $e){
48 $this->output('推送消息' . $task->id . '失败:' . $e->getMessage()); 53 $this->output('推送消息' . $task->id . '失败:' . $e->getMessage());
49 $task->status = MessagePush::STATUS_ERROR; 54 $task->status = MessagePush::STATUS_ERROR;
@@ -6,6 +6,7 @@ namespace App\Console\Commands\Test; @@ -6,6 +6,7 @@ namespace App\Console\Commands\Test;
6 6
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Helper\FormGlobalsoApi; 8 use App\Helper\FormGlobalsoApi;
  9 +use App\Models\Ai\AiCommand;
9 use App\Models\Domain\DomainInfo; 10 use App\Models\Domain\DomainInfo;
10 use App\Models\HomeCount\Count; 11 use App\Models\HomeCount\Count;
11 use App\Models\Inquiry\InquiryFormData; 12 use App\Models\Inquiry\InquiryFormData;
@@ -17,6 +18,7 @@ use App\Models\Project\ProjectUpdateTdk; @@ -17,6 +18,7 @@ use App\Models\Project\ProjectUpdateTdk;
17 use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel; 18 use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
18 use App\Models\WebSetting\Translate as TranslateModel; 19 use App\Models\WebSetting\Translate as TranslateModel;
19 use App\Models\WebSetting\WebLanguage; 20 use App\Models\WebSetting\WebLanguage;
  21 +use App\Services\AiCommandService;
20 use App\Services\ProjectServer; 22 use App\Services\ProjectServer;
21 use Carbon\Carbon; 23 use Carbon\Carbon;
22 use Illuminate\Console\Command; 24 use Illuminate\Console\Command;
@@ -60,6 +62,13 @@ class Test extends Command @@ -60,6 +62,13 @@ class Test extends Command
60 */ 62 */
61 public function handle() 63 public function handle()
62 { 64 {
  65 + $string = '';
  66 + $promote = AiCommand::where(['key' => 'ai_layout_design'])->frist();
  67 + $promote = str_replace("{html}", $string, $promote->ai);
  68 + $aiCommandService = new AiCommandService();
  69 + $result = $aiCommandService->send_layout_design($promote);
  70 + dd($result);
  71 +
63 $string = 'eyJpdiI6ImxDWW96VUdGVk5QcEZ5dnRyd2lzVkE9PSIsInZhbHVlIjoiRGJSRXdQZDdtMFp1Tjh5c21jTWRKbjh4SWNMeWpRR1hWdE1HdVR3cEI5MjNYdjA0d2hKemV5ZjFoNUd4enNKaklaNXZwUUFtbDhIUkxyckVwYTJ6YnE3V2pMdmUyeU5lblNPQXNsbHl2U0hFOTZ1NERTTStUb2dnQmhMTzZMMXVCV0REeiszQ3NcL0l1ZGhTSkI5a3J3TkRoVFhteHpFcXpcL3FwRkVGVG1sN2xBTlFJemZiZ3N1Sk1PT3Z2T1Jld2MiLCJtYWMiOiIzZmU5OTRiZTMyNWZhNzczMzUzZTc1YjFlODg0MGFhNDJlM2Q2MDhhMDY4YWQxNWFlNjNlYjczYmJmZThkOWJlIn0%3D'; 72 $string = 'eyJpdiI6ImxDWW96VUdGVk5QcEZ5dnRyd2lzVkE9PSIsInZhbHVlIjoiRGJSRXdQZDdtMFp1Tjh5c21jTWRKbjh4SWNMeWpRR1hWdE1HdVR3cEI5MjNYdjA0d2hKemV5ZjFoNUd4enNKaklaNXZwUUFtbDhIUkxyckVwYTJ6YnE3V2pMdmUyeU5lblNPQXNsbHl2U0hFOTZ1NERTTStUb2dnQmhMTzZMMXVCV0REeiszQ3NcL0l1ZGhTSkI5a3J3TkRoVFhteHpFcXpcL3FwRkVGVG1sN2xBTlFJemZiZ3N1Sk1PT3Z2T1Jld2MiLCJtYWMiOiIzZmU5OTRiZTMyNWZhNzczMzUzZTc1YjFlODg0MGFhNDJlM2Q2MDhhMDY4YWQxNWFlNjNlYjczYmJmZThkOWJlIn0%3D';
64 $string_aicc = 'eyJpdiI6ImE0UDhxK25EY3RXLzI3bGZYM3BRVUE9PSIsInZhbHVlIjoiZ01IN0JBMmpNQ0EwWjJ5VmhMVFNrS2ZlRjY3ZmVpRExtdjh3MTQ4enkyK2gzMjJCajV1QXNKYjA4YlV6Z0dVMU0xMWdOTmJXZ0NWTDdRS3lSUWNhNmJsUW5qc0pIYjE4cm40ZkVXNkdibWVnSVR2dG4wUVp5Y1MyU3RrUnJZd3RCa1IzZ05nRC9FVUt5Q2xuZmVYNDFnPT0iLCJtYWMiOiIyZjZiYmRjNWY5N2E0MGUxNjAzNWYxZjVlMGUyNWE2OTk0MzhiY2UyYWNkYzY5MzA0YmJmYmYzNjM1YjIyY2QwIn0='; 73 $string_aicc = 'eyJpdiI6ImE0UDhxK25EY3RXLzI3bGZYM3BRVUE9PSIsInZhbHVlIjoiZ01IN0JBMmpNQ0EwWjJ5VmhMVFNrS2ZlRjY3ZmVpRExtdjh3MTQ4enkyK2gzMjJCajV1QXNKYjA4YlV6Z0dVMU0xMWdOTmJXZ0NWTDdRS3lSUWNhNmJsUW5qc0pIYjE4cm40ZkVXNkdibWVnSVR2dG4wUVp5Y1MyU3RrUnJZd3RCa1IzZ05nRC9FVUt5Q2xuZmVYNDFnPT0iLCJtYWMiOiIyZjZiYmRjNWY5N2E0MGUxNjAzNWYxZjVlMGUyNWE2OTk0MzhiY2UyYWNkYzY5MzA0YmJmYmYzNjM1YjIyY2QwIn0=';
65 $string_fob = 'eyJpdiI6IlBwOXRPL1ZUV1F1SHZpVnpaQkUwSWc9PSIsInZhbHVlIjoiVGFxcTFmSDBvL0hkSldEWkh0elRlaXpkOHJTQW1OeWlDZmMvMndaeXF0SE5YYXd1YjE3MWpPTTZuVEdlSEYzY3VmeXdSbmI5T0d0ZkxXZTRxb3laNWpCdFJxQ2dlQlExemZrRVFFeStxQm40a2VuNWxpUmFpdFoyZjJxMzRLYXBOK0hKa0JvcFlVQklDWE9yR3hEdEVBPT0iLCJtYWMiOiI3NDg5ZDViMjJiNzM3ZjAyZDUxZTAxODVlYjdhYWVmZWFjZDM2ZTE0M2NkNjEwODdjNTJjNmM1NmNlOTUxYjdiIn0='; 74 $string_fob = 'eyJpdiI6IlBwOXRPL1ZUV1F1SHZpVnpaQkUwSWc9PSIsInZhbHVlIjoiVGFxcTFmSDBvL0hkSldEWkh0elRlaXpkOHJTQW1OeWlDZmMvMndaeXF0SE5YYXd1YjE3MWpPTTZuVEdlSEYzY3VmeXdSbmI5T0d0ZkxXZTRxb3laNWpCdFJxQ2dlQlExemZrRVFFeStxQm40a2VuNWxpUmFpdFoyZjJxMzRLYXBOK0hKa0JvcFlVQklDWE9yR3hEdEVBPT0iLCJtYWMiOiI3NDg5ZDViMjJiNzM3ZjAyZDUxZTAxODVlYjdhYWVmZWFjZDM2ZTE0M2NkNjEwODdjNTJjNmM1NmNlOTUxYjdiIn0=';
@@ -35,6 +35,7 @@ class UpdateKeyword extends Command @@ -35,6 +35,7 @@ class UpdateKeyword extends Command
35 35
36 36
37 public function handle(){ 37 public function handle(){
  38 + dd(1111);
38 while (true){ 39 while (true){
39 $keywordPageModel = new KeywordPage(); 40 $keywordPageModel = new KeywordPage();
40 $lists = $keywordPageModel->list(['status'=>0]); 41 $lists = $keywordPageModel->list(['status'=>0]);
@@ -74,19 +75,40 @@ class UpdateKeyword extends Command @@ -74,19 +75,40 @@ class UpdateKeyword extends Command
74 return false; 75 return false;
75 } 76 }
76 $number = count($text); 77 $number = count($text);
77 - $randomNumber = rand(0, $number - 1);  
78 if($updateObject['type'] == 0){//更新所有关键字 78 if($updateObject['type'] == 0){//更新所有关键字
79 - $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['status'=>1]); 79 + //获取所有关键字的id
  80 + $idArr = $keywordModel->selectField(['id'=>['>',0]],'id');
  81 + if($info['update_method'] != 1){
  82 + $idArr = shuffle($idArr);
  83 + }
  84 + $result = $this->splitArrayIntoParts($idArr,$number);
  85 + foreach ($result as $key => $val){
  86 + $keywordModel->edit(['keyword_content'=>$text[$key]],['id'=>['in',$val]]);
  87 + }
80 }else{ 88 }else{
81 //按传递的关键字更新 89 //按传递的关键字更新
82 if(!empty($updateObject['keyword'])){ 90 if(!empty($updateObject['keyword'])){
83 $updateObject['keyword'] = (array)$updateObject['keyword']; 91 $updateObject['keyword'] = (array)$updateObject['keyword'];
84 - $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>['in',$updateObject['keyword']]]); 92 + foreach ($updateObject['keyword'] as $key => $item){
  93 + if($info['update_method'] != 1){
  94 + $randomNumber = rand(0, $number - 1);
  95 + }else{
  96 + $randomNumber = $text[$key] ?? rand(0, $number - 1);
  97 + }
  98 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
  99 + }
85 } 100 }
86 //按给定的数量更新 101 //按给定的数量更新
87 if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){ 102 if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){
88 $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray(); 103 $keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray();
89 - $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['id'=>['in',$keywordIdArr]]); 104 + foreach ($keywordIdArr as $key => $item){
  105 + if($info['update_method'] != 1){
  106 + $randomNumber = rand(0, $number - 1);
  107 + }else{
  108 + $randomNumber = $text[$key] ?? rand(0, $number - 1);
  109 + }
  110 + $keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
  111 + }
90 } 112 }
91 } 113 }
92 return true; 114 return true;
@@ -108,4 +130,21 @@ class UpdateKeyword extends Command @@ -108,4 +130,21 @@ class UpdateKeyword extends Command
108 return true; 130 return true;
109 } 131 }
110 132
  133 +
  134 + public function splitArrayIntoParts(array $data, int $parts): array
  135 + {
  136 + $count = count($data);
  137 + // 每份的最小长度(向下取整)
  138 + $minSize = intdiv($count, $parts);
  139 + // 余数(说明有一些数组项要平均分配给前面的几份)
  140 + $remainder = $count % $parts;
  141 + $result = [];
  142 + $start = 0;
  143 + for ($i = 0; $i < $parts; $i++) {
  144 + $size = $minSize + ($i < $remainder ? 1 : 0);
  145 + $result[] = array_slice($data, $start, $size);
  146 + $start += $size;
  147 + }
  148 + return $result;
  149 + }
111 } 150 }
1 <?php 1 <?php
2 2
  3 +use App\Helper\Translate;
3 use App\Models\File\Image; 4 use App\Models\File\Image;
4 use App\Models\File\File as FileModel; 5 use App\Models\File\File as FileModel;
5 use App\Models\Project\DeployOptimize; 6 use App\Models\Project\DeployOptimize;
@@ -851,7 +852,7 @@ function getCustomRouteMap($module_route,$route = '') @@ -851,7 +852,7 @@ function getCustomRouteMap($module_route,$route = '')
851 * @method :post 852 * @method :post
852 * @time :2023/11/10 14:29 853 * @time :2023/11/10 14:29
853 */ 854 */
854 -function getRouteMap($source,$source_id,$is_upgrade = 0){ 855 +function getRouteMap($source,$source_id,$is_upgrade = 0, $returnModel = false){
855 $route = ''; 856 $route = '';
856 $routeMapModel = new RouteMap(); 857 $routeMapModel = new RouteMap();
857 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); 858 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]);
@@ -878,6 +879,9 @@ function getRouteMap($source,$source_id,$is_upgrade = 0){ @@ -878,6 +879,9 @@ function getRouteMap($source,$source_id,$is_upgrade = 0){
878 $route = $info['route']; 879 $route = $info['route'];
879 } 880 }
880 } 881 }
  882 + if($returnModel){
  883 + return $info;
  884 + }
881 return $route; 885 return $route;
882 } 886 }
883 887
@@ -1237,4 +1241,115 @@ function getDomain($url) { @@ -1237,4 +1241,115 @@ function getDomain($url) {
1237 } 1241 }
1238 1242
1239 1243
  1244 +/**
  1245 + * 解析url的 route
  1246 + * @param $pathInfo
  1247 + * @return string
  1248 + * @author zbj
  1249 + * @date 2025/5/24
  1250 + */
  1251 +function analysisRoute($pathInfo)
  1252 +{
  1253 + $language = '';
  1254 + $router = "";
  1255 + $page = null;
  1256 +
  1257 + $pathArr = explode("/", $pathInfo);
  1258 + $pathArr = array_filter($pathArr);
  1259 + $first = array_shift($pathArr);
  1260 + $last = array_pop($pathArr);
  1261 + $other = implode("/", $pathArr);
  1262 +
  1263 + $first = $first == "zh-ct" ? "zh-TW" : $first;
  1264 + $tlsLang = array_keys(Translate::$tls_list);
  1265 + if (in_array($first, $tlsLang)) {
  1266 + $language = $first;
  1267 + $first = '';
  1268 + }
  1269 + $lastIsRoute = RouteMap::select("id")->where("route", $last)->first();
  1270 + if (is_numeric($last) && empty($lastIsRoute)) {
  1271 + $page = $last;
  1272 + $last = '';
  1273 + }
  1274 + $router_array = compact('first', 'other', 'last');
  1275 + $router_array = array_filter($router_array);
  1276 +
  1277 + //解析路由5.0 + 6.0
  1278 + $keyword = new \App\Models\Product\Keyword();
  1279 + $topSearchRoute = $keyword->product_keyword_route;
  1280 + if (isset($router_array['first'])) {
  1281 + if (isset($router_array['other'])) {
  1282 + if ($router_array['other'] == "page") {
  1283 + $router = $router_array['first'];
  1284 + } else {
  1285 + $otherArr = explode("/", $router_array['other']);
  1286 + $otherArr = array_filter($otherArr);
  1287 + if (count($otherArr) >= 1) {
  1288 + $router = $otherArr[0];
  1289 + }
  1290 + }
  1291 + } else {
  1292 + if (isset($router_array['last'])) {
  1293 + if (in_array($router_array['first'], $topSearchRoute)) {
  1294 + $router = $router_array['first'];
  1295 + $page = (int)$router_array['last'];
  1296 + } else {
  1297 + $router = $router_array['last'];
  1298 + }
  1299 + } else {
  1300 + $router = $router_array['first'];
  1301 + }
  1302 + }
  1303 + } else {
  1304 + if (isset($router_array['last'])) {
  1305 + if ($router_array['last'] != "page") {
  1306 + if (isset($router_array['other']) && in_array($router_array['other'], $topSearchRoute)) {
  1307 + $router = $router_array['other'];
  1308 + $page = (int)$router_array['last'];
  1309 + } else {
  1310 + $router = $router_array['last'];
  1311 + }
  1312 + } else {
  1313 + $otherArr = explode("/", $router_array['other']);
  1314 + $otherArr = array_filter($otherArr);
  1315 + if (count($otherArr) == 1) {
  1316 + $router = $otherArr[0];
  1317 + } else {
  1318 + $router = $otherArr[1];
  1319 + }
  1320 + }
  1321 + } else {
  1322 + if (!empty($router_array)) {
  1323 + $otherArr = explode("/", $router_array['other']);
  1324 + $otherArr = array_filter($otherArr);
  1325 + if (count($otherArr) == 3) {
  1326 + $router = $otherArr[1];
  1327 + } else {
  1328 + $router = $otherArr[0];
  1329 + }
  1330 + }
  1331 + }
  1332 + }
1240 1333
  1334 + //路由算法处理,路由只有一级,route_map表中route(规定),不考虑小语种
  1335 + //新增考虑小语种,判断是否小语种访问,有页面不说,当nginx 404页面之后进程序,生成当前小语种页面
  1336 + $lang = $language;
  1337 + if ($page == null) {
  1338 + if ($router != null) {
  1339 + if ($lang != null) {
  1340 + $tlsLang = array_keys(Translate::$tls_list);
  1341 + $isLang = in_array($lang, $tlsLang);
  1342 + if (!$isLang) {
  1343 + $router = $lang;
  1344 + }
  1345 + }
  1346 + } else {
  1347 + $tlsLang = array_keys(Translate::$tls_list);
  1348 + $isLang = in_array($lang, $tlsLang);
  1349 + if (!$isLang) {
  1350 + $router = $lang;
  1351 + }
  1352 + }
  1353 + }
  1354 + return $router;
  1355 +}
@@ -23,6 +23,7 @@ use App\Models\Project\DeployBuild; @@ -23,6 +23,7 @@ use App\Models\Project\DeployBuild;
23 use App\Models\Project\DeployOptimize; 23 use App\Models\Project\DeployOptimize;
24 use App\Models\Project\OnlineCheck; 24 use App\Models\Project\OnlineCheck;
25 use App\Models\Project\Project; 25 use App\Models\Project\Project;
  26 +use App\Models\Project\ProjectAiSetting;
26 use App\Models\Project\ProjectKeyword; 27 use App\Models\Project\ProjectKeyword;
27 use App\Models\RouteMap\RouteMap; 28 use App\Models\RouteMap\RouteMap;
28 use App\Models\User\User; 29 use App\Models\User\User;
@@ -538,4 +539,21 @@ class PrivateController extends BaseController @@ -538,4 +539,21 @@ class PrivateController extends BaseController
538 ]; 539 ];
539 return $this->success($result); 540 return $this->success($result);
540 } 541 }
  542 +
  543 + /**
  544 + * 获取项目信息,通过商户号
  545 + * @param Request $request
  546 + * @return false|string
  547 + */
  548 + public function getProjectByMchId(Request $request)
  549 + {
  550 + $mch_id = intval($request->input('mch_id'));
  551 + $project_setting = ProjectAiSetting::where(['mch_id' => $mch_id])->first();
  552 + if (empty($project_setting))
  553 + return $this->error('商户号未匹配到项目');
  554 + $domain = DomainInfo::where(['status' => 1, 'project_id' => $project_setting->project_id])->first();
  555 + if (empty($domain))
  556 + return $this->error('项目未匹配到域名');
  557 + return $this->success(['domain' => $domain->domain]);
  558 + }
541 } 559 }
@@ -38,6 +38,7 @@ class CheckListController extends BaseController @@ -38,6 +38,7 @@ class CheckListController extends BaseController
38 */ 38 */
39 public function lists(){ 39 public function lists(){
40 $this->map['status'] = 1; 40 $this->map['status'] = 1;
  41 + $this->map['type'] = $this->map['type'] ?? 1;
41 $field = ['id','status','sort','text','created_at']; 42 $field = ['id','status','sort','text','created_at'];
42 $data = $this->model->lists($this->map,$this->page,$this->row,'id',$field); 43 $data = $this->model->lists($this->map,$this->page,$this->row,'id',$field);
43 $this->response('success',Code::SUCCESS,$data); 44 $this->response('success',Code::SUCCESS,$data);
@@ -52,6 +53,7 @@ class CheckListController extends BaseController @@ -52,6 +53,7 @@ class CheckListController extends BaseController
52 */ 53 */
53 public function list(){ 54 public function list(){
54 $this->map['status'] = 1; 55 $this->map['status'] = 1;
  56 + $this->map['type'] = $this->map['type'] ?? 1;
55 $field = ['id','status','sort','text','created_at']; 57 $field = ['id','status','sort','text','created_at'];
56 $data = $this->model->list($this->map,'id',$field); 58 $data = $this->model->list($this->map,'id',$field);
57 $this->response('success',Code::SUCCESS,$data); 59 $this->response('success',Code::SUCCESS,$data);
@@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Optimize; @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Aside\Optimize;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Aside\BaseController; 13 use App\Http\Controllers\Aside\BaseController;
  14 +use App\Models\Project\OptimizeCheckList;
14 use App\Models\Project\OptimizeCheckLog; 15 use App\Models\Project\OptimizeCheckLog;
15 use Illuminate\Http\Request; 16 use Illuminate\Http\Request;
16 17
@@ -44,6 +45,7 @@ class CheckLogController extends BaseController @@ -44,6 +45,7 @@ class CheckLogController extends BaseController
44 ]); 45 ]);
45 $field = ['id','check_id','date','status','images','result','created_at']; 46 $field = ['id','check_id','date','status','images','result','created_at'];
46 $this->map['status'] = 1; 47 $this->map['status'] = 1;
  48 + $this->map['type'] = $this->map['type'] ?? 1;
47 $lists = $this->model->lists($this->map,$this->page,$this->row,'id',$field); 49 $lists = $this->model->lists($this->map,$this->page,$this->row,'id',$field);
48 $this->response('success',Code::SUCCESS,$lists); 50 $this->response('success',Code::SUCCESS,$lists);
49 } 51 }
@@ -80,6 +82,11 @@ class CheckLogController extends BaseController @@ -80,6 +82,11 @@ class CheckLogController extends BaseController
80 'project_id.required' => 'project_id不能为空', 'check_id.required' => '问题id不能为空', 82 'project_id.required' => 'project_id不能为空', 'check_id.required' => '问题id不能为空',
81 'date.required' => '时间不能为空', 'result.required' => '检查结果不能为空', 83 'date.required' => '时间不能为空', 'result.required' => '检查结果不能为空',
82 ]); 84 ]);
  85 + $checkListModel = new OptimizeCheckList();
  86 + $listInfo = $checkListModel->read(['id'=>$this->param['check_id']],['id','type']);
  87 + if($listInfo !== false){
  88 + $this->param['type'] = $listInfo['type'];
  89 + }
83 $this->param = $this->model->saveHandleParam($this->param,$this->manage['id']); 90 $this->param = $this->model->saveHandleParam($this->param,$this->manage['id']);
84 if(isset($this->param['id']) && !empty($this->param['id'])){ 91 if(isset($this->param['id']) && !empty($this->param['id'])){
85 $id = $this->param['id']; 92 $id = $this->param['id'];
@@ -195,6 +195,7 @@ class OptimizeController extends BaseController @@ -195,6 +195,7 @@ class OptimizeController extends BaseController
195 'gl_project.remain_day AS remain_day', 195 'gl_project.remain_day AS remain_day',
196 'gl_project.seo_remain_day AS seo_remain_day', 196 'gl_project.seo_remain_day AS seo_remain_day',
197 'gl_project.robots AS robots', 197 'gl_project.robots AS robots',
  198 + 'gl_project.is_analysis AS is_analysis',
198 'gl_project.is_minor_languages AS is_minor_languages', 199 'gl_project.is_minor_languages AS is_minor_languages',
199 'gl_project.is_translate AS is_translate', 200 'gl_project.is_translate AS is_translate',
200 'gl_project.is_translate_tag AS is_translate_tag', 201 'gl_project.is_translate_tag AS is_translate_tag',
@@ -593,5 +594,23 @@ class OptimizeController extends BaseController @@ -593,5 +594,23 @@ class OptimizeController extends BaseController
593 $this->response('success',Code::SUCCESS,$resultData); 594 $this->response('success',Code::SUCCESS,$resultData);
594 } 595 }
595 596
596 - 597 + /**
  598 + * @remark :是否开启泛解析
  599 + * @name :saveIsAnalysis
  600 + * @author :lyh
  601 + * @method :post
  602 + * @time :2025/5/24 14:48
  603 + */
  604 + public function saveIsAnalysis(){
  605 + $this->request->validate([
  606 + 'id' => 'required',
  607 + 'is_analysis' => 'required',
  608 + ], [
  609 + 'id.required' => '项目id不能为空',
  610 + 'is_analysis.required' => 'is_analysis不能为空',
  611 + ]);
  612 + $projectModel = new Project();
  613 + $data = $projectModel->edit(['is_analysis'=>$this->param['is_analysis']],['id'=>$this->param['id']]);
  614 + $this->response('success',Code::SUCCESS,$data);
  615 + }
597 } 616 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregateKeywordAffixController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 14:20
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Aside\Project;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Aside\BaseController;
  14 +use App\Http\Logic\Aside\Project\AggregateKeywordAffixLogic;
  15 +use Illuminate\Http\Request;
  16 +
  17 +class AggregateKeywordAffixController extends BaseController
  18 +{
  19 + public function __construct(Request $request)
  20 + {
  21 + parent::__construct($request);
  22 + $this->logic = new AggregateKeywordAffixLogic();
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取当前项目关键字前后缀
  27 + * @name :getAffix
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/27 14:23
  31 + */
  32 + public function getAffix(){
  33 + $this->request->validate([
  34 + 'project_id'=>'required',
  35 + ],[
  36 + 'project_id.required' => 'project_id不能为空',
  37 + ]);
  38 + $data = $this->logic->getAffix();
  39 + $this->response('success',Code::SUCCESS,$data);
  40 + }
  41 +
  42 + /**
  43 + * @remark :保存关键字前后缀
  44 + * @name :save
  45 + * @author :lyh
  46 + * @method :post
  47 + * @time :2025/5/27 14:23
  48 + */
  49 + public function saveAffix(){
  50 + $this->request->validate([
  51 + 'project_id'=>'required',
  52 + 'prefix'=>'required',
  53 + 'suffix'=>'required',
  54 + ],[
  55 + 'project_id.required' => 'project_id不能为空',
  56 + 'prefix.required' => '前缀不能为空',
  57 + 'suffix.required' => '后缀不能为空',
  58 + ]);
  59 + $data = $this->logic->saveAffix();
  60 + $this->response('success',Code::SUCCESS,$data);
  61 + }
  62 +
  63 +}
@@ -16,6 +16,7 @@ use App\Models\ASide\APublicModel; @@ -16,6 +16,7 @@ use App\Models\ASide\APublicModel;
16 use App\Models\Channel\Channel; 16 use App\Models\Channel\Channel;
17 use App\Models\Domain\DomainInfo; 17 use App\Models\Domain\DomainInfo;
18 use App\Models\Manage\Manage; 18 use App\Models\Manage\Manage;
  19 +use App\Models\Manage\ManageHr;
19 use App\Models\Project\Project; 20 use App\Models\Project\Project;
20 use App\Models\Project\ProjectRenew; 21 use App\Models\Project\ProjectRenew;
21 use App\Models\Task\Task; 22 use App\Models\Task\Task;
@@ -36,7 +37,7 @@ class RenewProjectController extends BaseController @@ -36,7 +37,7 @@ class RenewProjectController extends BaseController
36 ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page); 37 ->with('deploy_optimize')->with('online_check')->paginate($this->row, ['*'], 'page', $this->page);
37 if(!empty($lists)){ 38 if(!empty($lists)){
38 $lists = $lists->toArray(); 39 $lists = $lists->toArray();
39 - $manageModel = new Manage(); 40 + $manageModel = new ManageHr();
40 $domainModel = new DomainInfo(); 41 $domainModel = new DomainInfo();
41 foreach ($lists['list'] as $k=>$item){ 42 foreach ($lists['list'] as $k=>$item){
42 $item = $this->handleParam($item,$manageModel,$domainModel); 43 $item = $this->handleParam($item,$manageModel,$domainModel);
@@ -122,7 +123,7 @@ class RenewProjectController extends BaseController @@ -122,7 +123,7 @@ class RenewProjectController extends BaseController
122 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page); 123 ->with('project_after')->paginate($this->row, ['*'], 'page', $this->page);
123 if(!empty($lists)){ 124 if(!empty($lists)){
124 $lists = $lists->toArray(); 125 $lists = $lists->toArray();
125 - $manageModel = new Manage(); 126 + $manageModel = new ManageHr();
126 $domainModel = new DomainInfo(); 127 $domainModel = new DomainInfo();
127 foreach ($lists['list'] as $k=>$item){ 128 foreach ($lists['list'] as $k=>$item){
128 $item = $this->handleParam($item,$manageModel,$domainModel); 129 $item = $this->handleParam($item,$manageModel,$domainModel);
@@ -13,6 +13,7 @@ use App\Models\Ai\AiLog; @@ -13,6 +13,7 @@ use App\Models\Ai\AiLog;
13 use App\Models\Project\DeployOptimize; 13 use App\Models\Project\DeployOptimize;
14 use App\Models\Project\Project; 14 use App\Models\Project\Project;
15 use App\Models\Project\ProjectKeyword; 15 use App\Models\Project\ProjectKeyword;
  16 +use App\Services\AiCommandService;
16 use Illuminate\Support\Facades\Cache; 17 use Illuminate\Support\Facades\Cache;
17 18
18 class AiCommandController extends BaseController 19 class AiCommandController extends BaseController
@@ -70,4 +71,70 @@ class AiCommandController extends BaseController @@ -70,4 +71,70 @@ class AiCommandController extends BaseController
70 return $aiLog->add($param); 71 return $aiLog->add($param);
71 } 72 }
72 73
  74 + /**
  75 + * @remark :获取排版指令
  76 + * @name :getAiTypesetting
  77 + * @author :lyh
  78 + * @method :post
  79 + * @time :2025/5/26 17:11
  80 + */
  81 + public function getLayoutDesignInfo(){
  82 + $aiCommonModel = new AiCommand();
  83 + $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']],['key','ai']);
  84 + if($data === false){
  85 + $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0],['key','ai']);
  86 + }
  87 + $this->response('success', Code::SUCCESS, $data);
  88 + }
  89 +
  90 + /**
  91 + * @remark :保存指令
  92 + * @name :saveAiCommand
  93 + * @author :lyh
  94 + * @method :post
  95 + * @time :2025/5/26 17:15
  96 + */
  97 + public function saveLayoutDesign(){
  98 + $this->request->validate([
  99 + 'ai'=>['required'],
  100 + ],[
  101 + 'ai.required' => '指令不能为空',
  102 + ]);
  103 + $aiCommonModel = new AiCommand();
  104 + $data = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']],['id']);
  105 + if($data === false) {
  106 + $param = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0],['name','key']);
  107 + $param['project_id'] = $this->user['project_id'];
  108 + $param['ai'] = $this->param['ai'];
  109 + $id = $aiCommonModel->addReturnId($param);
  110 + }else{
  111 + $id = $data['id'];
  112 + $aiCommonModel->edit(['ai'=>$this->param['ai']],['id'=>$data['id']]);
  113 + }
  114 + $this->response('success', Code::SUCCESS, ['id'=>$id]);
  115 + }
  116 +
  117 + /**
  118 + * @remark :根据指令获取内容
  119 + * @name :sendLayoutDesign
  120 + * @author :lyh
  121 + * @method :post
  122 + * @time :2025/5/26 17:39
  123 + */
  124 + public function sendLayoutDesign(){
  125 + $this->request->validate([
  126 + 'html'=>['required']
  127 + ],[
  128 + 'html.required' => 'html不能为空',
  129 + ]);
  130 + $aiCommonModel = new AiCommand();
  131 + $info = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>$this->user['project_id']],['ai']);
  132 + if($info === false){
  133 + $info = $aiCommonModel->read(['key'=>'ai_layout_design','project_id'=>0],['ai']);
  134 + }
  135 + $aiCommandService = new AiCommandService();
  136 + $ai = str_replace('{html}',$this->param['html'],$info['ai']);
  137 + $result = $aiCommandService->send_layout_design($ai);
  138 + $this->response('success', Code::SUCCESS, $result);
  139 + }
73 } 140 }
@@ -215,9 +215,9 @@ class CNoticeController extends BaseController @@ -215,9 +215,9 @@ class CNoticeController extends BaseController
215 $project_id = $this->user['project_id']; 215 $project_id = $this->user['project_id'];
216 $type = intval($request->input('type', 1)); 216 $type = intval($request->input('type', 1));
217 $route = intval($request->input('page', 1)); 217 $route = intval($request->input('page', 1));
218 - if(($this->user['is_upgrade'] == 0) && ($type == 2) && in_array($route,[4,6])){  
219 - $this->fail('聚合页翻译请联系管理员');  
220 - } 218 +// if(($this->user['is_upgrade'] == 0) && ($type == 2) && in_array($route,[4,6])){
  219 +// $this->fail('聚合页翻译请联系管理员');
  220 +// }
221 $url = $request->input('url', []); 221 $url = $request->input('url', []);
222 $language = $request->input('language', []); 222 $language = $request->input('language', []);
223 $is_sitemap = intval($request->input('is_sitemap', 0)); 223 $is_sitemap = intval($request->input('is_sitemap', 0));
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:05
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\News;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\News\NewsExtendLogic;
  15 +use Illuminate\Http\Request;
  16 +
  17 +class NewsExtendController extends BaseController
  18 +{
  19 + public function __construct(Request $request)
  20 + {
  21 + parent::__construct($request);
  22 + $this->logic = new NewsExtendLogic();
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取所有扩展字段
  27 + * @name :lists
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/26 15:08
  31 + */
  32 + public function lists()
  33 + {
  34 + $lists = $this->logic->list($this->map);
  35 + $this->response('success', Code::SUCCESS, $lists);
  36 + }
  37 +
  38 + /**
  39 + * @remark :保存扩展字段
  40 + * @name :save
  41 + * @author :lyh
  42 + * @method :post
  43 + * @time :2025/5/26 15:09
  44 + */
  45 + public function save()
  46 + {
  47 + $this->request->validate([
  48 + 'title' => 'required',
  49 + 'type' => 'required',
  50 + ], [
  51 + 'title.required' => '字段名称不能为空',
  52 + 'type.required' => '字段类型不能为空',
  53 + ]);
  54 + $data = $this->logic->extendSave();
  55 + $this->response('success', Code::SUCCESS, $data);
  56 + }
  57 +
  58 + /**
  59 + * @remark :修改状态
  60 + * @name :status
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2025/5/27 9:22
  64 + */
  65 + public function status(){
  66 + $this->request->validate([
  67 + 'id' => 'required',
  68 + 'status' => 'required',
  69 + ], [
  70 + 'id.required' => '字段名称不能为空',
  71 + 'status.required' => '字段类型不能为空',
  72 + ]);
  73 + $data = $this->logic->extendStatus();
  74 + $this->response('success', Code::SUCCESS, $data);
  75 + }
  76 +
  77 + /**
  78 + * @remark :删除扩展字段
  79 + * @name :del
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2025/5/26 15:43
  83 + */
  84 + public function del(){
  85 + $this->request->validate([
  86 + 'id' => 'required',
  87 + ], [
  88 + 'id.required' => '主键不能为空',
  89 + ]);
  90 + $data = $this->logic->extendDel();
  91 + $this->response('success', Code::SUCCESS, $data);
  92 + }
  93 +}
@@ -61,7 +61,9 @@ class ProductController extends BaseController @@ -61,7 +61,9 @@ class ProductController extends BaseController
61 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id 61 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
62 $userModel = new User(); 62 $userModel = new User();
63 foreach ($lists['list'] as $k=>$v){ 63 foreach ($lists['list'] as $k=>$v){
64 - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); 64 + $route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
  65 + $v['url'] = $this->user['domain'] . $route['route'];
  66 + $v['pv'] = $route['pv'];
65 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 67 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
66 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 68 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
67 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 69 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
@@ -97,7 +99,9 @@ class ProductController extends BaseController @@ -97,7 +99,9 @@ class ProductController extends BaseController
97 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id 99 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
98 $userModel = new User(); 100 $userModel = new User();
99 foreach ($lists['list'] as $k=>$v){ 101 foreach ($lists['list'] as $k=>$v){
100 - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); 102 + $route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
  103 + $v['url'] = $this->user['domain'] . $route['route'];
  104 + $v['pv'] = $route['pv'];
101 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 105 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
102 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 106 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
103 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 107 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateModuleRandomController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 15:33
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Template;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\BTemplate\BTemplateModuleRandomLogic;
  15 +use Illuminate\Http\Request;
  16 +
  17 +class BTemplateModuleRandomController extends BaseController
  18 +{
  19 + public function __construct(Request $request)
  20 + {
  21 + parent::__construct($request);
  22 + $this->logic = new BTemplateModuleRandomLogic();
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取当前项目所有随机模块
  27 + * @name :getRandomList
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/27 16:00
  31 + */
  32 + public function getRandomList(){
  33 + $data = $this->logic->getRandomList();
  34 + $this->response('success',Code::SUCCESS,$data);
  35 + }
  36 +
  37 + /**
  38 + * @remark :设置为随机模块
  39 + * @name :saveRandomModule
  40 + * @author :lyh
  41 + * @method :post
  42 + * @time :2025/5/27 15:34
  43 + */
  44 + public function saveRandomModule(){
  45 + $this->request->validate([
  46 + 'module_id'=>'required',
  47 + 'uuid'=>'required',
  48 + 'html'=>'required',
  49 + ],[
  50 + 'module_id.required' => '左侧模块id不能为空',
  51 + 'uuid.required' => 'uuid唯一不能为空',
  52 + 'html.required' => 'html不能为空',
  53 + ]);
  54 + $data = $this->logic->saveRandomModule();
  55 + $this->response('success',Code::SUCCESS,$data);
  56 + }
  57 +
  58 + /**
  59 + * @remark :获取当前随机模块详情
  60 + * @name :getRandomInfo
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2025/5/27 15:47
  64 + */
  65 + public function getRandomInfo(){
  66 + $this->request->validate([
  67 + 'uuid'=>'required',
  68 + ],[
  69 + 'uuid.required' => 'uuid唯一不能为空',
  70 + ]);
  71 + $data = $this->logic->getRandomInfo();
  72 + $this->response('success',Code::SUCCESS,$data);
  73 + }
  74 +
  75 + /**
  76 + * @remark :删除随机模块
  77 + * @name :delRandom
  78 + * @author :lyh
  79 + * @method :post
  80 + * @time :2025/5/27 17:59
  81 + */
  82 + public function delRandom(){
  83 + $this->request->validate([
  84 + 'uuid'=>'required',
  85 + ],[
  86 + 'uuid.required' => 'uuid唯一不能为空',
  87 + ]);
  88 + $data = $this->logic->delRandom();
  89 + $this->response('success',Code::SUCCESS,$data);
  90 + }
  91 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregateKeywordAffixLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 14:21
  8 + */
  9 +
  10 +namespace App\Http\Logic\Aside\Project;
  11 +
  12 +use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Project\AggregateKeywordAffix;
  14 +
  15 +class AggregateKeywordAffixLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->param = $this->requestAll;
  21 + $this->model = new AggregateKeywordAffix();
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存数据
  26 + * @name :getAffix
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2025/5/27 14:25
  30 + */
  31 + public function getAffix(){
  32 + $data = $this->model->read(['project_id'=>$this->param['project_id']]);
  33 + if($data === false){
  34 + $data = [];
  35 + }
  36 + return $this->success($data);
  37 + }
  38 +
  39 + /**
  40 + * @remark :保存数据
  41 + * @name :saveAffix
  42 + * @author :lyh
  43 + * @method :post
  44 + * @time :2025/5/27 14:28
  45 + */
  46 + public function saveAffix(){
  47 + $info = $this->model->read(['project_id'=>$this->param['project_id']]);
  48 + try {
  49 + if($info === false){
  50 + $this->model->addReturnId(['project_id'=>$this->param['project_id'],'prefix'=>$this->param['prefix'] ?? '','suffix'=>$this->param['suffix'] ?? '']);
  51 + }else{
  52 + $this->model->edit(['prefix'=>$this->param['prefix'] ?? '','suffix'=>$this->param['suffix'] ?? ''],['project_id'=>$this->param['project_id']]);
  53 + }
  54 + }catch (\Exception $e){
  55 + $this->fail('保存失败,请联系管理员');
  56 + }
  57 + return $this->success();
  58 + }
  59 +}
@@ -471,7 +471,7 @@ class ProjectLogic extends BaseLogic @@ -471,7 +471,7 @@ class ProjectLogic extends BaseLogic
471 } 471 }
472 $param['upload_config'] = json_encode($param['upload_config'] ?? []); 472 $param['upload_config'] = json_encode($param['upload_config'] ?? []);
473 $param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []); 473 $param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []);
474 - unset($param['robots']);//项目不保存robots 474 + unset($param['robots'],$param['is_analysis']);//项目不保存robots
475 $this->model->edit($param,['id'=>$param['id']]); 475 $this->model->edit($param,['id'=>$param['id']]);
476 Common::del_user_cache($this->model->getTable(),$param['id']); 476 Common::del_user_cache($this->model->getTable(),$param['id']);
477 return $this->success(); 477 return $this->success();
@@ -92,6 +92,8 @@ class AiBlogLogic extends BaseLogic @@ -92,6 +92,8 @@ class AiBlogLogic extends BaseLogic
92 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 92 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
93 $aiBlogService->key = $aiSettingInfo['key']; 93 $aiBlogService->key = $aiSettingInfo['key'];
94 $aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'route'=>$this->param['route'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]); 94 $aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'route'=>$this->param['route'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]);
  95 + $aiBlogTask = new AiBlogTask();
  96 + $aiBlogTask->addReturnId(['type'=>$aiBlogTask::TYPE_AUTHOR_ID,'task_id'=>$this->param['author_id'],'status'=>1,'project_id'=>$this->user['project_id']]);
95 }catch (\Exception $e){ 97 }catch (\Exception $e){
96 $this->fail('保存失败,请联系管理员'); 98 $this->fail('保存失败,请联系管理员');
97 } 99 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateModuleRandomLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 15:36
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\BTemplate;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Template\TemplateModuleRandom;
  14 +
  15 +class BTemplateModuleRandomLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->model = new TemplateModuleRandom();
  21 + $this->param = $this->requestAll;
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存为随机模块
  26 + * @name :saveRandomModule
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2025/5/27 15:38
  30 + */
  31 + public function saveRandomModule(){
  32 + //查询当前uuid是否已存在
  33 + $info = $this->model->read(['project_id'=>$this->user['project_id'],'uuid'=>$this->param['uuid'],'module_id'=>$this->param['module_id']]);
  34 + try {
  35 + if($info === false){
  36 + $this->param['project_id'] = $this->user['project_id'];
  37 + //执行新增数据
  38 + $this->model->add($this->param);
  39 + }else{
  40 + //执行编辑
  41 + $this->model->edit(['html'=>$this->param['html']],['id'=>$this->param['id']]);
  42 + }
  43 + }catch (\Exception $e){
  44 + $this->fail('保存失败,请联系管理员');
  45 + }
  46 + return $this->success();
  47 + }
  48 +
  49 + /**
  50 + * @remark :获取当前项目的所有随机模块
  51 + * @name :getRandomList
  52 + * @author :lyh
  53 + * @method :post
  54 + * @time :2025/5/27 15:59
  55 + */
  56 + public function getRandomList(){
  57 + $data = $this->model->list(['project_id'=>$this->user['project_id']],'id',['id','uuid','project_id','module_id']);
  58 + return $this->success($data);
  59 + }
  60 +
  61 + /**
  62 + * @remark :获取当前模块是否为随机模块
  63 + * @name :getIsRandomModule
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2025/5/27 15:47
  67 + */
  68 + public function getRandomInfo(){
  69 + $info = $this->model->read(['uuid'=>$this->param['uuid']]);
  70 + if($info === false){
  71 + $info = [];
  72 + }
  73 + return $this->success($info);
  74 + }
  75 +
  76 + /**
  77 + * @remark :删除数据
  78 + * @name :delRandom
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2025/5/27 18:04
  82 + */
  83 + public function delRandom(){
  84 + $res = $this->model->del(['uuid'=>$this->param['uuid']]);
  85 + return $this->success($res);
  86 + }
  87 +}
@@ -49,6 +49,12 @@ class CustomTemplateLogic extends BaseLogic @@ -49,6 +49,12 @@ class CustomTemplateLogic extends BaseLogic
49 if($info === false){ 49 if($info === false){
50 $this->fail('当前数据不存在'); 50 $this->fail('当前数据不存在');
51 } 51 }
  52 + if(!empty($info['html'])){
  53 + $info['is_renovation'] = 1;
  54 + }else{
  55 + $info['html'] = $info['text'];
  56 + $info['is_renovation'] = 0;
  57 + }
52 $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); 58 $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
53 if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){ 59 if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
54 $template_id = $this->getTemplateId(); 60 $template_id = $this->getTemplateId();
@@ -555,6 +561,7 @@ class CustomTemplateLogic extends BaseLogic @@ -555,6 +561,7 @@ class CustomTemplateLogic extends BaseLogic
555 'is_visualization' => $info['is_visualization'], 561 'is_visualization' => $info['is_visualization'],
556 'created_at' => date('Y-m-d H:i:s'), 562 'created_at' => date('Y-m-d H:i:s'),
557 'updated_at' => date('Y-m-d H:i:s'), 563 'updated_at' => date('Y-m-d H:i:s'),
  564 + 'text'=>$info['text'] ?? '',
558 ]; 565 ];
559 } 566 }
560 } 567 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:11
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\News;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\News\NewsExtend;
  14 +use App\Models\Product\ExtendInfo;
  15 +
  16 +class NewsExtendLogic extends BaseLogic
  17 +{
  18 + public function __construct()
  19 + {
  20 + parent::__construct();
  21 + $this->model = new NewsExtend();
  22 + $this->param = $this->requestAll;
  23 + }
  24 +
  25 + /**
  26 + * @remark :列表页
  27 + * @name :list
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/26 15:17
  31 + */
  32 + public function list($map){
  33 + $map['status'] = 1;
  34 + $data = $this->model->list($map);
  35 + return $this->success($data);
  36 + }
  37 +
  38 + /**
  39 + * @remark :保存扩展字段
  40 + * @name :extendSave
  41 + * @author :lyh
  42 + * @method :post
  43 + * @time :2025/5/26 15:13
  44 + * @param :id->主键;title->名称
  45 + */
  46 + public function extendSave(){
  47 + if(isset($this->param['id']) && !empty($this->param['id'])){
  48 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  49 + }else{
  50 + $info = $this->model->read(['title'=>$this->param['title']]);
  51 + if($info !== false){
  52 + $this->fail('当前扩展名称已存在');
  53 + }
  54 + $this->param['key'] = $this->model->getKey();
  55 + $this->param['project_id'] = $this->user['project_id'];
  56 + $rs = $this->model->add($this->param);
  57 + }
  58 + if($rs === false){
  59 + $this->fail('error');
  60 + }
  61 + return $this->success($this->param);
  62 + }
  63 +
  64 + /**
  65 + * @remark :修改状态
  66 + * @name :extendStatus
  67 + * @author :lyh
  68 + * @method :post
  69 + * @time :2025/5/27 9:20
  70 + */
  71 + public function extendStatus(){
  72 + $result = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
  73 + return $this->success(['result'=>$result]);
  74 + }
  75 +
  76 + /**
  77 + * @remark :删除字段
  78 + * @name :extendDel
  79 + * @author :lyh
  80 + * @method :post
  81 + * @time :2025/5/26 15:45
  82 + * @param :id->主键
  83 + */
  84 + public function extendDel(){
  85 + $info = $this->model->read(['id'=>$this->param['id']]);
  86 + //查看当前扩展字段是否设置了值
  87 + $extendInfoModel = new ExtendInfo();
  88 + $extendInfo = $extendInfoModel->read(['key'=>$info['key']]);
  89 + if($extendInfo !== false){
  90 + $this->fail('当前扩展字段已有产品在使用,不允许删除');
  91 + }
  92 + $this->model->del(['id'=>$this->param['id']]);
  93 + }
  94 +
  95 +}
@@ -8,6 +8,8 @@ use App\Http\Logic\Bside\BaseLogic; @@ -8,6 +8,8 @@ use App\Http\Logic\Bside\BaseLogic;
8 use App\Models\News\News; 8 use App\Models\News\News;
9 use App\Models\News\NewsCategory; 9 use App\Models\News\NewsCategory;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 10 use App\Models\News\NewsCategory as NewsCategoryModel;
  11 +use App\Models\News\NewsExtend;
  12 +use App\Models\News\NewsExtendInfo;
11 use App\Models\RouteMap\RouteMap; 13 use App\Models\RouteMap\RouteMap;
12 use App\Models\Template\BTemplate; 14 use App\Models\Template\BTemplate;
13 use App\Services\CosService; 15 use App\Services\CosService;
@@ -79,6 +81,7 @@ class NewsLogic extends BaseLogic @@ -79,6 +81,7 @@ class NewsLogic extends BaseLogic
79 $this->edit(['url' => $route], ['id' => $id]); 81 $this->edit(['url' => $route], ['id' => $id]);
80 $this->curlDelRoute(['new_route'=>$route]); 82 $this->curlDelRoute(['new_route'=>$route]);
81 } 83 }
  84 + $this->model->saveExtendInfo($id,$this->param['extend'] ?? []);
82 $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route); 85 $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
83 return $this->success(['id'=>$id]); 86 return $this->success(['id'=>$id]);
84 } 87 }
@@ -143,11 +146,12 @@ class NewsLogic extends BaseLogic @@ -143,11 +146,12 @@ class NewsLogic extends BaseLogic
143 { 146 {
144 $info = $this->model->read($this->param); 147 $info = $this->model->read($this->param);
145 if($info === false){ 148 if($info === false){
146 - $this->fail('error'); 149 + $this->fail('当前数据不存在');
147 } 150 }
148 $info['category_id'] = explode(',',trim($info['category_id'],',')); 151 $info['category_id'] = explode(',',trim($info['category_id'],','));
149 $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); 152 $info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
150 $info['og_image'] = getImageUrl(empty($info['og_image']) ? $info['image'] : $info['og_image'],$this->user['storage_type'],$this->user['project_location']); 153 $info['og_image'] = getImageUrl(empty($info['og_image']) ? $info['image'] : $info['og_image'],$this->user['storage_type'],$this->user['project_location']);
  154 + $info['extend'] = $this->model->getExtendInfo($info['id']);
151 return $this->success($info); 155 return $this->success($info);
152 } 156 }
153 157
@@ -489,14 +489,10 @@ class ProductLogic extends BaseLogic @@ -489,14 +489,10 @@ class ProductLogic extends BaseLogic
489 foreach ($data as $k => $v){ 489 foreach ($data as $k => $v){
490 $map = []; 490 $map = [];
491 $cateModel = new Category(); 491 $cateModel = new Category();
492 - $status = [];  
493 - if($v != 3){  
494 - $status = ['status'=>$v];  
495 - }  
496 - $cateList = $cateModel->list($status,'id',['id','pid']); 492 + $cateList = $cateModel->list(['status'=>1],'id',['id','pid']);
497 $this->param['featured_status'] = $this->param['featured_status'] ?? 0; 493 $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
498 if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){ 494 if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
499 - $featured_ids = $cateModel->where('title', 'Featured')->pluck('id')->toArray(); 495 + $featured_ids = $cateModel->formatQuery(['title'=>['in',['Featured','featured']]])->pluck('id')->toArray();
500 //获取当前的子集 496 //获取当前的子集
501 $featured_arr = []; 497 $featured_arr = [];
502 foreach ($featured_ids as $id){ 498 foreach ($featured_ids as $id){
@@ -215,6 +215,10 @@ class RankDataLogic extends BaseLogic @@ -215,6 +215,10 @@ class RankDataLogic extends BaseLogic
215 $page = intval($this->request['page'] ?: 1); 215 $page = intval($this->request['page'] ?: 1);
216 $lang = $this->request['lang'] ?: ''; 216 $lang = $this->request['lang'] ?: '';
217 $project_id = $this->user['project_id']; 217 $project_id = $this->user['project_id'];
  218 + # fixme 白帽演示项目或者演示项目排名信息数据
  219 + if ($project_id == 3989) {
  220 + $project_id = 1;
  221 + }
218 $project = (new ProjectLogic())->getProjectInfo($project_id); 222 $project = (new ProjectLogic())->getProjectInfo($project_id);
219 if(request('api_no')){ 223 if(request('api_no')){
220 $api_no = request('api_no'); 224 $api_no = request('api_no');
@@ -286,8 +290,8 @@ class RankDataLogic extends BaseLogic @@ -286,8 +290,8 @@ class RankDataLogic extends BaseLogic
286 $v = [ 290 $v = [
287 'keyword' => $key, 291 'keyword' => $key,
288 'domain_type' => $domain_arr[0], 292 'domain_type' => $domain_arr[0],
289 - 'domain' => $domain_arr[1],  
290 - 'domain_text' => $domain_text, 293 + 'domain' => $this->user['project_id'] == 3989 ? 'google.com' : $domain_arr[1], # fixme 白帽演示项目或者演示项目排名信息数据
  294 + 'domain_text' => $this->user['project_id'] == 3989 ? 'google.com' : $domain_text, # fixme 白帽演示项目或者演示项目排名信息数据
291 'g' => $last['g'], //1核心关键词 295 'g' => $last['g'], //1核心关键词
292 'position' => $data, 296 'position' => $data,
293 ]; 297 ];
@@ -549,7 +553,7 @@ class RankDataLogic extends BaseLogic @@ -549,7 +553,7 @@ class RankDataLogic extends BaseLogic
549 $without_extension_project_ids = [658]; //是否达标只统计主词的 553 $without_extension_project_ids = [658]; //是否达标只统计主词的
550 $extension_project_ids = [354]; //扩展词也到达标的 554 $extension_project_ids = [354]; //扩展词也到达标的
551 $compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的 555 $compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的
552 - $ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250];//暂停的项目 556 + $ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193];//暂停的项目
553 $uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目 557 $uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
554 //一个项目多个api_no 558 //一个项目多个api_no
555 $multiple_api_no_project_ids = [ 559 $multiple_api_no_project_ids = [
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :AiBlogAuthor.php 4 + * @name :AiBlogAuthorId.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2025/2/21 10:59 7 * @time :2025/2/21 10:59
@@ -32,4 +32,124 @@ class News extends Base @@ -32,4 +32,124 @@ class News extends Base
32 public function getRelatedProductIdAttribute($value){ 32 public function getRelatedProductIdAttribute($value){
33 return Arr::setToArr($value); 33 return Arr::setToArr($value);
34 } 34 }
  35 +
  36 + /**
  37 + * @remark :扩展字段根据type返回类型
  38 + * @name :setTypValues
  39 + * @author :lyh
  40 + * @method :post
  41 + * @time :2023/12/6 14:43
  42 + */
  43 + public function getExtendInfo($news_id){
  44 + $extendModel = new NewsExtend();
  45 + $list = $extendModel->list(['status'=>1],'id',['id','type','key','title']);
  46 + if(empty($list)){
  47 + return [];
  48 + }
  49 + $extendInfoModel = new NewsExtendInfo();
  50 + $infoList = $extendInfoModel->list(['news_id'=>$news_id],'created_at');
  51 + foreach ($list as $k=>$v){
  52 + if($v['type'] == 3 || $v['type'] == 4){
  53 + $v['values'] = [];
  54 + }else{
  55 + $v['values'] = '';
  56 + }
  57 + if(!empty($infoList)){
  58 + foreach ($infoList as $values){
  59 + if($v['key'] == $values['key']){
  60 + $v = $this->setTypValues($v,$values);
  61 + break;
  62 + }
  63 + }
  64 + }
  65 + $list[$k] = $v;
  66 + }
  67 + return $list;
  68 + }
  69 +
  70 +
  71 + /**
  72 + * @remark :扩展字段根据type返回类型
  73 + * @name :setTypValues
  74 + * @author :lyh
  75 + * @method :post
  76 + * @time :2023/12/6 14:43
  77 + */
  78 + public function setTypValues($v,$info){
  79 + if($v['type'] == 3){
  80 + $arr = json_decode($info['values']);
  81 + foreach ($arr as $k1=>$v1){
  82 + $v1 = (array)$v1;
  83 + $v1['url'] = getImageUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']);
  84 + $arr[$k1] = $v1;
  85 + }
  86 + $v['values'] = $arr;
  87 + }elseif($v['type'] == 4){
  88 + $arr1 = json_decode($info['values']);
  89 + foreach ($arr1 as $k1=>$v1){
  90 + $v1 = (array)$v1;
  91 + if(isset($v1['url'])){
  92 + $v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
  93 + }else{
  94 + $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
  95 + }
  96 + $arr1[$k1] = $v1;
  97 + }
  98 + $v['values'] = $arr1;
  99 + }else{
  100 + $v['values'] = $info['values'];
  101 + }
  102 + return $v;
  103 + }
  104 +
  105 + /**
  106 + * @remark :保存扩展字段
  107 + * @name :saveExtend
  108 + * @author :lyh
  109 + * @method :post
  110 + * @time :2023/11/9 15:02
  111 + */
  112 + public function saveExtendInfo($news_id,$extend){
  113 + //先删除以前的数据
  114 + $extendInfoModel = new NewsExtendInfo();
  115 + $extendInfoModel->del(['news_id'=>$news_id]);
  116 + if(empty($extend)) {
  117 + return true;
  118 + }
  119 + foreach ($extend as $k => $v){
  120 + if(empty($v['values'])){
  121 + continue;
  122 + }
  123 + $v = $this->saveHandleExtend($v,$news_id);
  124 + $extendInfoModel->add($v);
  125 + }
  126 + return true;
  127 + }
  128 +
  129 + /**
  130 + * @remark :保存扩展字段时处理数据
  131 + * @name :saveHandleExtend
  132 + * @author :lyh
  133 + * @method :post
  134 + * @time :2023/12/6 15:11
  135 + */
  136 + public function saveHandleExtend(&$v,$news_id){
  137 + unset($v['title']);
  138 + if($v['type'] == 3){
  139 + foreach ($v['values'] as $k1=>$v1){
  140 + $v1['url'] = str_replace_url($v1['url']);
  141 + $v['values'][$k1] = $v1;
  142 + }
  143 + $v['values'] = json_encode($v['values']);
  144 + }elseif ($v['type'] == 4){
  145 + foreach ($v['values'] as $k1=>$v1){
  146 + $v1['url'] = str_replace_url($v1['url']);
  147 + $v['values'][$k1] = $v1;
  148 + }
  149 + $v['values'] = json_encode($v['values']);
  150 + }
  151 + $v['project_id'] = $this->user['project_id'];
  152 + $v['news_id'] = $news_id;
  153 + return $v;
  154 + }
35 } 155 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtend.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:08
  8 + */
  9 +
  10 +namespace App\Models\News;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class NewsExtend extends Base
  15 +{
  16 + protected $table = 'gl_news_extend';
  17 + protected $connection = 'custom_mysql';
  18 +
  19 + const EXTEND_KEY = 'pd_extended_field_';
  20 +
  21 + /**
  22 + * @remark :添加扩展字段
  23 + * @name :getKey
  24 + * @author :lyh
  25 + * @method :post
  26 + * @time :2025/5/26 15:39
  27 + */
  28 + public function getKey($key = self::EXTEND_KEY,$i = 1){
  29 + $info = $this->read(['key'=>$key.$i]);
  30 + if($info !== false){
  31 + return $this->getKey($key,$i+1);
  32 + }else{
  33 + return $key.$i;
  34 + }
  35 + }
  36 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :NewsExtendInfo.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 15:49
  8 + */
  9 +
  10 +namespace App\Models\News;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class NewsExtendInfo extends Base
  15 +{
  16 + protected $table = 'gl_news_extend_info';
  17 + protected $connection = 'custom_mysql';
  18 +}
@@ -197,4 +197,35 @@ class Keyword extends Base @@ -197,4 +197,35 @@ class Keyword extends Base
197 $string_key = array_search($first_title, $this->firstNumWord); 197 $string_key = array_search($first_title, $this->firstNumWord);
198 return $string_key ?: 27; 198 return $string_key ?: 27;
199 } 199 }
  200 +
  201 + public $product_keyword_route = [
  202 + "top-search",
  203 + "top-search-a",
  204 + "top-search-b",
  205 + "top-search-c",
  206 + "top-search-d",
  207 + "top-search-e",
  208 + "top-search-f",
  209 + "top-search-g",
  210 + "top-search-h",
  211 + "top-search-i",
  212 + "top-search-j",
  213 + "top-search-k",
  214 + "top-search-l",
  215 + "top-search-m",
  216 + "top-search-n",
  217 + "top-search-o",
  218 + "top-search-p",
  219 + "top-search-q",
  220 + "top-search-r",
  221 + "top-search-s",
  222 + "top-search-t",
  223 + "top-search-u",
  224 + "top-search-v",
  225 + "top-search-w",
  226 + "top-search-x",
  227 + "top-search-y",
  228 + "top-search-z",
  229 + "top-search-0",
  230 + ];
200 } 231 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregateKeywordAffix.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 14:16
  8 + */
  9 +
  10 +namespace App\Models\Project;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :聚合页关键字前后缀
  16 + * @name :AggregateKeywordAffix
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/5/27 14:16
  20 + */
  21 +class AggregateKeywordAffix extends Base
  22 +{
  23 + protected $table = 'gl_aggregate_keyword_affix';
  24 +}
@@ -26,5 +26,5 @@ class AiBlogTask extends Base @@ -26,5 +26,5 @@ class AiBlogTask extends Base
26 */ 26 */
27 const TYPE_AUTHOR = 1; 27 const TYPE_AUTHOR = 1;
28 const TYPE_BLOG = 2; 28 const TYPE_BLOG = 2;
29 - const TYPE_VIDEO = 3; 29 + const TYPE_AUTHOR_ID = 3;//根据对应id页面
30 } 30 }
@@ -105,6 +105,10 @@ class Project extends Base @@ -105,6 +105,10 @@ class Project extends Base
105 ]; 105 ];
106 } 106 }
107 107
  108 + /**
  109 + * 项目版本
  110 + * @return array
  111 + */
108 public static function planMap() 112 public static function planMap()
109 { 113 {
110 return [ 114 return [
@@ -122,6 +126,9 @@ class Project extends Base @@ -122,6 +126,9 @@ class Project extends Base
122 12 => '俄语商务版', 126 12 => '俄语商务版',
123 14 => '俄语旗舰版', 127 14 => '俄语旗舰版',
124 13 => '体验版', 128 13 => '体验版',
  129 + 15 => 'CKA方案半托管',
  130 + 16 => 'CKA方案全托管',
  131 + 17 => '多语言版',
125 ]; 132 ];
126 } 133 }
127 134
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateModuleRandom.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 15:31
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :随机模块
  16 + * @name :TemplateModuleRandom
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/5/27 15:32
  20 + */
  21 +class TemplateModuleRandom extends Base
  22 +{
  23 + protected $table = 'gl_public_template_module_random';
  24 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AiCommandService.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/26 17:01
  8 + */
  9 +
  10 +namespace App\Services;
  11 +
  12 +/**
  13 + * @remark :AI指令返回数据
  14 + * @name :AiCommandService
  15 + * @author :lyh
  16 + * @method :post
  17 + * @time :2025/5/26 17:01
  18 + */
  19 +class AiCommandService
  20 +{
  21 + public $url = 'https://api.cmer.com/v2/chat';
  22 +
  23 + public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
  24 +
  25 + public $model = 'gemini-2.0-flash-lite';
  26 +
  27 + public $supplier = 'google';
  28 +
  29 + /**
  30 + * @remark :Ai一键排版
  31 + * @name :ai_click_layout
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2025/5/26 17:03
  35 + */
  36 + public function send_layout_design($content){
  37 + $param = [
  38 + 'messages'=>[
  39 + ['content'=>$content, 'role'=>'user'],
  40 + ],
  41 + 'model'=> $this->model,
  42 + 'supplier'=> $this->supplier,
  43 + 'security_check'=> false
  44 + ];
  45 + $header = array(
  46 + "Accept: application/json",
  47 + "X-CmerApi-Host: llm-chat.p.cmer.com",
  48 + "apikey: $this->api_key",
  49 + "Content-Type:application/json;charset=utf-8",
  50 + );
  51 + $result = http_post($this->url,json_encode($param,true),$header);
  52 + $data = $result['content'][0]['data'] ?? '';
  53 + $data = trim($data, "\"\n");
  54 + $data = preg_replace('/^```html\s*/', '', $data); // 去除开头
  55 + $data = preg_replace('/\s*```$/', '', $data); // 去除结尾
  56 + $data = str_replace("\\n", "\n", $data);
  57 + $data = str_replace('\"', '"', $data);
  58 + return ['data'=>$data];
  59 + }
  60 +
  61 +}
@@ -189,7 +189,7 @@ class ProjectAssociationServices extends BaseService @@ -189,7 +189,7 @@ class ProjectAssociationServices extends BaseService
189 ]; 189 ];
190 $param['sign'] = $this->getSign($param); 190 $param['sign'] = $this->getSign($param);
191 $url = 'https://hub.ai.cc/api/globalso_ai_customer_service/send_msg'; 191 $url = 'https://hub.ai.cc/api/globalso_ai_customer_service/send_msg';
192 - $result = Http::withoutVerifying()->post($url, $param)->json(); 192 + $result = Http::withoutVerifying()->timeout(30)->post($url, $param)->json();
193 if(empty($result) || $result['status'] != 200){ 193 if(empty($result) || $result['status'] != 200){
194 throw new \Exception($result['message'] ?? ''); 194 throw new \Exception($result['message'] ?? '');
195 } 195 }
@@ -9,10 +9,12 @@ use App\Models\Domain\CountryCode; @@ -9,10 +9,12 @@ use App\Models\Domain\CountryCode;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
10 use App\Models\Inquiry\InquiryForm; 10 use App\Models\Inquiry\InquiryForm;
11 use App\Models\Inquiry\InquiryFormData; 11 use App\Models\Inquiry\InquiryFormData;
  12 +use App\Models\Inquiry\InquiryRelateDomain;
12 use App\Models\Project\AutoEmail; 13 use App\Models\Project\AutoEmail;
13 use App\Models\Project\AutoEmailLog; 14 use App\Models\Project\AutoEmailLog;
14 use App\Models\Project\InquiryFilterConfig; 15 use App\Models\Project\InquiryFilterConfig;
15 use App\Models\Project\Project; 16 use App\Models\Project\Project;
  17 +use App\Models\RouteMap\RouteMap;
16 use App\Models\Subscribe\Email; 18 use App\Models\Subscribe\Email;
17 use App\Models\SyncSubmitTask\SyncSubmitTask; 19 use App\Models\SyncSubmitTask\SyncSubmitTask;
18 use App\Models\Visit\Visit; 20 use App\Models\Visit\Visit;
@@ -20,6 +22,7 @@ use App\Models\WebSetting\WebLanguage; @@ -20,6 +22,7 @@ use App\Models\WebSetting\WebLanguage;
20 use App\Models\Workchat\MessagePush; 22 use App\Models\Workchat\MessagePush;
21 use App\Utils\LogUtils; 23 use App\Utils\LogUtils;
22 use Illuminate\Support\Facades\Cache; 24 use Illuminate\Support\Facades\Cache;
  25 +use Illuminate\Support\Facades\DB;
23 use Illuminate\Support\Facades\Http; 26 use Illuminate\Support\Facades\Http;
24 use Illuminate\Support\Facades\Log; 27 use Illuminate\Support\Facades\Log;
25 use Illuminate\Support\Facades\URL; 28 use Illuminate\Support\Facades\URL;
@@ -337,6 +340,20 @@ class SyncSubmitTaskService @@ -337,6 +340,20 @@ class SyncSubmitTaskService
337 } 340 }
338 Visit::saveData($visit_data, $visit_data['updated_date']); 341 Visit::saveData($visit_data, $visit_data['updated_date']);
339 342
  343 + //pv
  344 + try {
  345 + $url_path = trim(parse_url($visit_data['url'], PHP_URL_PATH), '/');
  346 + if($url_path){
  347 + $route = analysisRoute($url_path);
  348 + $row = RouteMap::where('route', $route)->increment('pv');
  349 + if(!$row){
  350 + Log::channel('visit')->info('route not found:' . $visit_data['url'] );
  351 + }
  352 + }
  353 + }catch (\Exception $e){
  354 + Log::channel('visit')->info('pv inc error:' . $visit_data['url'], [$e->getMessage(), $e->getFile(), $e->getLine()]);
  355 + }
  356 +
340 return true; 357 return true;
341 } 358 }
342 359
@@ -383,7 +400,15 @@ class SyncSubmitTaskService @@ -383,7 +400,15 @@ class SyncSubmitTaskService
383 public static function checkIpCountry($domain, $ip, $type){ 400 public static function checkIpCountry($domain, $ip, $type){
384 $project = Project::getProjectByDomain($domain); 401 $project = Project::getProjectByDomain($domain);
385 if(empty($project)){ 402 if(empty($project)){
386 - throw new InquiryFilterException('项目不存在'); 403 + //是否有关联的域名
  404 + $relate_domain = InquiryRelateDomain::getRelateDomain($domain);
  405 + if(!$relate_domain){
  406 + throw new InquiryFilterException('项目不存在1');
  407 + }
  408 + $project = Project::getProjectByDomain($relate_domain);
  409 + if(!$project){
  410 + throw new InquiryFilterException('项目不存在2');
  411 + }
387 } 412 }
388 413
389 // 访问记录过滤测试环境 414 // 访问记录过滤测试环境
@@ -191,6 +191,12 @@ return [ @@ -191,6 +191,12 @@ return [
191 'level' => 'debug', 191 'level' => 'debug',
192 'days' => 14, 192 'days' => 14,
193 ], 193 ],
  194 + 'visit' => [
  195 + 'driver' => 'daily',
  196 + 'path' => storage_path('logs/visit/laravel.log'),
  197 + 'level' => 'debug',
  198 + 'days' => 14,
  199 + ],
194 'ai_blog' => [ 200 'ai_blog' => [
195 'driver' => 'daily', 201 'driver' => 'daily',
196 'path' => storage_path('logs/ai_blog/laravel.log'), 202 'path' => storage_path('logs/ai_blog/laravel.log'),
@@ -73,3 +73,6 @@ Route::any('/addRedirect',[\App\Http\Controllers\Api\NoticeController::class,'ad @@ -73,3 +73,6 @@ Route::any('/addRedirect',[\App\Http\Controllers\Api\NoticeController::class,'ad
73 Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateController::class, 'inquiry_relate_domain']); 73 Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateController::class, 'inquiry_relate_domain']);
74 // 通过域名获取项目人员配置 74 // 通过域名获取项目人员配置
75 Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']); 75 Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']);
  76 +
  77 +// 获取信息通过商户号
  78 +Route::any('/get_project_by_mch_id', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectByMchId']);
@@ -220,6 +220,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -220,6 +220,7 @@ Route::middleware(['aloginauth'])->group(function () {
220 Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); 220 Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList');
221 Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages'); 221 Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages');
222 }); 222 });
  223 +
223 //更新项目tdk 224 //更新项目tdk
224 Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); 225 Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk');
225 //项目内容采集 226 //项目内容采集
@@ -314,7 +315,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -314,7 +315,7 @@ Route::middleware(['aloginauth'])->group(function () {
314 Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关 315 Route::any('/getAnchorLink', [Aside\Optimize\OptimizeController::class, 'getAnchorLink'])->name('admin.optimize_getAnchorLink');//设置robots开关
315 Route::any('/getAfterCount', [Aside\Optimize\AfterCountController::class, 'getAfterCount'])->name('admin.optimize_getAfterCount');//售后统计数据 316 Route::any('/getAfterCount', [Aside\Optimize\AfterCountController::class, 'getAfterCount'])->name('admin.optimize_getAfterCount');//售后统计数据
316 Route::any('/getAfterCountInfo', [Aside\Optimize\AfterCountController::class, 'getAfterCountInfo'])->name('admin.optimize_getAfterCountInfo');//售后统计数据详情 317 Route::any('/getAfterCountInfo', [Aside\Optimize\AfterCountController::class, 'getAfterCountInfo'])->name('admin.optimize_getAfterCountInfo');//售后统计数据详情
317 - 318 + Route::any('/saveIsAnalysis', [Aside\Optimize\OptimizeController::class, 'saveIsAnalysis'])->name('admin.optimize_saveIsAnalysis');//优化中台开启与关闭泛解析
318 //检查列表 319 //检查列表
319 Route::prefix('check_list')->group(function () { 320 Route::prefix('check_list')->group(function () {
320 Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists'); 321 Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists');
@@ -360,7 +361,6 @@ Route::middleware(['aloginauth'])->group(function () { @@ -360,7 +361,6 @@ Route::middleware(['aloginauth'])->group(function () {
360 Route::any('/save', [Aside\Optimize\ProjectGscController::class, 'save'])->name('admin.gsc_save'); 361 Route::any('/save', [Aside\Optimize\ProjectGscController::class, 'save'])->name('admin.gsc_save');
361 Route::any('/del', [Aside\Optimize\ProjectGscController::class, 'del'])->name('admin.gsc_del'); 362 Route::any('/del', [Aside\Optimize\ProjectGscController::class, 'del'])->name('admin.gsc_del');
362 }); 363 });
363 -  
364 //询盘 364 //询盘
365 Route::prefix('inquiry')->group(function () { 365 Route::prefix('inquiry')->group(function () {
366 Route::any('/', [Aside\Optimize\InquiryInfoController::class, 'lists'])->name('admin.inquiry_lists'); 366 Route::any('/', [Aside\Optimize\InquiryInfoController::class, 'lists'])->name('admin.inquiry_lists');
@@ -570,6 +570,11 @@ Route::middleware(['aloginauth'])->group(function () { @@ -570,6 +570,11 @@ Route::middleware(['aloginauth'])->group(function () {
570 Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info'); 570 Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info');
571 Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save'); 571 Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save');
572 Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del'); 572 Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del');
  573 + //聚合页关键词前后缀
  574 + Route::prefix('affix')->group(function () {
  575 + Route::any('/getAffix', [Aside\Project\AggregateKeywordAffixController::class, 'getAffix'])->name('admin.affix_getAffix');
  576 + Route::any('/saveAffix', [Aside\Project\AggregateKeywordAffixController::class, 'saveAffix'])->name('admin.affix_saveAffix');
  577 + });
573 }); 578 });
574 579
575 }); 580 });
@@ -104,6 +104,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -104,6 +104,11 @@ Route::middleware(['bloginauth'])->group(function () {
104 Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status'); 104 Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
105 Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort'); 105 Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort');
106 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList'); 106 Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
  107 + //新闻扩展模块
  108 + Route::any('/extend/', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'lists'])->name('news_extend_lists');
  109 + Route::any('/extend/save', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'save'])->name('news_extend_save');
  110 + Route::any('/extend/status', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'status'])->name('news_extend_status');
  111 + Route::any('/extend/del', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'del'])->name('news_extend_del');
107 }); 112 });
108 113
109 //博客相关路由 114 //博客相关路由
@@ -148,6 +153,9 @@ Route::middleware(['bloginauth'])->group(function () { @@ -148,6 +153,9 @@ Route::middleware(['bloginauth'])->group(function () {
148 Route::prefix('command')->group(function () { 153 Route::prefix('command')->group(function () {
149 //公用ai自动生成 154 //公用ai自动生成
150 Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post'); 155 Route::any('/ai_http_post', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'ai_http_post'])->name('ai_http_post');
  156 + Route::any('/getLayoutDesignInfo', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'getLayoutDesignInfo'])->name('ai_getLayoutDesignInfo');
  157 + Route::any('/saveLayoutDesign', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'saveLayoutDesign'])->name('ai_saveLayoutDesign');
  158 + Route::any('/sendLayoutDesign', [\App\Http\Controllers\Bside\Ai\AiCommandController::class, 'sendLayoutDesign'])->name('ai_sendLayoutDesign');
151 }); 159 });
152 160
153 //ai生成相关接口 161 //ai生成相关接口
@@ -444,7 +452,14 @@ Route::middleware(['bloginauth'])->group(function () { @@ -444,7 +452,14 @@ Route::middleware(['bloginauth'])->group(function () {
444 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save'); 452 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save');
445 Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'del'])->name('template_module_project_del'); 453 Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'del'])->name('template_module_project_del');
446 }); 454 });
447 - 455 + //随机模块
  456 + Route::prefix('random')->group(function () {
  457 + //获取所有左侧模版
  458 + Route::any('/getRandomList', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'getRandomList'])->name('template_random_getRandomList');
  459 + Route::any('/getRandomInfo', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'getRandomInfo'])->name('template_random_getRandomInfo');
  460 + Route::any('/saveRandomModule', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'saveRandomModule'])->name('template_random_saveRandomModule');
  461 + Route::any('/delRandom', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'delRandom'])->name('template_random_delRandom');
  462 + });
448 //编辑记录 463 //编辑记录
449 Route::prefix('log')->group(function () { 464 Route::prefix('log')->group(function () {
450 //获取所有左侧模版 465 //获取所有左侧模版