Merge remote-tracking branch 'origin/master' into akun
正在显示
38 个修改的文件
包含
437 行增加
和
91 行删除
| @@ -4,6 +4,7 @@ namespace App\Console\Commands\Ai; | @@ -4,6 +4,7 @@ namespace App\Console\Commands\Ai; | ||
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\Project\ProjectLogic; | 5 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 6 | use App\Models\Ai\AiBlog; | 6 | use App\Models\Ai\AiBlog; |
| 7 | +use App\Models\Ai\AiBlogKeyword; | ||
| 7 | use App\Models\Ai\AiBlogOpenLog; | 8 | use App\Models\Ai\AiBlogOpenLog; |
| 8 | use App\Models\Project\AiBlogTask as AiBlogTaskModel; | 9 | use App\Models\Project\AiBlogTask as AiBlogTaskModel; |
| 9 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| @@ -77,17 +78,25 @@ class AiBlogAutoPublish extends Command | @@ -77,17 +78,25 @@ class AiBlogAutoPublish extends Command | ||
| 77 | $this->output("项目{$project->id}未到执行时间" . $next_auto_date); | 78 | $this->output("项目{$project->id}未到执行时间" . $next_auto_date); |
| 78 | continue; | 79 | continue; |
| 79 | } | 80 | } |
| 80 | - //核心关键词+网站关键词+白帽关键词 | ||
| 81 | - $main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword'); | ||
| 82 | - $main_keywords = explode("\r\n", $main_keywords); | ||
| 83 | - $seo_keywords = ProjectKeyword::where('project_id', $project->id)->value('seo_keywords'); | ||
| 84 | - $seo_keywords = explode("\r\n", $seo_keywords); | ||
| 85 | - ProjectServer::useProject($project->id); | ||
| 86 | - $site_keywords = WebSetting::where('project_id', $project->id)->value('keyword'); | ||
| 87 | - DB::disconnect('custom_mysql'); | ||
| 88 | - $site_keywords = explode(",", $site_keywords); | ||
| 89 | - $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords)); | ||
| 90 | - $keywords = array_map('trim', $keywords); | 81 | + $aiKeywordModel = new AiBlogKeyword(); |
| 82 | + $keywords = $aiKeywordModel->getValue(['project_id'=>$project->id],'keywords'); | ||
| 83 | + if(empty($keywords)){ | ||
| 84 | + //核心关键词+网站关键词+白帽关键词 | ||
| 85 | + $main_keywords = ProjectKeyword::where('project_id', $project->id)->value('main_keyword'); | ||
| 86 | + $main_keywords = explode("\r\n", $main_keywords); | ||
| 87 | + $seo_keywords = ProjectKeyword::where('project_id', $project->id)->value('seo_keywords'); | ||
| 88 | + $seo_keywords = explode("\r\n", $seo_keywords); | ||
| 89 | + ProjectServer::useProject($project->id); | ||
| 90 | + $site_keywords = WebSetting::where('project_id', $project->id)->value('keyword'); | ||
| 91 | + DB::disconnect('custom_mysql'); | ||
| 92 | + $site_keywords = explode(",", $site_keywords); | ||
| 93 | + $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords)); | ||
| 94 | + $keywords = array_map('trim', $keywords); | ||
| 95 | + }else{ | ||
| 96 | + $keywords = explode("\r\n", $keywords); | ||
| 97 | + $keywords = array_map('trim', $keywords); // 清理空格 | ||
| 98 | + $keywords = array_filter($keywords); // 移除空值 | ||
| 99 | + } | ||
| 91 | if (empty($keywords)) { | 100 | if (empty($keywords)) { |
| 92 | $this->output("项目{$project->id}未获取到关键词"); | 101 | $this->output("项目{$project->id}未获取到关键词"); |
| 93 | continue; | 102 | continue; |
| @@ -82,9 +82,10 @@ class RemainDay extends Command | @@ -82,9 +82,10 @@ class RemainDay extends Command | ||
| 82 | $list = $projectModel->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','version','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day','geo_qualify_num']); | 82 | $list = $projectModel->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','version','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day','geo_qualify_num']); |
| 83 | foreach ($list as $item){ | 83 | foreach ($list as $item){ |
| 84 | $deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']); | 84 | $deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']); |
| 85 | - echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL; | 85 | + $this->output('start->项目id:' . $item['id'],$item['id']); |
| 86 | //todo::暂停的项目停止计时 | 86 | //todo::暂停的项目停止计时 |
| 87 | if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目 | 87 | if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目 |
| 88 | + $this->output('暂停的项目id:' . $item['id'],$item['id']); | ||
| 88 | if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){ | 89 | if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){ |
| 89 | $pause_days = $item['pause_days'] + 1; | 90 | $pause_days = $item['pause_days'] + 1; |
| 90 | } | 91 | } |
| @@ -96,6 +97,8 @@ class RemainDay extends Command | @@ -96,6 +97,8 @@ class RemainDay extends Command | ||
| 96 | } | 97 | } |
| 97 | //todo::优化项目中途达标计时切换为按天计时 | 98 | //todo::优化项目中途达标计时切换为按天计时 |
| 98 | if(in_array($item['id'],$this->projectSwitchId)){ | 99 | if(in_array($item['id'],$this->projectSwitchId)){ |
| 100 | + $this->output('中途切换计时的项目id:' . $item['id'].',旧达标天数:'.$item['finish_remain_day'].',新达标天数:'.($item['finish_remain_day'] + 1),$item['id']); | ||
| 101 | + $this->output('中途切换计时的项目id:' . $item['id'].',当前剩余服务时常:'.$item['remain_day'].',剩余时常:'.($item['remain_day'] - 1),$item['id']); | ||
| 99 | $this->project->edit(['remain_day'=>($item['remain_day'] - 1),'finish_remain_day'=>($item['finish_remain_day'] + 1)],['id'=>$item['id']]); | 102 | $this->project->edit(['remain_day'=>($item['remain_day'] - 1),'finish_remain_day'=>($item['finish_remain_day'] + 1)],['id'=>$item['id']]); |
| 100 | continue; | 103 | continue; |
| 101 | } | 104 | } |
| @@ -103,7 +106,7 @@ class RemainDay extends Command | @@ -103,7 +106,7 @@ class RemainDay extends Command | ||
| 103 | $this->seoRemainDay($deploy_build,$item); | 106 | $this->seoRemainDay($deploy_build,$item); |
| 104 | //默认版本统计 | 107 | //默认版本统计 |
| 105 | $this->remainDay($item,$deploy_build); | 108 | $this->remainDay($item,$deploy_build); |
| 106 | - echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL; | 109 | + $this->output('end->项目id:' . $item['id']); |
| 107 | } | 110 | } |
| 108 | return true; | 111 | return true; |
| 109 | } | 112 | } |
| @@ -121,14 +124,17 @@ class RemainDay extends Command | @@ -121,14 +124,17 @@ class RemainDay extends Command | ||
| 121 | //白帽版本的系统 | 124 | //白帽版本的系统 |
| 122 | if($deploy_build['seo_plan'] != 0){ | 125 | if($deploy_build['seo_plan'] != 0){ |
| 123 | if($deploy_build['seo_service_duration'] != 0){ | 126 | if($deploy_build['seo_service_duration'] != 0){ |
| 127 | + $this->output('白帽计算剩余服务时常:'.$item['id'],$item['id']); | ||
| 124 | if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){ | 128 | if(in_array($item['id'],$this->bm_projectId) || (in_array( 19,$item['level']))){ |
| 125 | $compliance_day = (int)$item['bm_finish_remain_day']; | 129 | $compliance_day = (int)$item['bm_finish_remain_day']; |
| 126 | $seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day']; | 130 | $seo_remain_day = $deploy_build['seo_service_duration'] - (int)$item['bm_finish_remain_day']; |
| 131 | + $this->output('按白帽达标天数统计:'.$item['id'].',bm达标天数:'.$item['bm_finish_remain_day'].',bm剩余白帽天数:'.$seo_remain_day,$item['id']); | ||
| 127 | }else{ | 132 | }else{ |
| 128 | //按自然日统计 | 133 | //按自然日统计 |
| 129 | $diff = time() - strtotime($item['uptime']); | 134 | $diff = time() - strtotime($item['uptime']); |
| 130 | $compliance_day = floor($diff / (60 * 60 * 24)); | 135 | $compliance_day = floor($diff / (60 * 60 * 24)); |
| 131 | $seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day; | 136 | $seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day; |
| 137 | + $this->output('按白帽自然日天数统计:'.$item['id'].',bm达标天数:'.$compliance_day.',bm剩余白帽天数:'.$seo_remain_day,$item['id']); | ||
| 132 | } | 138 | } |
| 133 | $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); | 139 | $this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); |
| 134 | } | 140 | } |
| @@ -144,8 +150,10 @@ class RemainDay extends Command | @@ -144,8 +150,10 @@ class RemainDay extends Command | ||
| 144 | * @time :2025/4/25 14:31 | 150 | * @time :2025/4/25 14:31 |
| 145 | */ | 151 | */ |
| 146 | public function remainDay($item,$deploy_build){ | 152 | public function remainDay($item,$deploy_build){ |
| 153 | + $this->output('普通项目计算剩余服务时常:'.$item['id'],$item['id']); | ||
| 147 | //默认版本统计 | 154 | //默认版本统计 |
| 148 | - if($deploy_build['service_duration'] == 0){ | 155 | + if($deploy_build['service_duration'] == 0 || $deploy_build['plan'] == 0){ |
| 156 | + $this->output('当前项目跳过:'.$item['id'],$item['id']); | ||
| 149 | return false; | 157 | return false; |
| 150 | } | 158 | } |
| 151 | //默认版本计算剩余服务时常 | 159 | //默认版本计算剩余服务时常 |
| @@ -159,17 +167,21 @@ class RemainDay extends Command | @@ -159,17 +167,21 @@ class RemainDay extends Command | ||
| 159 | $diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']); | 167 | $diff = time() - strtotime($opInfo['start_date'] ?? $item['uptime']); |
| 160 | $compliance_day = floor($diff / (60 * 60 * 24)); | 168 | $compliance_day = floor($diff / (60 * 60 * 24)); |
| 161 | $remain_day = $deploy_build['service_duration'] - $compliance_day; | 169 | $remain_day = $deploy_build['service_duration'] - $compliance_day; |
| 170 | + $this->output('已开始优化的时间结算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']); | ||
| 162 | }else{ | 171 | }else{ |
| 163 | $compliance_day = ($item['finish_remain_day'] ?? 0); | 172 | $compliance_day = ($item['finish_remain_day'] ?? 0); |
| 164 | //todo::7.5版本单独计算 | 173 | //todo::7.5版本单独计算 |
| 165 | if($item['version'] == 7.5 && $deploy_build['seo_plan'] != 0 && $deploy_build['plan'] != 0){ | 174 | if($item['version'] == 7.5 && $deploy_build['seo_plan'] != 0 && $deploy_build['plan'] != 0){ |
| 166 | $geoCountModel = new GeoCount(); | 175 | $geoCountModel = new GeoCount(); |
| 167 | $is_qualify = $geoCountModel->where('project_id', $item['id'])->orderBy('id', 'desc')->value('is_qualify'); | 176 | $is_qualify = $geoCountModel->where('project_id', $item['id'])->orderBy('id', 'desc')->value('is_qualify'); |
| 168 | - if($compliance_day > 0 && $is_qualify > 0){ | ||
| 169 | - $compliance_day = 1; | 177 | + if($item['is_remain_today'] > 0 && $is_qualify > 0){ |
| 178 | + $remain_day = $item['remain_day'] - 1; | ||
| 170 | } | 179 | } |
| 180 | + $this->output('7.5版本单独计算:'.$item['id'].',剩余服务时常:'.$remain_day,$item['id']); | ||
| 181 | + }else{ | ||
| 182 | + $remain_day = $deploy_build['service_duration'] - $compliance_day; | ||
| 183 | + $this->output('优化项目:'.$item['id'].',剩余服务时常:'.$remain_day.',已达标天数:'.$compliance_day,$item['id']); | ||
| 171 | } | 184 | } |
| 172 | - $remain_day = $deploy_build['service_duration'] - $compliance_day; | ||
| 173 | } | 185 | } |
| 174 | }else{ | 186 | }else{ |
| 175 | //普通建站项目 | 187 | //普通建站项目 |
| @@ -182,11 +194,20 @@ class RemainDay extends Command | @@ -182,11 +194,20 @@ class RemainDay extends Command | ||
| 182 | } | 194 | } |
| 183 | } | 195 | } |
| 184 | $extend_type = 0; | 196 | $extend_type = 0; |
| 185 | -// if($remain_day < 0 && $deploy_build['service_duration'] != 0){ | ||
| 186 | -// $remain_day = 0; | ||
| 187 | -// $extend_type = Project::TYPE_FIVE; | ||
| 188 | -// } | ||
| 189 | $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); | 197 | $this->project->edit(['remain_day'=>$remain_day,'extend_type'=>$extend_type,'finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]); |
| 190 | return true; | 198 | return true; |
| 191 | } | 199 | } |
| 200 | + | ||
| 201 | + /** | ||
| 202 | + * 输入日志 | ||
| 203 | + * @param $message | ||
| 204 | + * @return bool | ||
| 205 | + */ | ||
| 206 | + public function output($message,$project_id = 1) | ||
| 207 | + { | ||
| 208 | + $message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL; | ||
| 209 | + echo $message; | ||
| 210 | + file_put_contents(storage_path('logs/remain_day/') . $project_id . '.log', $message, FILE_APPEND); | ||
| 211 | + return true; | ||
| 212 | + } | ||
| 192 | } | 213 | } |
| @@ -35,6 +35,7 @@ use App\Services\CosService; | @@ -35,6 +35,7 @@ use App\Services\CosService; | ||
| 35 | use App\Services\Geo\GeoService; | 35 | use App\Services\Geo\GeoService; |
| 36 | use App\Services\MidJourneyService; | 36 | use App\Services\MidJourneyService; |
| 37 | use App\Services\ProjectServer; | 37 | use App\Services\ProjectServer; |
| 38 | +use Hashids\Hashids; | ||
| 38 | use Illuminate\Console\Command; | 39 | use Illuminate\Console\Command; |
| 39 | use Illuminate\Support\Carbon; | 40 | use Illuminate\Support\Carbon; |
| 40 | use Illuminate\Support\Facades\DB; | 41 | use Illuminate\Support\Facades\DB; |
| @@ -56,7 +57,7 @@ class lyhDemo extends Command | @@ -56,7 +57,7 @@ class lyhDemo extends Command | ||
| 56 | protected $description = '更新路由'; | 57 | protected $description = '更新路由'; |
| 57 | 58 | ||
| 58 | public function handle(){ | 59 | public function handle(){ |
| 59 | - return $this->translate_action(); | 60 | + return $this->_actionRoute(); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | public function _actionDa() | 63 | public function _actionDa() |
| @@ -113,21 +114,16 @@ class lyhDemo extends Command | @@ -113,21 +114,16 @@ class lyhDemo extends Command | ||
| 113 | */ | 114 | */ |
| 114 | public function _actionRoute(){ | 115 | public function _actionRoute(){ |
| 115 | $projectModel = new Project(); | 116 | $projectModel = new Project(); |
| 116 | - $lists = $projectModel->list(['delete_status' => 0,'is_ai_blog'=>1,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']); | 117 | + $lists = $projectModel->list([], 'id', ['id']); |
| 117 | $data = []; | 118 | $data = []; |
| 118 | foreach ($lists as $item){ | 119 | foreach ($lists as $item){ |
| 119 | echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; | 120 | echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; |
| 120 | - ProjectServer::useProject($item['id']); | ||
| 121 | - $aiBlogModel = new AiBlog(); | ||
| 122 | - $info = $aiBlogModel->read(['text'=>['like','%href="blog/%']],['id']); | ||
| 123 | - if($info !== false){ | ||
| 124 | - echo '需要处理->项目id:'.$item['id'].PHP_EOL; | ||
| 125 | - $data[] = $item['id']; | ||
| 126 | - } | ||
| 127 | - echo 'end'; | ||
| 128 | - DB::disconnect('custom_mysql'); | 121 | + $letters = range('A', 'X'); // 只取前 24 个字母(A ~ X) |
| 122 | + $randomLetter = $letters[array_rand($letters)]; | ||
| 123 | + $data['post_id'] = $randomLetter.mt_rand(100000, 999999).$item['id']; | ||
| 124 | + $projectModel->edit(['post_id'=>$data['post_id']],['id'=>$item['id']]); | ||
| 129 | } | 125 | } |
| 130 | - dd($data); | 126 | + return true; |
| 131 | } | 127 | } |
| 132 | 128 | ||
| 133 | public function _actionTemplateMain(){ | 129 | public function _actionTemplateMain(){ |
| @@ -94,7 +94,6 @@ class CopyOldProject extends Command | @@ -94,7 +94,6 @@ class CopyOldProject extends Command | ||
| 94 | if (in_array($table, [ | 94 | if (in_array($table, [ |
| 95 | 'gl_customer_visit', 'gl_customer_visit_item', | 95 | 'gl_customer_visit', 'gl_customer_visit_item', |
| 96 | 'gl_inquiry_other', 'gl_inquiry_form_data', 'gl_inquiry_form', | 96 | 'gl_inquiry_other', 'gl_inquiry_form_data', 'gl_inquiry_form', |
| 97 | - 'gl_ai_blog', 'gl_ai_blog_author', 'gl_ai_blog_list', 'gl_ai_blog_log' | ||
| 98 | ])) { | 97 | ])) { |
| 99 | continue; | 98 | continue; |
| 100 | } | 99 | } |
| @@ -98,8 +98,9 @@ class CopyProject extends Command | @@ -98,8 +98,9 @@ class CopyProject extends Command | ||
| 98 | $data['old_project_id'] = $old_project_id; | 98 | $data['old_project_id'] = $old_project_id; |
| 99 | unset($data['id'],$data['exclusive_aicc_day'],$data['aicc'],$data['robots'],$data['is_translate_tag'],$data['is_translate'],$data['is_minor_languages'],$data['uptime']); | 99 | unset($data['id'],$data['exclusive_aicc_day'],$data['aicc'],$data['robots'],$data['is_translate_tag'],$data['is_translate'],$data['is_minor_languages'],$data['uptime']); |
| 100 | $project_id = $projectModel->insertGetId($data); | 100 | $project_id = $projectModel->insertGetId($data); |
| 101 | + $data['post_id'] = mt_rand(100000, 999999).$project_id; | ||
| 101 | $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); | 102 | $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); |
| 102 | - $projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]); | 103 | + $projectModel->edit(['from_order_id'=>$hashids->encode($project_id),'post_id'=>$data['post_id']],['id'=>$project_id]); |
| 103 | //复制设置的模版 | 104 | //复制设置的模版 |
| 104 | $settingTemplateModel = new Setting(); | 105 | $settingTemplateModel = new Setting(); |
| 105 | $settingData = $settingTemplateModel::where('project_id', $old_project_id)->first(); | 106 | $settingData = $settingTemplateModel::where('project_id', $old_project_id)->first(); |
| @@ -217,6 +218,7 @@ class CopyProject extends Command | @@ -217,6 +218,7 @@ class CopyProject extends Command | ||
| 217 | //创建数据库 | 218 | //创建数据库 |
| 218 | ProjectServer::createDatabase($project); | 219 | ProjectServer::createDatabase($project); |
| 219 | //创建表 | 220 | //创建表 |
| 221 | +// ProjectServer::initTable(); | ||
| 220 | $this->initTable($project_id,$new_project_id); | 222 | $this->initTable($project_id,$new_project_id); |
| 221 | } | 223 | } |
| 222 | 224 | ||
| @@ -244,38 +246,34 @@ class CopyProject extends Command | @@ -244,38 +246,34 @@ class CopyProject extends Command | ||
| 244 | if (!$exists) { | 246 | if (!$exists) { |
| 245 | @file_put_contents( | 247 | @file_put_contents( |
| 246 | storage_path('logs/copy_mysql_error.log'), | 248 | storage_path('logs/copy_mysql_error.log'), |
| 247 | - "源库中不存在表:{$table}" . PHP_EOL, | 249 | + date('Y-m-d H:i:s')."源库中不存在表:{$table}" . PHP_EOL, |
| 248 | FILE_APPEND | 250 | FILE_APPEND |
| 249 | ); | 251 | ); |
| 250 | continue; | 252 | continue; |
| 251 | } | 253 | } |
| 252 | // 2. 删除目标数据库中的表 | 254 | // 2. 删除目标数据库中的表 |
| 253 | $result = DB::connection('custom_mysql')->statement("DROP TABLE IF EXISTS `{$table}`"); | 255 | $result = DB::connection('custom_mysql')->statement("DROP TABLE IF EXISTS `{$table}`"); |
| 254 | - @file_put_contents(storage_path('logs/copy_mysql_error.log'), "删除旧表:{$table} => {$result}" . PHP_EOL, FILE_APPEND); | ||
| 255 | // 3. 复制建表 SQL | 256 | // 3. 复制建表 SQL |
| 256 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE `{$table}`"); | 257 | $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE `{$table}`"); |
| 257 | $createSql = get_object_vars($sql[0])['Create Table']; | 258 | $createSql = get_object_vars($sql[0])['Create Table']; |
| 258 | $result1 = DB::connection('custom_mysql')->statement($createSql); | 259 | $result1 = DB::connection('custom_mysql')->statement($createSql); |
| 259 | - @file_put_contents(storage_path('logs/copy_mysql_error.log'), "创建表:{$table} => {$result1}" . PHP_EOL, FILE_APPEND); | ||
| 260 | - | 260 | + @file_put_contents(storage_path('logs/copy_mysql_error.log'), date('Y-m-d H:i:s')."创建表:{$table} => {$result1}" . PHP_EOL, FILE_APPEND); |
| 261 | // 4. 跳过指定表 | 261 | // 4. 跳过指定表 |
| 262 | if (in_array($table, [ | 262 | if (in_array($table, [ |
| 263 | 'gl_customer_visit', 'gl_customer_visit_item', | 263 | 'gl_customer_visit', 'gl_customer_visit_item', |
| 264 | 'gl_inquiry_other', 'gl_inquiry_form_data', 'gl_inquiry_form', | 264 | 'gl_inquiry_other', 'gl_inquiry_form_data', 'gl_inquiry_form', |
| 265 | - 'gl_ai_blog', 'gl_ai_blog_author', 'gl_ai_blog_list', 'gl_ai_blog_log' | ||
| 266 | ])) { | 265 | ])) { |
| 267 | continue; | 266 | continue; |
| 268 | } | 267 | } |
| 269 | // 5. 插入数据前,再次确认源表存在(双保险) | 268 | // 5. 插入数据前,再次确认源表存在(双保险) |
| 270 | if (!Schema::connection('custom_tmp_mysql_copy')->hasTable($table)) { | 269 | if (!Schema::connection('custom_tmp_mysql_copy')->hasTable($table)) { |
| 271 | - @file_put_contents(storage_path('logs/copy_mysql_error.log'), "插入数据前发现表不存在:{$table}" . PHP_EOL, FILE_APPEND); | ||
| 272 | continue; | 270 | continue; |
| 273 | } | 271 | } |
| 274 | // 6. 原生 SQL 插入数据(完全复制) | 272 | // 6. 原生 SQL 插入数据(完全复制) |
| 275 | $insert_sql = "INSERT INTO `{$table}` SELECT * FROM `gl_data_{$project_id}`.`{$table}`"; | 273 | $insert_sql = "INSERT INTO `{$table}` SELECT * FROM `gl_data_{$project_id}`.`{$table}`"; |
| 276 | try { | 274 | try { |
| 277 | $result2 = DB::connection('custom_mysql')->statement($insert_sql); | 275 | $result2 = DB::connection('custom_mysql')->statement($insert_sql); |
| 278 | - @file_put_contents(storage_path('logs/copy_mysql_error.log'), "插入数据成功:{$table} => {$result2}" . PHP_EOL, FILE_APPEND); | 276 | + @file_put_contents(storage_path('logs/copy_mysql_error.log'), date('Y-m-d H:i:s')."插入数据成功:{$table} => {$result2}" . PHP_EOL, FILE_APPEND); |
| 279 | } catch (\Exception $e) { | 277 | } catch (\Exception $e) { |
| 280 | @file_put_contents(storage_path('logs/copy_mysql_error.log'), | 278 | @file_put_contents(storage_path('logs/copy_mysql_error.log'), |
| 281 | "插入数据失败:{$table} => " . $e->getMessage() . PHP_EOL, | 279 | "插入数据失败:{$table} => " . $e->getMessage() . PHP_EOL, |
| @@ -264,7 +264,7 @@ class SyncProject extends Command | @@ -264,7 +264,7 @@ class SyncProject extends Command | ||
| 264 | $data['project']['project_type'] = 1;//白帽版本 | 264 | $data['project']['project_type'] = 1;//白帽版本 |
| 265 | } | 265 | } |
| 266 | $id = $this->saveProject($data['project']); | 266 | $id = $this->saveProject($data['project']); |
| 267 | - $this->setPostId($data['deploy_build']['plan'] ?? 1,$id); | 267 | + $this->setPostId($id); |
| 268 | $this->savePayment($data['payment'],$id); | 268 | $this->savePayment($data['payment'],$id); |
| 269 | $this->saveDeployBuild($data['deploy_build'],$id); | 269 | $this->saveDeployBuild($data['deploy_build'],$id); |
| 270 | $this->saveDeployOptimize($data['deploy_optimize'],$id); | 270 | $this->saveDeployOptimize($data['deploy_optimize'],$id); |
| @@ -320,13 +320,12 @@ class SyncProject extends Command | @@ -320,13 +320,12 @@ class SyncProject extends Command | ||
| 320 | * @method :post | 320 | * @method :post |
| 321 | * @time :2023/8/9 14:47 | 321 | * @time :2023/8/9 14:47 |
| 322 | */ | 322 | */ |
| 323 | - public function setPostId($plan,$id){ | ||
| 324 | - $length = strlen((string)$id); // 获取变量的位数 | ||
| 325 | - $paddingLength = Project::TYPE_FIVE - $length; // 计算填充前面的 0 的位数 | ||
| 326 | - $zeros = str_repeat("0", $paddingLength); | ||
| 327 | - $number = Project::TYPE_SIX.$plan.$zeros.$id; | 323 | + public function setPostId($id){ |
| 324 | + $letters = range('A', 'X'); // 只取前 24 个字母(A ~ X) | ||
| 325 | + $randomLetter = $letters[array_rand($letters)]; | ||
| 326 | + $post_id = $randomLetter.mt_rand(100000, 999999).$id; | ||
| 328 | $projectModel = new Project(); | 327 | $projectModel = new Project(); |
| 329 | - $projectModel->edit(['post_id'=>$number],['id'=>$id]); | 328 | + $projectModel->edit(['post_id'=>$post_id],['id'=>$id]); |
| 330 | return true; | 329 | return true; |
| 331 | } | 330 | } |
| 332 | 331 |
| @@ -73,13 +73,24 @@ class SyncMobile extends Command | @@ -73,13 +73,24 @@ class SyncMobile extends Command | ||
| 73 | 'type'=>$userModel::TYPE_ONE | 73 | 'type'=>$userModel::TYPE_ONE |
| 74 | ]); | 74 | ]); |
| 75 | } | 75 | } |
| 76 | + $info = $userModel->read(['mobile'=>$mobile,'project_id'=>5172],['id']); | ||
| 77 | + if($info === false){ | ||
| 78 | + $userModel->add([ | ||
| 79 | + 'mobile'=>$mobile, | ||
| 80 | + 'password'=>base64_encode(md5('123456')), | ||
| 81 | + 'project_id'=>5172, | ||
| 82 | + 'name'=>$mobile, | ||
| 83 | + 'type'=>$userModel::TYPE_ONE | ||
| 84 | + ]); | ||
| 85 | + } | ||
| 76 | } | 86 | } |
| 77 | $saveData[] = '13083988828'; | 87 | $saveData[] = '13083988828'; |
| 78 | $managerModel = new Manage(); | 88 | $managerModel = new Manage(); |
| 79 | $mobileArr = $managerModel->selectField(['status'=>1],'mobile'); | 89 | $mobileArr = $managerModel->selectField(['status'=>1],'mobile'); |
| 80 | $saveData = array_values(array_unique(array_merge($saveData,$mobileArr))); | 90 | $saveData = array_values(array_unique(array_merge($saveData,$mobileArr))); |
| 81 | - $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$saveData]]); | ||
| 82 | - $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$saveData]]); | 91 | + $userModel->edit(['status'=>1],['project_id'=>[1,5172],'mobile'=>['not in',$saveData]]); |
| 92 | + $userModel->edit(['status'=>0],['project_id'=>[1,5172],'mobile'=>['in',$saveData]]); | ||
| 93 | + //跟对应的5172项目写一份 | ||
| 83 | } | 94 | } |
| 84 | echo 'end.'.PHP_EOL; | 95 | echo 'end.'.PHP_EOL; |
| 85 | return true; | 96 | return true; |
| @@ -33,9 +33,10 @@ class SyncTimeFiles extends Command | @@ -33,9 +33,10 @@ class SyncTimeFiles extends Command | ||
| 33 | { | 33 | { |
| 34 | // $fileModel = new File(); | 34 | // $fileModel = new File(); |
| 35 | $imagesModel = new Image(); | 35 | $imagesModel = new Image(); |
| 36 | - $start = '2025-10-13 17:20:00'; | 36 | +// $start = '2025-10-14 00:00:00'; |
| 37 | + $start = '2025-10-25 00:00:00'; | ||
| 37 | $end = '2025-10-31 23:59:59'; | 38 | $end = '2025-10-31 23:59:59'; |
| 38 | - $lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'asc'); | 39 | + $lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'desc'); |
| 39 | foreach ($lists as $v){ | 40 | foreach ($lists as $v){ |
| 40 | $path = $v['path']; | 41 | $path = $v['path']; |
| 41 | echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL; | 42 | echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL; |
| @@ -151,7 +151,7 @@ class InquiryController extends BaseController | @@ -151,7 +151,7 @@ class InquiryController extends BaseController | ||
| 151 | } | 151 | } |
| 152 | $result = ReInquiryCount::where('domain', 'like', '%'.$domain.'%')->first(); | 152 | $result = ReInquiryCount::where('domain', 'like', '%'.$domain.'%')->first(); |
| 153 | if($result){ | 153 | if($result){ |
| 154 | - $result->tasks = $result->tasks; //调用访问器 | 154 | + |
| 155 | $return = 0; //所有都关闭或删除就不返回 | 155 | $return = 0; //所有都关闭或删除就不返回 |
| 156 | foreach ($result->tasks as $task){ | 156 | foreach ($result->tasks as $task){ |
| 157 | $return += (!$task['is_del'] && $task['status']); | 157 | $return += (!$task['is_del'] && $task['status']); |
| @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | @@ -6,6 +6,7 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Enums\Common\Common; | 6 | use App\Enums\Common\Common; |
| 7 | use App\Exceptions\AsideGlobalException; | 7 | use App\Exceptions\AsideGlobalException; |
| 8 | use App\Http\Controllers\Controller; | 8 | use App\Http\Controllers\Controller; |
| 9 | +use App\Models\Project\Project; | ||
| 9 | use Illuminate\Http\JsonResponse; | 10 | use Illuminate\Http\JsonResponse; |
| 10 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
| 11 | use Illuminate\Http\Exceptions\HttpResponseException; | 12 | use Illuminate\Http\Exceptions\HttpResponseException; |
| @@ -32,6 +33,7 @@ class BaseController extends Controller | @@ -32,6 +33,7 @@ class BaseController extends Controller | ||
| 32 | { | 33 | { |
| 33 | $this->request = $request; | 34 | $this->request = $request; |
| 34 | $this->param = $this->request->all(); | 35 | $this->param = $this->request->all(); |
| 36 | + $this->handleIdAndProjectId(); | ||
| 35 | $this->token = $this->request->header('token'); | 37 | $this->token = $this->request->header('token'); |
| 36 | $this->getParam(); | 38 | $this->getParam(); |
| 37 | $info = Cache::get(Common::MANAGE_TOKEN . $this->token); | 39 | $info = Cache::get(Common::MANAGE_TOKEN . $this->token); |
| @@ -42,6 +44,42 @@ class BaseController extends Controller | @@ -42,6 +44,42 @@ class BaseController extends Controller | ||
| 42 | } | 44 | } |
| 43 | } | 45 | } |
| 44 | 46 | ||
| 47 | + /** | ||
| 48 | + * @remark :project_id+id处理 | ||
| 49 | + * @name :handleIdAndProjectId | ||
| 50 | + * @author :lyh | ||
| 51 | + * @method :post | ||
| 52 | + * @time :2025/11/6 09:16 | ||
| 53 | + */ | ||
| 54 | + public function handleIdAndProjectId() | ||
| 55 | + { | ||
| 56 | + if(isset($this->param['id']) && !empty($this->param['id']) && !is_array($this->param['id'])){ | ||
| 57 | + if (preg_match('/^[A-Za-z]/', $this->param['id'])) { | ||
| 58 | + $id = Cache::get('project_'.$this->param['id']); | ||
| 59 | + if(empty($id)){ | ||
| 60 | + $projectModel = new Project(); | ||
| 61 | + $id = $projectModel->getValue(['post_id' => $this->param['id']],'id'); | ||
| 62 | + if(!empty($id)){ | ||
| 63 | + Cache::add('project_'.$this->param['id'], $id, 3600 * 12); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + $this->param['id'] = $id; | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + if(isset($this->param['project_id']) && !empty($this->param['project_id']) && !is_array($this->param['project_id'])){ | ||
| 70 | + if (preg_match('/^[A-Za-z]/', $this->param['project_id'])) { | ||
| 71 | + $id = Cache::get('project_'.$this->param['project_id']); | ||
| 72 | + if(empty($id)){ | ||
| 73 | + $projectModel = new Project(); | ||
| 74 | + $id = $projectModel->getValue(['post_id' => $this->param['project_id']],'id'); | ||
| 75 | + if(!empty($id)){ | ||
| 76 | + Cache::add('project_'.$this->param['project_id'], $id, 3600 * 12); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + $this->param['project_id'] = $id; | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + } | ||
| 45 | 83 | ||
| 46 | /** | 84 | /** |
| 47 | * @remark :请求参数处理 | 85 | * @remark :请求参数处理 |
| @@ -82,13 +82,15 @@ class GeoConfirmController extends BaseController | @@ -82,13 +82,15 @@ class GeoConfirmController extends BaseController | ||
| 82 | public function saveInfo() | 82 | public function saveInfo() |
| 83 | { | 83 | { |
| 84 | $this->request->validate([ | 84 | $this->request->validate([ |
| 85 | - 'id' => 'required', | 85 | + 'project_id'=>'required', |
| 86 | 'confirm' => 'required', | 86 | 'confirm' => 'required', |
| 87 | 'confirm_num' => 'required', | 87 | 'confirm_num' => 'required', |
| 88 | + 'type' => 'required', | ||
| 88 | ], [ | 89 | ], [ |
| 89 | - 'id.required' => '主键id不能为空', | 90 | + 'project_id.required' => '主键id不能为空', |
| 90 | 'confirm.required' => '客户确认内容不能为空', | 91 | 'confirm.required' => '客户确认内容不能为空', |
| 91 | 'confirm_num.max' => '客户确认数量不能为空', | 92 | 'confirm_num.max' => '客户确认数量不能为空', |
| 93 | + 'type.max' => '类型不能为空', | ||
| 92 | ]); | 94 | ]); |
| 93 | $data = $this->logic->saveConfirmInfo(); | 95 | $data = $this->logic->saveConfirmInfo(); |
| 94 | $this->response('success', Code::SUCCESS, $data); | 96 | $this->response('success', Code::SUCCESS, $data); |
| @@ -41,7 +41,7 @@ class ManageEntryPositionController extends BaseController | @@ -41,7 +41,7 @@ class ManageEntryPositionController extends BaseController | ||
| 41 | */ | 41 | */ |
| 42 | public function lists() | 42 | public function lists() |
| 43 | { | 43 | { |
| 44 | - $data = $this->logic->listEntryPosition(); | 44 | + $data = $this->logic->listEntryPosition($this->map,$this->page,$this->row,$this->order); |
| 45 | $this->response('success',Code::SUCCESS,$data); | 45 | $this->response('success',Code::SUCCESS,$data); |
| 46 | } | 46 | } |
| 47 | 47 |
| @@ -63,6 +63,7 @@ class OnlineController extends BaseController | @@ -63,6 +63,7 @@ class OnlineController extends BaseController | ||
| 63 | 'gl_project.title AS title', | 63 | 'gl_project.title AS title', |
| 64 | 'gl_project.channel AS channel', | 64 | 'gl_project.channel AS channel', |
| 65 | 'gl_project.type AS type', | 65 | 'gl_project.type AS type', |
| 66 | + 'gl_project.post_id AS post_id', | ||
| 66 | 'gl_project.created_at AS created_at', | 67 | 'gl_project.created_at AS created_at', |
| 67 | 'gl_project.is_upgrade AS is_upgrade', | 68 | 'gl_project.is_upgrade AS is_upgrade', |
| 68 | 'gl_project_online_check.id AS online_check_id', | 69 | 'gl_project_online_check.id AS online_check_id', |
| @@ -197,6 +197,7 @@ class OptimizeController extends BaseController | @@ -197,6 +197,7 @@ class OptimizeController extends BaseController | ||
| 197 | 'gl_project.level AS level', | 197 | 'gl_project.level AS level', |
| 198 | 'gl_project.channel AS channel', | 198 | 'gl_project.channel AS channel', |
| 199 | 'gl_project.company AS company', | 199 | 'gl_project.company AS company', |
| 200 | + 'gl_project.post_id AS post_id', | ||
| 200 | 'gl_project.type AS type', | 201 | 'gl_project.type AS type', |
| 201 | 'gl_project.created_at AS created_at', | 202 | 'gl_project.created_at AS created_at', |
| 202 | 'gl_project.is_language AS is_language', | 203 | 'gl_project.is_language AS is_language', |
| @@ -267,8 +268,10 @@ class OptimizeController extends BaseController | @@ -267,8 +268,10 @@ class OptimizeController extends BaseController | ||
| 267 | $query = $query->where('gl_project.site_status',$this->map['site_status']); | 268 | $query = $query->where('gl_project.site_status',$this->map['site_status']); |
| 268 | } | 269 | } |
| 269 | if(isset($this->map['seo_plan'])){ | 270 | if(isset($this->map['seo_plan'])){ |
| 270 | - if(is_array($this->map['seo_plan'])){ | ||
| 271 | - $query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan']); | 271 | + if($this->map['seo_plan'] == 0){ |
| 272 | + $query = $query->where('gl_project_deploy_build.plan','!=',0); | ||
| 273 | + }elseif(is_array($this->map['seo_plan'])){ | ||
| 274 | + $query = $query->whereIn('gl_project_deploy_build.seo_plan',$this->map['seo_plan'])->where('gl_project_deploy_build.plan',0); | ||
| 272 | }else{ | 275 | }else{ |
| 273 | $query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']); | 276 | $query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']); |
| 274 | } | 277 | } |
| @@ -289,7 +292,7 @@ class OptimizeController extends BaseController | @@ -289,7 +292,7 @@ class OptimizeController extends BaseController | ||
| 289 | $query = $query->whereRaw("FIND_IN_SET(?, gl_project.level) > 0", [$this->map['level']]); | 292 | $query = $query->whereRaw("FIND_IN_SET(?, gl_project.level) > 0", [$this->map['level']]); |
| 290 | } | 293 | } |
| 291 | if(isset($this->map['online_updated_at']) && !empty($this->map['online_updated_at']) && is_array($this->map['online_updated_at'])){ | 294 | if(isset($this->map['online_updated_at']) && !empty($this->map['online_updated_at']) && is_array($this->map['online_updated_at'])){ |
| 292 | - $query = $query->where('gl_project_deploy_optimize.start_date','>=' ,$this->map['online_updated_at'][0])->where('gl_project_deploy_optimize.start_date','<' ,$this->map['online_updated_at'][1]); | 295 | + $query = $query->where('gl_project_deploy_optimize.start_date','>=' ,$this->map['online_updated_at'][0])->where('gl_project_deploy_optimize.start_date','<=' ,$this->map['online_updated_at'][1]); |
| 293 | } | 296 | } |
| 294 | if(isset($this->map['special'])){ | 297 | if(isset($this->map['special'])){ |
| 295 | $query = $query->whereRaw("FIND_IN_SET(?, gl_project_deploy_optimize.special) > 0", [$this->map['special']]); | 298 | $query = $query->whereRaw("FIND_IN_SET(?, gl_project_deploy_optimize.special) > 0", [$this->map['special']]); |
| @@ -96,6 +96,7 @@ class ProjectController extends BaseController | @@ -96,6 +96,7 @@ class ProjectController extends BaseController | ||
| 96 | 'gl_project.title AS title', | 96 | 'gl_project.title AS title', |
| 97 | 'gl_project.channel AS channel', | 97 | 'gl_project.channel AS channel', |
| 98 | 'gl_project.company AS company', | 98 | 'gl_project.company AS company', |
| 99 | + 'gl_project.post_id AS post_id', | ||
| 99 | 'gl_project.type AS type', | 100 | 'gl_project.type AS type', |
| 100 | 'gl_project.project_type AS project_type', | 101 | 'gl_project.project_type AS project_type', |
| 101 | 'gl_project.extend_type AS extend_type', | 102 | 'gl_project.extend_type AS extend_type', |
| @@ -512,12 +513,7 @@ class ProjectController extends BaseController | @@ -512,12 +513,7 @@ class ProjectController extends BaseController | ||
| 512 | */ | 513 | */ |
| 513 | public function info(ProjectLogic $logic) | 514 | public function info(ProjectLogic $logic) |
| 514 | { | 515 | { |
| 515 | - $this->request->validate([ | ||
| 516 | - 'id' => 'required' | ||
| 517 | - ], [ | ||
| 518 | - 'id.required' => 'ID不能为空' | ||
| 519 | - ]); | ||
| 520 | - $data = $logic->getProjectInfo($this->param['id']); | 516 | + $data = $logic->getProjectInfo(); |
| 521 | $this->response('success', Code::SUCCESS, $data); | 517 | $this->response('success', Code::SUCCESS, $data); |
| 522 | } | 518 | } |
| 523 | 519 |
| @@ -32,7 +32,7 @@ class RenewProjectController extends BaseController | @@ -32,7 +32,7 @@ class RenewProjectController extends BaseController | ||
| 32 | */ | 32 | */ |
| 33 | public function lists(Project $project){ | 33 | public function lists(Project $project){ |
| 34 | $map = $this->searchParam($this->map); | 34 | $map = $this->searchParam($this->map); |
| 35 | - $filed = ['id', 'title', 'type' ,'mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at','delete_status']; | 35 | + $filed = ['id', 'title', 'type' , 'post_id','mysql_id' ,'channel','cooperate_date' ,'type', 'remain_day' ,'created_at','delete_status']; |
| 36 | $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build') | 36 | $lists = $project->formatQuery($map)->select($filed)->with('payment')->with('deploy_build') |
| 37 | ->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); |
| 38 | if(!empty($lists)){ | 38 | if(!empty($lists)){ |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AiBlogKeywordController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/11/4 14:35 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Ai; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Http\Logic\Bside\Ai\AiBlogKeywordLogic; | ||
| 15 | +use Illuminate\Http\Request; | ||
| 16 | + | ||
| 17 | +class AiBlogKeywordController extends BaseController | ||
| 18 | +{ | ||
| 19 | + public function __construct(Request $request) | ||
| 20 | + { | ||
| 21 | + parent::__construct($request); | ||
| 22 | + $this->logic = new AiBlogKeywordLogic(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark :获取关键词详情 | ||
| 27 | + * @name :getKeywordInfo | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2025/11/4 14:35 | ||
| 31 | + */ | ||
| 32 | + public function getKeywordInfo() | ||
| 33 | + { | ||
| 34 | + $data = $this->logic->getKeywordInfo(); | ||
| 35 | + $this->response('success',Code::SUCCESS,$data); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @remark :保存对应关键词 | ||
| 40 | + * @name :saveKeyword | ||
| 41 | + * @author :lyh | ||
| 42 | + * @method :post | ||
| 43 | + * @time :2025/11/4 14:35 | ||
| 44 | + */ | ||
| 45 | + public function saveKeyword() | ||
| 46 | + { | ||
| 47 | + $this->request->validate([ | ||
| 48 | + 'keywords'=>['required'], | ||
| 49 | + ],[ | ||
| 50 | + 'keywords.required' => 'keywords不能为空', | ||
| 51 | + ]); | ||
| 52 | + $data = $this->logic->saveKeyword(); | ||
| 53 | + $this->response('success',Code::SUCCESS,$data); | ||
| 54 | + } | ||
| 55 | +} |
| @@ -5,6 +5,8 @@ namespace App\Http\Controllers\Bside\HomeCount; | @@ -5,6 +5,8 @@ namespace App\Http\Controllers\Bside\HomeCount; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | use App\Http\Logic\Bside\HomeCount\CountLogic; | 7 | use App\Http\Logic\Bside\HomeCount\CountLogic; |
| 8 | +use App\Models\Project\Project; | ||
| 9 | + | ||
| 8 | class CountController extends BaseController | 10 | class CountController extends BaseController |
| 9 | { | 11 | { |
| 10 | const STATUS_ERROR = 400; | 12 | const STATUS_ERROR = 400; |
| @@ -38,4 +40,16 @@ class CountController extends BaseController | @@ -38,4 +40,16 @@ class CountController extends BaseController | ||
| 38 | $data['enterprise_service'] = $countLogic->enterprise_service(); | 40 | $data['enterprise_service'] = $countLogic->enterprise_service(); |
| 39 | return $this->response('success',Code::SUCCESS,$data); | 41 | return $this->response('success',Code::SUCCESS,$data); |
| 40 | } | 42 | } |
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @remark : | ||
| 46 | + * @name :info5172count | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2025/11/6 15:10 | ||
| 50 | + */ | ||
| 51 | + public function info5172count() | ||
| 52 | + { | ||
| 53 | + | ||
| 54 | + } | ||
| 41 | } | 55 | } |
| @@ -227,7 +227,8 @@ class RankDataController extends BaseController | @@ -227,7 +227,8 @@ class RankDataController extends BaseController | ||
| 227 | $rand = array_rand($ips, 3); | 227 | $rand = array_rand($ips, 3); |
| 228 | foreach ($rand as $val) { | 228 | foreach ($rand as $val) { |
| 229 | $rand_key = array_rand($ips[$val], 1); | 229 | $rand_key = array_rand($ips[$val], 1); |
| 230 | - $urls[] = 'http://' . $ips[$val][$rand_key] . '/search/?q=' . $param['keyword']; | 230 | + // https://www.quanqiusou.cn/search/?ip=64.34.204.224&q=China%20Bollard |
| 231 | + $urls[] = 'https://www.quanqiusou.cn/search/?ip=' . $ips[$val][$rand_key] . '&q=' . $param['keyword']; | ||
| 231 | } | 232 | } |
| 232 | $data['urls'] = $urls; | 233 | $data['urls'] = $urls; |
| 233 | $this->response('success',Code::SUCCESS,$data); | 234 | $this->response('success',Code::SUCCESS,$data); |
| @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\SeoSetting; | @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\SeoSetting; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Http\Logic\Bside\SeoSetting\LinkDataLogic; | 14 | use App\Http\Logic\Bside\SeoSetting\LinkDataLogic; |
| 15 | +use App\Models\Geo\GeoLink; | ||
| 15 | use App\Models\SeoSetting\LinkData; | 16 | use App\Models\SeoSetting\LinkData; |
| 16 | 17 | ||
| 17 | class LinkDataController extends BaseController | 18 | class LinkDataController extends BaseController |
| @@ -23,7 +24,11 @@ class LinkDataController extends BaseController | @@ -23,7 +24,11 @@ class LinkDataController extends BaseController | ||
| 23 | * @method :post | 24 | * @method :post |
| 24 | * @time :2025/3/14 16:33 | 25 | * @time :2025/3/14 16:33 |
| 25 | */ | 26 | */ |
| 26 | - public function lists(LinkData $linkData){ | 27 | + public function lists(GeoLink $linkData){ |
| 28 | + if(!isset($this->map['type']) || empty($this->map['type'])){ | ||
| 29 | + $this->map['type'] = $linkData::TYPE_LINK; | ||
| 30 | + } | ||
| 31 | + $this->map['project_id'] = $this->user['project_id']; | ||
| 27 | $lists = $linkData->lists($this->map,$this->page,$this->row); | 32 | $lists = $linkData->lists($this->map,$this->page,$this->row); |
| 28 | $this->response('success',Code::SUCCESS,$lists); | 33 | $this->response('success',Code::SUCCESS,$lists); |
| 29 | } | 34 | } |
| @@ -35,7 +40,7 @@ class LinkDataController extends BaseController | @@ -35,7 +40,7 @@ class LinkDataController extends BaseController | ||
| 35 | * @method :post | 40 | * @method :post |
| 36 | * @time :2025/3/14 17:41 | 41 | * @time :2025/3/14 17:41 |
| 37 | */ | 42 | */ |
| 38 | - public function info(LinkData $linkData){ | 43 | + public function info(GeoLink $linkData){ |
| 39 | $this->request->validate([ | 44 | $this->request->validate([ |
| 40 | 'id'=>['required'], | 45 | 'id'=>['required'], |
| 41 | ],[ | 46 | ],[ |
| @@ -69,7 +74,7 @@ class LinkDataController extends BaseController | @@ -69,7 +74,7 @@ class LinkDataController extends BaseController | ||
| 69 | * @method :post | 74 | * @method :post |
| 70 | * @time :2025/3/14 16:45 | 75 | * @time :2025/3/14 16:45 |
| 71 | */ | 76 | */ |
| 72 | - public function del(LinkData $linkData){ | 77 | + public function del(GeoLink $linkData){ |
| 73 | $this->request->validate([ | 78 | $this->request->validate([ |
| 74 | 'id'=>'required|array', | 79 | 'id'=>'required|array', |
| 75 | ],[ | 80 | ],[ |
| @@ -12,6 +12,7 @@ use App\Services\CosService; | @@ -12,6 +12,7 @@ use App\Services\CosService; | ||
| 12 | use Illuminate\Http\Exceptions\HttpResponseException; | 12 | use Illuminate\Http\Exceptions\HttpResponseException; |
| 13 | use Illuminate\Http\JsonResponse; | 13 | use Illuminate\Http\JsonResponse; |
| 14 | use Illuminate\Support\Facades\Cache; | 14 | use Illuminate\Support\Facades\Cache; |
| 15 | +use function RingCentral\Psr7\str; | ||
| 15 | 16 | ||
| 16 | class FileController | 17 | class FileController |
| 17 | { | 18 | { |
| @@ -365,7 +366,10 @@ class FileController | @@ -365,7 +366,10 @@ class FileController | ||
| 365 | public function setUrl(){ | 366 | public function setUrl(){ |
| 366 | //A端上传 | 367 | //A端上传 |
| 367 | if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ | 368 | if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ |
| 368 | - $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); | 369 | + $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); |
| 370 | + if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ | ||
| 371 | + $this->path = $this->path.'/'.$this->cache['project_id']; | ||
| 372 | + } | ||
| 369 | }else{ | 373 | }else{ |
| 370 | //B端上传,upload_method 为 1时 强制上传到本地 | 374 | //B端上传,upload_method 为 1时 强制上传到本地 |
| 371 | if(!isset($this->param['upload_method'])) { | 375 | if(!isset($this->param['upload_method'])) { |
| @@ -286,6 +286,9 @@ class ImageController extends Controller | @@ -286,6 +286,9 @@ class ImageController extends Controller | ||
| 286 | * @time :2023/7/19 16:38 | 286 | * @time :2023/7/19 16:38 |
| 287 | */ | 287 | */ |
| 288 | public function saveMysql(&$imageModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = '', $name=''){ | 288 | public function saveMysql(&$imageModel,$size,$image_type,$fileName,$hash,$is_cos = 0,$mime = '', $name=''){ |
| 289 | + if(strpos($mime, 'image') !== false){ | ||
| 290 | + | ||
| 291 | + } | ||
| 289 | $data = [ | 292 | $data = [ |
| 290 | 'path' => $this->path.'/'.$fileName, | 293 | 'path' => $this->path.'/'.$fileName, |
| 291 | 'created_at' => date('Y-m-d H:i:s',time()), | 294 | 'created_at' => date('Y-m-d H:i:s',time()), |
| @@ -510,6 +513,9 @@ class ImageController extends Controller | @@ -510,6 +513,9 @@ class ImageController extends Controller | ||
| 510 | //A端上传 | 513 | //A端上传 |
| 511 | if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ | 514 | if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ |
| 512 | $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m'); | 515 | $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m'); |
| 516 | + if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ | ||
| 517 | + $this->path = $this->path.'/'.$this->cache['project_id']; | ||
| 518 | + } | ||
| 513 | }else{ | 519 | }else{ |
| 514 | //TODO::设置上传文件大小(B端上传) | 520 | //TODO::设置上传文件大小(B端上传) |
| 515 | $max = config('upload.default_b_image')['size']['max']; | 521 | $max = config('upload.default_b_image')['size']['max']; |
| @@ -778,7 +784,6 @@ class ImageController extends Controller | @@ -778,7 +784,6 @@ class ImageController extends Controller | ||
| 778 | } | 784 | } |
| 779 | $info['domain'] = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com'; | 785 | $info['domain'] = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com'; |
| 780 | } | 786 | } |
| 781 | - | ||
| 782 | $this->response('success',Code::SUCCESS,$info); | 787 | $this->response('success',Code::SUCCESS,$info); |
| 783 | } | 788 | } |
| 784 | } | 789 | } |
| @@ -5,6 +5,7 @@ namespace App\Http\Logic\Aside; | @@ -5,6 +5,7 @@ namespace App\Http\Logic\Aside; | ||
| 5 | 5 | ||
| 6 | use App\Enums\Common\Common; | 6 | use App\Enums\Common\Common; |
| 7 | use App\Http\Logic\Logic; | 7 | use App\Http\Logic\Logic; |
| 8 | +use App\Models\Project\Project; | ||
| 8 | use Illuminate\Support\Facades\Cache; | 9 | use Illuminate\Support\Facades\Cache; |
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| @@ -37,6 +38,45 @@ class BaseLogic extends Logic | @@ -37,6 +38,45 @@ class BaseLogic extends Logic | ||
| 37 | */ | 38 | */ |
| 38 | public function getParam(){ | 39 | public function getParam(){ |
| 39 | $requestAll = $this->request->all(); | 40 | $requestAll = $this->request->all(); |
| 41 | + $requestAll = $this->handleIdAndProjectId($requestAll); | ||
| 40 | return $this->success($requestAll); | 42 | return $this->success($requestAll); |
| 41 | } | 43 | } |
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :处理project参数 | ||
| 47 | + * @name :handleIdAndProjectId | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2025/11/6 10:41 | ||
| 51 | + */ | ||
| 52 | + public function handleIdAndProjectId($param) | ||
| 53 | + { | ||
| 54 | + if(isset($param['id']) && !empty($param['id']) && !is_array($param['id'])){ | ||
| 55 | + if (preg_match('/^[A-Za-z]/', $param['id'])) { | ||
| 56 | + $id = Cache::get('project_'.$param['id']); | ||
| 57 | + if(empty($id)){ | ||
| 58 | + $projectModel = new Project(); | ||
| 59 | + $id = $projectModel->getValue(['post_id' => $param['id']],'id'); | ||
| 60 | + if(!empty($id)){ | ||
| 61 | + Cache::add('project_'.$param['id'], $id, 3600 * 12); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + $param['id'] = $id; | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + if(isset($param['project_id']) && !empty($param['project_id']) && !is_array($param['project_id'])){ | ||
| 68 | + if (preg_match('/^[A-Za-z]/', $param['project_id'])) { | ||
| 69 | + $id = Cache::get('project_'.$param['project_id']); | ||
| 70 | + if(empty($id)){ | ||
| 71 | + $projectModel = new Project(); | ||
| 72 | + $id = $projectModel->getValue(['post_id' => $param['project_id']],'id'); | ||
| 73 | + if(!empty($id)){ | ||
| 74 | + Cache::add('project_'.$param['project_id'], $id, 3600 * 12); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + $param['project_id'] = $id; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + return $param; | ||
| 81 | + } | ||
| 42 | } | 82 | } |
| @@ -84,7 +84,13 @@ class GeoConfirmLogic extends BaseLogic | @@ -84,7 +84,13 @@ class GeoConfirmLogic extends BaseLogic | ||
| 84 | public function saveConfirmInfo() | 84 | public function saveConfirmInfo() |
| 85 | { | 85 | { |
| 86 | $this->param['status'] = GeoConfirm::STATUS_FINISH; | 86 | $this->param['status'] = GeoConfirm::STATUS_FINISH; |
| 87 | - $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 88 | - return $this->success(['id'=>$this->param['id']]); | 87 | + $info = $this->model->read(['project_id' => $this->param['project_id'],'type'=>$this->param['type']]); |
| 88 | + if($info === false){ | ||
| 89 | + $id = $this->model->addReturnId($this->param); | ||
| 90 | + }else{ | ||
| 91 | + $id = $info['id']; | ||
| 92 | + $this->model->edit($this->param,['id'=>$info['id']]); | ||
| 93 | + } | ||
| 94 | + return $this->success(['id'=>$id]); | ||
| 89 | } | 95 | } |
| 90 | } | 96 | } |
| @@ -39,11 +39,13 @@ class GeoLinkLogic extends BaseLogic | @@ -39,11 +39,13 @@ class GeoLinkLogic extends BaseLogic | ||
| 39 | * @time :2025/7/14 16:47 | 39 | * @time :2025/7/14 16:47 |
| 40 | */ | 40 | */ |
| 41 | public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){ | 41 | public function getLinkList($map = [],$page = 1,$row = 20,$order = 'id'){ |
| 42 | - $filed = ['*']; | ||
| 43 | if(isset($map['url']) && !empty($map['url'])){ | 42 | if(isset($map['url']) && !empty($map['url'])){ |
| 44 | $map['url'] = ['like','%'.$map['url'].'%']; | 43 | $map['url'] = ['like','%'.$map['url'].'%']; |
| 45 | } | 44 | } |
| 46 | - $lists = $this->model->lists($map,$page,$row,$order,$filed); | 45 | + if(!isset($map['type']) || empty($map['type'])){ |
| 46 | + $map['type'] = GeoLink::TYPE_NEWS; | ||
| 47 | + } | ||
| 48 | + $lists = $this->model->lists($map,$page,$row,$order,['*']); | ||
| 47 | return $this->success($lists); | 49 | return $this->success($lists); |
| 48 | } | 50 | } |
| 49 | 51 |
| @@ -11,6 +11,7 @@ namespace App\Http\Logic\Aside\Geo; | @@ -11,6 +11,7 @@ namespace App\Http\Logic\Aside\Geo; | ||
| 11 | 11 | ||
| 12 | use App\Console\Commands\Geo\GeoQuestionRes; | 12 | use App\Console\Commands\Geo\GeoQuestionRes; |
| 13 | use App\Http\Logic\Aside\BaseLogic; | 13 | use App\Http\Logic\Aside\BaseLogic; |
| 14 | +use App\Models\Geo\GeoArticle; | ||
| 14 | use App\Models\Geo\GeoConf; | 15 | use App\Models\Geo\GeoConf; |
| 15 | use App\Models\Geo\GeoLink; | 16 | use App\Models\Geo\GeoLink; |
| 16 | use App\Models\Geo\GeoQuestion; | 17 | use App\Models\Geo\GeoQuestion; |
| @@ -120,9 +121,11 @@ class GeoLogic extends BaseLogic | @@ -120,9 +121,11 @@ class GeoLogic extends BaseLogic | ||
| 120 | if(empty($geo_question_count)){ | 121 | if(empty($geo_question_count)){ |
| 121 | $geo_question_count = 0; | 122 | $geo_question_count = 0; |
| 122 | } | 123 | } |
| 123 | - $geo_pr_count = GeoLink::where('project_id',$this->param['project_id'])->count(); | 124 | + $geo_pr_count = GeoLink::where('project_id',$this->param['project_id'])->where('type',GeoLink::TYPE_NEWS)->count(); |
| 125 | + $geo_link_count = GeoLink::where('project_id',$this->param['project_id'])->where('type',GeoLink::TYPE_LINK)->count(); | ||
| 124 | $geo_writings_count = GeoWritings::where('project_id',$this->param['project_id'])->count(); | 126 | $geo_writings_count = GeoWritings::where('project_id',$this->param['project_id'])->count(); |
| 125 | - return $this->success(['geo_writings_count'=>$geo_writings_count,'geo_pr_count'=>$geo_pr_count,'geo_question_count'=>$geo_question_count]); | 127 | + $geo_writings_count += GeoArticle::where('project_id',$this->param['project_id'])->count(); |
| 128 | + return $this->success(['geo_writings_count'=>$geo_writings_count,'geo_pr_count'=>$geo_pr_count,'geo_question_count'=>$geo_question_count,'geo_link_count'=>$geo_link_count]); | ||
| 126 | } | 129 | } |
| 127 | 130 | ||
| 128 | } | 131 | } |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Http\Logic\Aside\Project; | 10 | namespace App\Http\Logic\Aside\Project; |
| 11 | 11 | ||
| 12 | use App\Http\Logic\Aside\BaseLogic; | 12 | use App\Http\Logic\Aside\BaseLogic; |
| 13 | +use App\Models\Geo\GeoLink; | ||
| 13 | use App\Models\Project\EnterpriseProduct; | 14 | use App\Models\Project\EnterpriseProduct; |
| 14 | use App\Models\SeoSetting\LinkData; | 15 | use App\Models\SeoSetting\LinkData; |
| 15 | use App\Services\ProjectServer; | 16 | use App\Services\ProjectServer; |
| @@ -56,8 +57,7 @@ class EnterpriseProductLogic extends BaseLogic | @@ -56,8 +57,7 @@ class EnterpriseProductLogic extends BaseLogic | ||
| 56 | * @time :2025/4/2 9:08 | 57 | * @time :2025/4/2 9:08 |
| 57 | */ | 58 | */ |
| 58 | public function saveLinkData(){ | 59 | public function saveLinkData(){ |
| 59 | - ProjectServer::useProject($this->param['project_id']); | ||
| 60 | - $linkModel = new LinkData(); | 60 | + $linkModel = new GeoLink(); |
| 61 | $data = []; | 61 | $data = []; |
| 62 | $count = count($this->param['data']); | 62 | $count = count($this->param['data']); |
| 63 | $error_num = 0; | 63 | $error_num = 0; |
| @@ -68,14 +68,15 @@ class EnterpriseProductLogic extends BaseLogic | @@ -68,14 +68,15 @@ class EnterpriseProductLogic extends BaseLogic | ||
| 68 | } | 68 | } |
| 69 | $data[] = [ | 69 | $data[] = [ |
| 70 | 'url'=>$v['url'], | 70 | 'url'=>$v['url'], |
| 71 | + 'type'=>$linkModel::TYPE_LINK, | ||
| 71 | 'da_values'=>$v['da_values'], | 72 | 'da_values'=>$v['da_values'], |
| 73 | + 'project_id'=>$this->param['project_id'], | ||
| 72 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') | 74 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') |
| 73 | ]; | 75 | ]; |
| 74 | } | 76 | } |
| 75 | if(!empty($data)){ | 77 | if(!empty($data)){ |
| 76 | $linkModel->insertAll($data); | 78 | $linkModel->insertAll($data); |
| 77 | } | 79 | } |
| 78 | - DB::disconnect('custom_mysql'); | ||
| 79 | return $this->success(['success'=>$count,'error'=>$error_num]); | 80 | return $this->success(['success'=>$count,'error'=>$error_num]); |
| 80 | } | 81 | } |
| 81 | } | 82 | } |
| @@ -86,9 +86,14 @@ class ProjectLogic extends BaseLogic | @@ -86,9 +86,14 @@ class ProjectLogic extends BaseLogic | ||
| 86 | * @method :post | 86 | * @method :post |
| 87 | * @time :2023/7/28 17:11 | 87 | * @time :2023/7/28 17:11 |
| 88 | */ | 88 | */ |
| 89 | - public function getProjectInfo($id){ | ||
| 90 | - $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', | ||
| 91 | - 'project_after','inquiry_filter_config','web_traffic_config','project_keyword'])->where(['id'=>$id])->first()->toArray(); | 89 | + public function getProjectInfo($id = ''){ |
| 90 | + if(!empty($id)){ | ||
| 91 | + $query = $this->model->formatQuery(['id'=>$id]); | ||
| 92 | + }else{ | ||
| 93 | + $query = $this->model->formatQuery($this->param); | ||
| 94 | + } | ||
| 95 | + $info = $query->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', | ||
| 96 | + 'project_after','inquiry_filter_config','web_traffic_config','project_keyword'])->first()->toArray(); | ||
| 92 | $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); | 97 | $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); |
| 93 | $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; | 98 | $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; |
| 94 | if($info['extend_type'] != 0){ | 99 | if($info['extend_type'] != 0){ |
| @@ -116,13 +121,13 @@ class ProjectLogic extends BaseLogic | @@ -116,13 +121,13 @@ class ProjectLogic extends BaseLogic | ||
| 116 | } | 121 | } |
| 117 | //is_product:"0",is_news:"0",is_blogs:"0",is_module:"0" | 122 | //is_product:"0",is_news:"0",is_blogs:"0",is_module:"0" |
| 118 | //获取小语种 | 123 | //获取小语种 |
| 119 | - $info['minor_languages'] = $this->getProjectMinorLanguages($id); | 124 | + $info['minor_languages'] = $this->getProjectMinorLanguages($info['id']); |
| 120 | //升级项目采集完成时间 | 125 | //升级项目采集完成时间 |
| 121 | - $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; | 126 | + $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($info['id']) : ''; |
| 122 | //升级项目采集的测试站域名 | 127 | //升级项目采集的测试站域名 |
| 123 | - $info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($id) : ''; | 128 | + $info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($info['id']) : ''; |
| 124 | //获取项目所属行业 | 129 | //获取项目所属行业 |
| 125 | - $info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray(); | 130 | + $info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $info['id'])->pluck('industry_id')->toArray(); |
| 126 | return $this->success($info); | 131 | return $this->success($info); |
| 127 | } | 132 | } |
| 128 | 133 |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AiBlogKeywordLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/11/4 14:37 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\Ai; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 13 | +use App\Models\Ai\AiBlogKeyword; | ||
| 14 | +use App\Models\Project\ProjectKeyword; | ||
| 15 | +use App\Models\WebSetting\WebSetting; | ||
| 16 | +use App\Services\ProjectServer; | ||
| 17 | +use Illuminate\Support\Facades\DB; | ||
| 18 | + | ||
| 19 | +class AiBlogKeywordLogic extends BaseLogic | ||
| 20 | +{ | ||
| 21 | + | ||
| 22 | + public function __construct() | ||
| 23 | + { | ||
| 24 | + parent::__construct(); | ||
| 25 | + $this->param = $this->requestAll; | ||
| 26 | + $this->model = new AiBlogKeyword(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @remark :获取当前详情 | ||
| 31 | + * @name :getKeywordInfo | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2025/11/4 14:39 | ||
| 35 | + */ | ||
| 36 | + public function getKeywordInfo() | ||
| 37 | + { | ||
| 38 | + $data = $this->model->read(['project_id'=>$this->user['project_id']]); | ||
| 39 | + if($data === false){ | ||
| 40 | + //核心关键词+网站关键词+白帽关键词 | ||
| 41 | + $main_keywords = ProjectKeyword::where('project_id', $this->user['project_id'])->value('main_keyword'); | ||
| 42 | + $main_keywords = explode("\r\n", $main_keywords); | ||
| 43 | + $seo_keywords = ProjectKeyword::where('project_id', $this->user['project_id'])->value('seo_keywords'); | ||
| 44 | + $seo_keywords = explode("\r\n", $seo_keywords); | ||
| 45 | + $site_keywords = WebSetting::where('project_id', $this->user['project_id'])->value('keyword'); | ||
| 46 | + $site_keywords = explode(",", $site_keywords); | ||
| 47 | + $keywords = array_filter(array_merge($main_keywords, $site_keywords, $seo_keywords)); | ||
| 48 | + $keywords = array_map('trim', $keywords); | ||
| 49 | + $keywords_string = implode("\n", $keywords); | ||
| 50 | + $data = [ | ||
| 51 | + 'project_id'=>$this->user['project_id'], | ||
| 52 | + 'keywords'=>$keywords_string | ||
| 53 | + ]; | ||
| 54 | + } | ||
| 55 | + return $this->success($data); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * @remark : | ||
| 60 | + * @name :saveKeyword | ||
| 61 | + * @author :lyh | ||
| 62 | + * @method :post | ||
| 63 | + * @time :2025/11/4 14:52 | ||
| 64 | + */ | ||
| 65 | + public function saveKeyword() | ||
| 66 | + { | ||
| 67 | + $data = $this->model->read(['project_id'=>$this->user['project_id']]); | ||
| 68 | + if($data !== false){ | ||
| 69 | + $id = $data['id']; | ||
| 70 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 71 | + }else{ | ||
| 72 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 73 | + $id = $this->model->addReturnId($this->param); | ||
| 74 | + } | ||
| 75 | + return $this->success(['id'=>$id]); | ||
| 76 | + } | ||
| 77 | +} |
| @@ -24,6 +24,9 @@ class GeoQuestionResLogic extends BaseLogic | @@ -24,6 +24,9 @@ class GeoQuestionResLogic extends BaseLogic | ||
| 24 | parent::__construct(); | 24 | parent::__construct(); |
| 25 | $this->model = new GeoQuestionResult(); | 25 | $this->model = new GeoQuestionResult(); |
| 26 | $this->param = $this->requestAll; | 26 | $this->param = $this->requestAll; |
| 27 | + if($this->user['project_id'] == 5172){ | ||
| 28 | + $this->user['project_id'] = 3298; | ||
| 29 | + } | ||
| 27 | } | 30 | } |
| 28 | 31 | ||
| 29 | /** | 32 | /** |
| @@ -16,6 +16,7 @@ use App\Models\Product\Product; | @@ -16,6 +16,7 @@ use App\Models\Product\Product; | ||
| 16 | use App\Models\Project\Project; | 16 | use App\Models\Project\Project; |
| 17 | use App\Models\RankData\RankData as RankDataModel; | 17 | use App\Models\RankData\RankData as RankDataModel; |
| 18 | use App\Models\Service\Service; | 18 | use App\Models\Service\Service; |
| 19 | +use App\Services\ProjectServer; | ||
| 19 | use Carbon\Carbon; | 20 | use Carbon\Carbon; |
| 20 | use Illuminate\Support\Facades\Cache; | 21 | use Illuminate\Support\Facades\Cache; |
| 21 | use Illuminate\Support\Facades\DB; | 22 | use Illuminate\Support\Facades\DB; |
| @@ -26,16 +27,20 @@ class CountLogic extends BaseLogic | @@ -26,16 +27,20 @@ class CountLogic extends BaseLogic | ||
| 26 | { | 27 | { |
| 27 | parent::__construct(); | 28 | parent::__construct(); |
| 28 | $this->model = new Count(); | 29 | $this->model = new Count(); |
| 30 | + if($this->user['project_id'] == 5172){ | ||
| 31 | + $this->user['project_id'] = 3298; | ||
| 32 | + } | ||
| 29 | } | 33 | } |
| 30 | 34 | ||
| 31 | /** | 35 | /** |
| 32 | - * @name :(昨日统计数据)yesterday_count | 36 | + * @name :昨日统计数据 yesterday_count |
| 33 | * @author :lyh | 37 | * @author :lyh |
| 34 | * @method :post | 38 | * @method :post |
| 35 | * @time :2023/5/23 17:30 | 39 | * @time :2023/5/23 17:30 |
| 36 | */ | 40 | */ |
| 37 | public function yesterday_count(){ | 41 | public function yesterday_count(){ |
| 38 | $yesterday = Carbon::yesterday()->toDateString(); | 42 | $yesterday = Carbon::yesterday()->toDateString(); |
| 43 | + | ||
| 39 | $param = [ | 44 | $param = [ |
| 40 | 'date' => $yesterday, | 45 | 'date' => $yesterday, |
| 41 | 'project_id' => $this->user['project_id'] | 46 | 'project_id' => $this->user['project_id'] |
| @@ -86,6 +91,7 @@ class CountLogic extends BaseLogic | @@ -86,6 +91,7 @@ class CountLogic extends BaseLogic | ||
| 86 | * @time :2023/5/24 13:33 | 91 | * @time :2023/5/24 13:33 |
| 87 | */ | 92 | */ |
| 88 | public function total_count($inquiry_num = ''){ | 93 | public function total_count($inquiry_num = ''){ |
| 94 | + ProjectServer::useProject($this->user['project_id']); | ||
| 89 | $pv = (new VisitItem())->count(); | 95 | $pv = (new VisitItem())->count(); |
| 90 | $ip = (new Visit())->count(); | 96 | $ip = (new Visit())->count(); |
| 91 | $data = [ | 97 | $data = [ |
| @@ -199,6 +205,7 @@ class CountLogic extends BaseLogic | @@ -199,6 +205,7 @@ class CountLogic extends BaseLogic | ||
| 199 | * @time :2023/5/24 15:56 | 205 | * @time :2023/5/24 15:56 |
| 200 | */ | 206 | */ |
| 201 | public function access_country_count(){ | 207 | public function access_country_count(){ |
| 208 | + | ||
| 202 | $customerVisitModel = new Visit(); | 209 | $customerVisitModel = new Visit(); |
| 203 | $data = $customerVisitModel->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) | 210 | $data = $customerVisitModel->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) |
| 204 | ->groupBy('country') | 211 | ->groupBy('country') |
| @@ -40,6 +40,15 @@ use Illuminate\Support\Str; | @@ -40,6 +40,15 @@ use Illuminate\Support\Str; | ||
| 40 | class RankDataLogic extends BaseLogic | 40 | class RankDataLogic extends BaseLogic |
| 41 | { | 41 | { |
| 42 | 42 | ||
| 43 | + public function __construct() | ||
| 44 | + { | ||
| 45 | + parent::__construct(); | ||
| 46 | + $this->param = $this->requestAll; | ||
| 47 | + if($this->user['project_id'] == 5172){ | ||
| 48 | + $this->user['project_id'] = 3298; | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 43 | /** | 52 | /** |
| 44 | * 统计数据 | 53 | * 统计数据 |
| 45 | * @author zbj | 54 | * @author zbj |
| @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting; | @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\SeoSetting; | ||
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\Geo\DomainDa; | 13 | use App\Models\Geo\DomainDa; |
| 14 | +use App\Models\Geo\GeoLink; | ||
| 14 | use App\Models\SeoSetting\LinkData; | 15 | use App\Models\SeoSetting\LinkData; |
| 15 | use App\Services\Geo\GeoService; | 16 | use App\Services\Geo\GeoService; |
| 16 | use Illuminate\Support\Carbon; | 17 | use Illuminate\Support\Carbon; |
| @@ -29,7 +30,7 @@ class LinkDataLogic extends BaseLogic | @@ -29,7 +30,7 @@ class LinkDataLogic extends BaseLogic | ||
| 29 | { | 30 | { |
| 30 | parent::__construct(); | 31 | parent::__construct(); |
| 31 | $this->param = $this->requestAll; | 32 | $this->param = $this->requestAll; |
| 32 | - $this->model = new LinkData(); | 33 | + $this->model = new GeoLink(); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | /** | 36 | /** |
| @@ -46,6 +47,8 @@ class LinkDataLogic extends BaseLogic | @@ -46,6 +47,8 @@ class LinkDataLogic extends BaseLogic | ||
| 46 | $data[] = [ | 47 | $data[] = [ |
| 47 | 'url'=>$v['url'], | 48 | 'url'=>$v['url'], |
| 48 | 'da_values'=>$v['da_values'], | 49 | 'da_values'=>$v['da_values'], |
| 50 | + 'type'=>GeoLink::TYPE_LINK, | ||
| 51 | + 'project_id'=>$this->user['project_id'], | ||
| 49 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') | 52 | 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') |
| 50 | ]; | 53 | ]; |
| 51 | } | 54 | } |
app/Models/Ai/AiBlogKeyword.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AiBlogKeyword.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/11/4 14:26 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Ai; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class AiBlogKeyword extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_ai_blog_keyword'; | ||
| 17 | +} |
| @@ -36,7 +36,9 @@ class GeoConf extends Base | @@ -36,7 +36,9 @@ class GeoConf extends Base | ||
| 36 | if (empty($optimize)) { | 36 | if (empty($optimize)) { |
| 37 | $optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray(); | 37 | $optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray(); |
| 38 | $optimize[11] = '陶婵'; | 38 | $optimize[11] = '陶婵'; |
| 39 | + $optimize[207] = '吴雨静'; | ||
| 39 | $optimize[875] = '艾媛媛'; | 40 | $optimize[875] = '艾媛媛'; |
| 41 | + $optimize[893] = '杨汀'; | ||
| 40 | ksort($optimize); | 42 | ksort($optimize); |
| 41 | Cache::put($key, $optimize, 3600); | 43 | Cache::put($key, $optimize, 3600); |
| 42 | } | 44 | } |
| @@ -20,5 +20,8 @@ use App\Models\Base; | @@ -20,5 +20,8 @@ use App\Models\Base; | ||
| 20 | */ | 20 | */ |
| 21 | class GeoLink extends Base | 21 | class GeoLink extends Base |
| 22 | { | 22 | { |
| 23 | + const TYPE_NEWS = 1;//权威新闻 | ||
| 24 | + const TYPE_LINK = 2;//外链数据 | ||
| 25 | + | ||
| 23 | protected $table = 'gl_geo_link'; | 26 | protected $table = 'gl_geo_link'; |
| 24 | } | 27 | } |
| @@ -541,6 +541,11 @@ class SyncSubmitTaskService | @@ -541,6 +541,11 @@ class SyncSubmitTaskService | ||
| 541 | { | 541 | { |
| 542 | throw new InquiryFilterException( '被刷数据'); | 542 | throw new InquiryFilterException( '被刷数据'); |
| 543 | } | 543 | } |
| 544 | + //3006 温州耐保锁 荷兰的定制表单蔽掉 --徐莹 | ||
| 545 | + if($project_id == 3006 && in_array($data['country']??'', ['荷兰'])) | ||
| 546 | + { | ||
| 547 | + throw new InquiryFilterException( '被刷数据'); | ||
| 548 | + } | ||
| 544 | 549 | ||
| 545 | //数据都是空的 | 550 | //数据都是空的 |
| 546 | $is_all_empty = true; | 551 | $is_all_empty = true; |
| @@ -777,6 +777,11 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -777,6 +777,11 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 777 | Route::any('/deleteFaq', [\App\Http\Controllers\Bside\Setting\SettingFaqController::class,'deleteFaq'])->name('faq_deleteFaq'); | 777 | Route::any('/deleteFaq', [\App\Http\Controllers\Bside\Setting\SettingFaqController::class,'deleteFaq'])->name('faq_deleteFaq'); |
| 778 | Route::any('/getInfo', [\App\Http\Controllers\Bside\Setting\SettingFaqController::class,'getInfo'])->name('faq_getInfo'); | 778 | Route::any('/getInfo', [\App\Http\Controllers\Bside\Setting\SettingFaqController::class,'getInfo'])->name('faq_getInfo'); |
| 779 | }); | 779 | }); |
| 780 | + //ai_blog随机关键词 | ||
| 781 | + Route::prefix('ai_blog_keyword')->group(function () { | ||
| 782 | + Route::any('/getKeywordInfo', [\App\Http\Controllers\Bside\Ai\AiBlogKeywordController::class,'getKeywordInfo'])->name('ai_blog_keyword_getKeywordInfo'); | ||
| 783 | + Route::any('/saveKeyword', [\App\Http\Controllers\Bside\Ai\AiBlogKeywordController::class,'saveKeyword'])->name('ai_blog_keyword_saveKeyword'); | ||
| 784 | + }); | ||
| 780 | }); | 785 | }); |
| 781 | //无需登录验证的路由组 | 786 | //无需登录验证的路由组 |
| 782 | Route::group([], function () { | 787 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论