Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
10 个修改的文件
包含
168 行增加
和
179 行删除
| @@ -63,13 +63,18 @@ class TemplateLog extends Command | @@ -63,13 +63,18 @@ class TemplateLog extends Command | ||
| 63 | * @time :2024/7/10 14:48 | 63 | * @time :2024/7/10 14:48 |
| 64 | */ | 64 | */ |
| 65 | public function deleteTemplate(){ | 65 | public function deleteTemplate(){ |
| 66 | - | ||
| 67 | - $date = date('Y-m-d H:i:s', strtotime('-60 days')); | 66 | + $date = date('Y-m-d H:i:s', strtotime('-30 days')); |
| 68 | $templateLogModel = new BTemplateLog(); | 67 | $templateLogModel = new BTemplateLog(); |
| 69 | $templateLogModel->del(['created_at'=>['<=',$date],'source'=>['!=',1]]); | 68 | $templateLogModel->del(['created_at'=>['<=',$date],'source'=>['!=',1]]); |
| 70 | - //首页保存最新的20条记录 | ||
| 71 | - $latestIds = $templateLogModel->where(['source'=>1,'is_custom'=>0])->orderBy('created_at', 'desc')->take(20)->pluck('id'); // 仅提取ID字段 | ||
| 72 | - return $templateLogModel->del(['id'=>['not in',$latestIds],'source'=>1,'is_custom'=>0,'is_list'=>0]); | 69 | + //查询最近20天是否有装修记录,首页保存最新的20条记录 |
| 70 | + $counts = $templateLogModel->counts(['source'=>1,'source_id'=>0,'is_custom'=>0,'created_at'=>['>=',$date]]); | ||
| 71 | + if($counts == 0){ | ||
| 72 | + $latestIds = $templateLogModel->where(['source'=>1,'is_custom'=>0])->orderBy('created_at', 'desc')->take(20)->pluck('id'); // 仅提取ID字段 | ||
| 73 | + $templateLogModel->del(['id'=>['not in',$latestIds],'source'=>1,'is_custom'=>0,'is_list'=>0]); | ||
| 74 | + }else{ | ||
| 75 | + $templateLogModel->del(['created_at'=>['<=',$date],'source'=>1]); | ||
| 76 | + } | ||
| 77 | + return true; | ||
| 73 | } | 78 | } |
| 74 | 79 | ||
| 75 | /** | 80 | /** |
| @@ -102,10 +102,10 @@ class DomainInfo extends Command | @@ -102,10 +102,10 @@ class DomainInfo extends Command | ||
| 102 | $domain_array = parse_url($v['domain']); | 102 | $domain_array = parse_url($v['domain']); |
| 103 | $host = $domain_array['host'] ?? $domain_array['path']; | 103 | $host = $domain_array['host'] ?? $domain_array['path']; |
| 104 | $host_array = explode('.', $host); | 104 | $host_array = explode('.', $host); |
| 105 | - if (count($host_array) <= 2) { | ||
| 106 | - array_unshift($host_array, 'm'); | ||
| 107 | - } else { | 105 | + if($host_array[0] == 'www'){ |
| 108 | $host_array[0] = 'm'; | 106 | $host_array[0] = 'm'; |
| 107 | + }else{ | ||
| 108 | + array_unshift($host_array,'m'); | ||
| 109 | } | 109 | } |
| 110 | $amp_domain = implode('.', $host_array); | 110 | $amp_domain = implode('.', $host_array); |
| 111 | 111 | ||
| @@ -192,10 +192,10 @@ class DomainInfo extends Command | @@ -192,10 +192,10 @@ class DomainInfo extends Command | ||
| 192 | $domain_array = parse_url($v['domain']); | 192 | $domain_array = parse_url($v['domain']); |
| 193 | $host = $domain_array['host'] ?? $domain_array['path']; | 193 | $host = $domain_array['host'] ?? $domain_array['path']; |
| 194 | $host_array = explode('.', $host); | 194 | $host_array = explode('.', $host); |
| 195 | - if (count($host_array) <= 2) { | ||
| 196 | - array_unshift($host_array, 'm'); | ||
| 197 | - } else { | 195 | + if($host_array[0] == 'www'){ |
| 198 | $host_array[0] = 'm'; | 196 | $host_array[0] = 'm'; |
| 197 | + }else{ | ||
| 198 | + array_unshift($host_array,'m'); | ||
| 199 | } | 199 | } |
| 200 | $amp_domain = implode('.', $host_array); | 200 | $amp_domain = implode('.', $host_array); |
| 201 | 201 |
| @@ -6,6 +6,7 @@ use App\Helper\Arr; | @@ -6,6 +6,7 @@ use App\Helper\Arr; | ||
| 6 | use App\Helper\Common; | 6 | use App\Helper\Common; |
| 7 | use App\Helper\Gpt; | 7 | use App\Helper\Gpt; |
| 8 | use App\Models\Ai\AiCommand; | 8 | use App\Models\Ai\AiCommand; |
| 9 | +use App\Models\Ai\AiTdkErrorLog; | ||
| 9 | use App\Models\Com\UpdateNotify; | 10 | use App\Models\Com\UpdateNotify; |
| 10 | use App\Models\Domain\DomainInfo; | 11 | use App\Models\Domain\DomainInfo; |
| 11 | use App\Models\Mail\Mail; | 12 | use App\Models\Mail\Mail; |
| @@ -271,6 +272,14 @@ class UpdateSeoTdk extends Command | @@ -271,6 +272,14 @@ class UpdateSeoTdk extends Command | ||
| 271 | } | 272 | } |
| 272 | Redis::expire($cache_key, 120); | 273 | Redis::expire($cache_key, 120); |
| 273 | 274 | ||
| 275 | + | ||
| 276 | + //连续3次失败的 不再处理 | ||
| 277 | + $error_log = AiTdkErrorLog::getLog($project_id, $table, $v['id']); | ||
| 278 | + if($error_log){ | ||
| 279 | + continue; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + | ||
| 274 | echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . ':id' . $v['id'] . PHP_EOL; | 283 | echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . ':id' . $v['id'] . PHP_EOL; |
| 275 | $v = DB::connection('custom_mysql')->table($table)->where('id', $v['id'])->first(); | 284 | $v = DB::connection('custom_mysql')->table($table)->where('id', $v['id'])->first(); |
| 276 | $v = (array)$v; | 285 | $v = (array)$v; |
| @@ -304,7 +313,7 @@ class UpdateSeoTdk extends Command | @@ -304,7 +313,7 @@ class UpdateSeoTdk extends Command | ||
| 304 | }elseif ($field_arr[1] == 'description'){ | 313 | }elseif ($field_arr[1] == 'description'){ |
| 305 | $update[$table]['des']++; | 314 | $update[$table]['des']++; |
| 306 | } | 315 | } |
| 307 | - $data[$field_arr[0]][$field_arr[1]] = $this->ai_send($prompt); | 316 | + $data[$field_arr[0]][$field_arr[1]] = $this->ai_send($prompt, $project_id, $table, $v['id']); |
| 308 | }else{ | 317 | }else{ |
| 309 | if($field == 'title' || $field == 'seo_title'){ | 318 | if($field == 'title' || $field == 'seo_title'){ |
| 310 | $update[$table]['title']++; | 319 | $update[$table]['title']++; |
| @@ -321,7 +330,7 @@ class UpdateSeoTdk extends Command | @@ -321,7 +330,7 @@ class UpdateSeoTdk extends Command | ||
| 321 | if($field == 'keyword_content'){ | 330 | if($field == 'keyword_content'){ |
| 322 | $update[$table]['keyword_content']++; | 331 | $update[$table]['keyword_content']++; |
| 323 | } | 332 | } |
| 324 | - $data[$field] = $this->ai_send($prompt); | 333 | + $data[$field] = $this->ai_send($prompt, $project_id, $table, $v['id']); |
| 325 | } | 334 | } |
| 326 | } else { | 335 | } else { |
| 327 | //直接使用topic | 336 | //直接使用topic |
| @@ -499,15 +508,29 @@ class UpdateSeoTdk extends Command | @@ -499,15 +508,29 @@ class UpdateSeoTdk extends Command | ||
| 499 | * @method :post | 508 | * @method :post |
| 500 | * @time :2023/8/19 10:40 | 509 | * @time :2023/8/19 10:40 |
| 501 | */ | 510 | */ |
| 502 | - public function ai_send($prompt) | 511 | + public function ai_send($prompt, $project_id, $table, $id) |
| 503 | { | 512 | { |
| 504 | $text = Gpt::instance()->openai_chat_qqs($prompt); | 513 | $text = Gpt::instance()->openai_chat_qqs($prompt); |
| 514 | + | ||
| 515 | + if (!$text) { | ||
| 516 | + $cache_key = "ai_error_times_{$project_id}_{$table}_{$id}"; | ||
| 517 | + if (!Cache::get($cache_key)) { | ||
| 518 | + Cache::put($cache_key, 0, 7 * 24 * 3600); | ||
| 519 | + } | ||
| 520 | + $times = Cache::increment($cache_key); | ||
| 521 | + //3次错误 记录下来 后面不处理了 | ||
| 522 | + if ($times > 2) { | ||
| 523 | + AiTdkErrorLog::insertLog($project_id, $table, $id, $prompt); | ||
| 524 | + Cache::forget($cache_key); | ||
| 525 | + } | ||
| 526 | + } | ||
| 527 | + | ||
| 505 | $text = Common::deal_keywords($text); | 528 | $text = Common::deal_keywords($text); |
| 506 | $text = Common::deal_str($text); | 529 | $text = Common::deal_str($text); |
| 507 | 530 | ||
| 508 | //包含这写字 重新生成 | 531 | //包含这写字 重新生成 |
| 509 | if(Str::contains(Str::lower($text), ['[your brand]', '[brand name]'])){ | 532 | if(Str::contains(Str::lower($text), ['[your brand]', '[brand name]'])){ |
| 510 | - return $this->ai_send($prompt); | 533 | + return $this->ai_send($prompt, $project_id, $table, $id); |
| 511 | } | 534 | } |
| 512 | 535 | ||
| 513 | return $text; | 536 | return $text; |
| @@ -126,65 +126,6 @@ class Temp extends Command | @@ -126,65 +126,6 @@ class Temp extends Command | ||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /** | 128 | /** |
| 129 | - * 创建指定服务器所有项目主站生成任务 | ||
| 130 | - * @author Akun | ||
| 131 | - * @date 2024/12/19 17:54 | ||
| 132 | - */ | ||
| 133 | - public function create_server_update_page() | ||
| 134 | - { | ||
| 135 | - $server_id = 15; | ||
| 136 | - | ||
| 137 | - $server_ip_model = new ServersIp(); | ||
| 138 | - | ||
| 139 | - $server_ip_ids = $server_ip_model->where('servers_id', $server_id)->get()->pluck('id')->toArray(); | ||
| 140 | - | ||
| 141 | - $project_list = Project::select(['id', 'serve_id'])->whereIn('serve_id', $server_ip_ids)->get(); | ||
| 142 | - | ||
| 143 | - $domain_model = new DomainInfo(); | ||
| 144 | - $notify_model = new Notify(); | ||
| 145 | - | ||
| 146 | - foreach ($project_list as $value) { | ||
| 147 | - $project_id = $value->id; | ||
| 148 | - | ||
| 149 | - $domain_info = $domain_model->read(['project_id' => $project_id, 'status' => 1], ['id', 'domain']); | ||
| 150 | - if (!$domain_info) { | ||
| 151 | - //过滤未绑定正式域名的项目 | ||
| 152 | - continue; | ||
| 153 | - } | ||
| 154 | - $domain = $domain_info['domain']; | ||
| 155 | - | ||
| 156 | - //获取项目所在服务器 | ||
| 157 | - $serve_ip_info = $server_ip_model->read(['id' => $value->serve_id], ['domain', 'ip']); | ||
| 158 | - if (!$serve_ip_info) { | ||
| 159 | - $this->output('项目id:' . $project_id . ' | 未查询到服务器数据'); | ||
| 160 | - continue; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - if (!check_domain_record($domain, $serve_ip_info)) { | ||
| 164 | - $this->output('项目id:' . $project_id . ', domain:' . $domain . ' | 未解析到目标服务器'); | ||
| 165 | - continue; | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - $data = [ | ||
| 169 | - 'project_id' => $project_id, | ||
| 170 | - 'type' => 1, | ||
| 171 | - 'route' => 1, | ||
| 172 | - 'server_id' => $server_id, | ||
| 173 | - 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP] | ||
| 174 | - ]; | ||
| 175 | - $notify = $notify_model->read($data, ['id']); | ||
| 176 | - | ||
| 177 | - if (!$notify) { | ||
| 178 | - $data['data'] = Arr::a2s(['domain' => $domain, 'url' => null, 'language' => []]); | ||
| 179 | - $data['status'] = Notify::STATUS_INIT; | ||
| 180 | - $notify_model->add($data); | ||
| 181 | - | ||
| 182 | - $this->output('项目id:' . $project_id . ' | success'); | ||
| 183 | - } | ||
| 184 | - } | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | * 判断指定服务器项目是否正常访问 | 129 | * 判断指定服务器项目是否正常访问 |
| 189 | * @author Akun | 130 | * @author Akun |
| 190 | * @date 2024/12/11 10:15 | 131 | * @date 2024/12/11 10:15 |
| @@ -272,6 +213,7 @@ class Temp extends Command | @@ -272,6 +213,7 @@ class Temp extends Command | ||
| 272 | public function get_all_projects_by_server() | 213 | public function get_all_projects_by_server() |
| 273 | { | 214 | { |
| 274 | $server_id = 1; | 215 | $server_id = 1; |
| 216 | + $server_name = '240云服务器'; | ||
| 275 | 217 | ||
| 276 | $server_ip_model = new ServersIp(); | 218 | $server_ip_model = new ServersIp(); |
| 277 | 219 | ||
| @@ -297,7 +239,7 @@ class Temp extends Command | @@ -297,7 +239,7 @@ class Temp extends Command | ||
| 297 | } | 239 | } |
| 298 | $map = ['项目id', '名称', '域名']; | 240 | $map = ['项目id', '名称', '域名']; |
| 299 | if ($data) { | 241 | if ($data) { |
| 300 | - $table = new BatchExportService("240云服务器项目"); | 242 | + $table = new BatchExportService($server_name . '项目'); |
| 301 | $file = $table->head($map)->data($data)->save(); | 243 | $file = $table->head($map)->data($data)->save(); |
| 302 | if (!$file) { | 244 | if (!$file) { |
| 303 | $this->output('文件生成失败,请重试'); | 245 | $this->output('文件生成失败,请重试'); |
| @@ -371,6 +313,7 @@ class Temp extends Command | @@ -371,6 +313,7 @@ class Temp extends Command | ||
| 371 | public function check_no_server_projects() | 313 | public function check_no_server_projects() |
| 372 | { | 314 | { |
| 373 | $server_id = 15; | 315 | $server_id = 15; |
| 316 | + $server_name = '美服1'; | ||
| 374 | 317 | ||
| 375 | $server_ip_model = new ServersIp(); | 318 | $server_ip_model = new ServersIp(); |
| 376 | 319 | ||
| @@ -403,7 +346,7 @@ class Temp extends Command | @@ -403,7 +346,7 @@ class Temp extends Command | ||
| 403 | } | 346 | } |
| 404 | $map = ['项目id', '名称', '域名', 'IP', '服务器ID',]; | 347 | $map = ['项目id', '名称', '域名', 'IP', '服务器ID',]; |
| 405 | if ($data) { | 348 | if ($data) { |
| 406 | - $table = new BatchExportService("美服2项目解析未在当前服务器项目"); | 349 | + $table = new BatchExportService($server_name . '解析未在当前服务器项目'); |
| 407 | $file = $table->head($map)->data($data)->save(); | 350 | $file = $table->head($map)->data($data)->save(); |
| 408 | if (!$file) { | 351 | if (!$file) { |
| 409 | $this->output('文件生成失败,请重试'); | 352 | $this->output('文件生成失败,请重试'); |
| @@ -416,6 +359,65 @@ class Temp extends Command | @@ -416,6 +359,65 @@ class Temp extends Command | ||
| 416 | } | 359 | } |
| 417 | 360 | ||
| 418 | /** | 361 | /** |
| 362 | + * 创建指定服务器所有项目主站生成任务 | ||
| 363 | + * @author Akun | ||
| 364 | + * @date 2024/12/19 17:54 | ||
| 365 | + */ | ||
| 366 | + public function create_server_update_page() | ||
| 367 | + { | ||
| 368 | + $server_id = 15; | ||
| 369 | + | ||
| 370 | + $server_ip_model = new ServersIp(); | ||
| 371 | + | ||
| 372 | + $server_ip_ids = $server_ip_model->where('servers_id', $server_id)->get()->pluck('id')->toArray(); | ||
| 373 | + | ||
| 374 | + $project_list = Project::select(['id', 'serve_id'])->whereIn('serve_id', $server_ip_ids)->get(); | ||
| 375 | + | ||
| 376 | + $domain_model = new DomainInfo(); | ||
| 377 | + $notify_model = new Notify(); | ||
| 378 | + | ||
| 379 | + foreach ($project_list as $value) { | ||
| 380 | + $project_id = $value->id; | ||
| 381 | + | ||
| 382 | + $domain_info = $domain_model->read(['project_id' => $project_id, 'status' => 1], ['id', 'domain']); | ||
| 383 | + if (!$domain_info) { | ||
| 384 | + //过滤未绑定正式域名的项目 | ||
| 385 | + continue; | ||
| 386 | + } | ||
| 387 | + $domain = $domain_info['domain']; | ||
| 388 | + | ||
| 389 | + //获取项目所在服务器 | ||
| 390 | + $serve_ip_info = $server_ip_model->read(['id' => $value->serve_id], ['domain', 'ip']); | ||
| 391 | + if (!$serve_ip_info) { | ||
| 392 | + $this->output('项目id:' . $project_id . ' | 未查询到服务器数据'); | ||
| 393 | + continue; | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + if (!check_domain_record($domain, $serve_ip_info)) { | ||
| 397 | + $this->output('项目id:' . $project_id . ', domain:' . $domain . ' | 未解析到目标服务器'); | ||
| 398 | + continue; | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + $data = [ | ||
| 402 | + 'project_id' => $project_id, | ||
| 403 | + 'type' => 1, | ||
| 404 | + 'route' => 1, | ||
| 405 | + 'server_id' => $server_id, | ||
| 406 | + 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP] | ||
| 407 | + ]; | ||
| 408 | + $notify = $notify_model->read($data, ['id']); | ||
| 409 | + | ||
| 410 | + if (!$notify) { | ||
| 411 | + $data['data'] = Arr::a2s(['domain' => $domain, 'url' => null, 'language' => []]); | ||
| 412 | + $data['status'] = Notify::STATUS_INIT; | ||
| 413 | + $notify_model->add($data); | ||
| 414 | + | ||
| 415 | + $this->output('项目id:' . $project_id . ' | success'); | ||
| 416 | + } | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + /** | ||
| 419 | * 创建所有amp站页面生成任务 | 421 | * 创建所有amp站页面生成任务 |
| 420 | * @author Akun | 422 | * @author Akun |
| 421 | * @date 2024/09/26 10:48 | 423 | * @date 2024/09/26 10:48 |
| @@ -435,10 +437,10 @@ class Temp extends Command | @@ -435,10 +437,10 @@ class Temp extends Command | ||
| 435 | $domain_array = parse_url($domain); | 437 | $domain_array = parse_url($domain); |
| 436 | $host = $domain_array['host'] ?? $domain_array['path']; | 438 | $host = $domain_array['host'] ?? $domain_array['path']; |
| 437 | $host_array = explode('.', $host); | 439 | $host_array = explode('.', $host); |
| 438 | - if (count($host_array) <= 2) { | ||
| 439 | - array_unshift($host_array, 'm'); | ||
| 440 | - } else { | 440 | + if ($host_array[0] == 'www') { |
| 441 | $host_array[0] = 'm'; | 441 | $host_array[0] = 'm'; |
| 442 | + } else { | ||
| 443 | + array_unshift($host_array, 'm'); | ||
| 442 | } | 444 | } |
| 443 | $amp_domain = implode('.', $host_array); | 445 | $amp_domain = implode('.', $host_array); |
| 444 | 446 |
| @@ -93,7 +93,7 @@ class OptimizationReportController extends BaseController | @@ -93,7 +93,7 @@ class OptimizationReportController extends BaseController | ||
| 93 | 'data' => array_values($indexed_pages['data'] ?? []), | 93 | 'data' => array_values($indexed_pages['data'] ?? []), |
| 94 | ]; | 94 | ]; |
| 95 | //月统计报告 | 95 | //月统计报告 |
| 96 | - $data['month_count'] = $this->currentMonthCount($domain_info['domain'],$this->param['project_id']); | 96 | + $data['month_count'] = $this->currentMonthCount($this->param['project_id']); |
| 97 | //测速 | 97 | //测速 |
| 98 | $speed = Speed::where('project_id', $this->param['project_id'])->first(); | 98 | $speed = Speed::where('project_id', $this->param['project_id'])->first(); |
| 99 | $data['speed'] = $speed['data'] ?? []; | 99 | $data['speed'] = $speed['data'] ?? []; |
| @@ -110,107 +110,30 @@ class OptimizationReportController extends BaseController | @@ -110,107 +110,30 @@ class OptimizationReportController extends BaseController | ||
| 110 | * @method :post | 110 | * @method :post |
| 111 | * @time :2023/7/3 9:55 | 111 | * @time :2023/7/3 9:55 |
| 112 | */ | 112 | */ |
| 113 | - public function currentMonthCount($domain,$project_id){ | ||
| 114 | - // 获取当前月的开始时间 | ||
| 115 | - $startTime = date('Y-m-01', strtotime($this->param['date'])); | ||
| 116 | - // 获取当前月的结束时间 | ||
| 117 | - $endTime = date('Y-m-t', strtotime($this->param['date'])); | 113 | + public function currentMonthCount($project_id){ |
| 118 | $arr = []; | 114 | $arr = []; |
| 119 | - $arr = $this->inquiryCount($arr,$startTime,$endTime,$domain,$project_id); | ||
| 120 | - $arr = $this->flowCount($arr,$startTime,$endTime,$project_id); | ||
| 121 | - $arr = $this->sourceCount($arr,$startTime,$endTime,$domain); | ||
| 122 | - $arr['month'] = date('Y-m',time()); | ||
| 123 | - return $arr; | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | - /** | ||
| 127 | - * @param $domain | ||
| 128 | - * @param $project_id | ||
| 129 | - * @remark :询盘按月统计 | ||
| 130 | - * @name :inquiryCount | ||
| 131 | - * @author :lyh | ||
| 132 | - * @method :post | ||
| 133 | - * @time :2023/6/30 14:29 | ||
| 134 | - */ | ||
| 135 | - public function inquiryCount(&$arr, &$startTime, $project_id){ | ||
| 136 | - $month = date('Y-m',strtotime($startTime)); | 115 | + $date = date('Y-m', strtotime($this->param['date'])); |
| 137 | $monthCountModel = new MonthCount(); | 116 | $monthCountModel = new MonthCount(); |
| 138 | - $info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$month]); | ||
| 139 | - if($info !== false){ | ||
| 140 | - $arr['country'] = $info['country']; | ||
| 141 | - $arr['total'] = $info['total']; | ||
| 142 | - $arr['month_total'] = $info['month_total']; | ||
| 143 | - } | ||
| 144 | - return $arr; | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | - /** | ||
| 148 | - * @remark :流量统计 | ||
| 149 | - * @name :flowCount | ||
| 150 | - * @author :lyh | ||
| 151 | - * @method :post | ||
| 152 | - * @time :2023/6/30 14:31 | ||
| 153 | - */ | ||
| 154 | - public function flowCount(&$arr,&$startTime,&$endTime,$project_id){ | ||
| 155 | - $pv_ip = DB::table('gl_count') | ||
| 156 | - ->where(['project_id'=>$project_id]) | ||
| 157 | - ->whereBetween('date', [$startTime,$endTime]) | ||
| 158 | - ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num')) | ||
| 159 | - ->orderBy('id','desc') | ||
| 160 | - ->first(); | ||
| 161 | - $arr['pv'] = $pv_ip->pv_num; | ||
| 162 | - $arr['ip'] = $pv_ip->ip_num; | ||
| 163 | - $arr['rate'] = 0; | ||
| 164 | - if($arr['ip'] != 0){ | ||
| 165 | - $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2); | 117 | + $month_info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$date]); |
| 118 | + if($month_info !== false){ | ||
| 119 | + $arr['country'] = $month_info['country']; | ||
| 120 | + $arr['total'] = $month_info['total']; | ||
| 121 | + $arr['month_total'] = $month_info['month_total']; | ||
| 122 | + $arr['pv'] = $month_info['pv']; | ||
| 123 | + $arr['ip'] = $month_info['ip']; | ||
| 124 | + $arr['rate'] = 0; | ||
| 125 | + if($arr['ip'] != 0){ | ||
| 126 | + $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2); | ||
| 127 | + } | ||
| 128 | + $arr['source'] = json_decode($month_info['source'],true); | ||
| 129 | + $arr['source_country'] = json_decode($month_info['source_country'],true); | ||
| 130 | + $arr['referrer_url'] = json_decode($month_info['referrer_url'],true); | ||
| 131 | + $arr['referrer_port'] = json_decode($month_info['referrer_port'],true); | ||
| 166 | } | 132 | } |
| 133 | + $arr['month'] = date('Y-m',time()); | ||
| 167 | return $arr; | 134 | return $arr; |
| 168 | } | 135 | } |
| 169 | 136 | ||
| 170 | - /** | ||
| 171 | - * @remark :来源访问前8 | ||
| 172 | - * @name :sourceCount | ||
| 173 | - * @author :lyh | ||
| 174 | - * @method :post | ||
| 175 | - * @time :2023/6/30 16:14 | ||
| 176 | - */ | ||
| 177 | - public function sourceCount(&$arr,$startTime,$endTime,$domain){ | ||
| 178 | - //访问来源前10 | ||
| 179 | - $source = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 180 | - ->select('referrer_url', DB::raw('COUNT(*) as count')) | ||
| 181 | - ->groupBy('referrer_url') | ||
| 182 | - ->where('referrer_url','!=','') | ||
| 183 | - ->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 184 | - ->orderByDesc('count')->limit(10)->get()->toArray(); | ||
| 185 | - $arr['source'] = $source; | ||
| 186 | - //访问国家前15 | ||
| 187 | - $query = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 188 | - ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) | ||
| 189 | - ->groupBy('country'); | ||
| 190 | - | ||
| 191 | - $query->where('country','<>','中国'); | ||
| 192 | - | ||
| 193 | - $source_country = $query->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 194 | - ->orderBy('ip','desc')->limit(15)->get()->toArray(); | ||
| 195 | - $arr['source_country'] = $source_country; | ||
| 196 | - //受访界面前15 | ||
| 197 | - $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 198 | - ->select('url',DB::raw('COUNT(*) as num')) | ||
| 199 | - ->orderBy('num','desc') | ||
| 200 | - ->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 201 | - ->groupBy('url') | ||
| 202 | - ->limit(15)->get()->toArray(); | ||
| 203 | - $arr['referrer_url'] = $referrer_url; | ||
| 204 | - //访问断后 | ||
| 205 | - $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 206 | - ->select('device_port',DB::raw('COUNT(*) as num')) | ||
| 207 | - ->orderBy('num','desc') | ||
| 208 | - ->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 209 | - ->groupBy('device_port') | ||
| 210 | - ->limit(15)->get()->toArray(); | ||
| 211 | - $arr['referrer_port'] = $referrer_port; | ||
| 212 | - return $arr; | ||
| 213 | - } | ||
| 214 | 137 | ||
| 215 | public function getApiList($projectInfo,$export = false) | 138 | public function getApiList($projectInfo,$export = false) |
| 216 | { | 139 | { |
| @@ -61,13 +61,18 @@ class CNoticeController extends BaseController | @@ -61,13 +61,18 @@ class CNoticeController extends BaseController | ||
| 61 | ],[ | 61 | ],[ |
| 62 | 'language.required' => 'language不能为空', | 62 | 'language.required' => 'language不能为空', |
| 63 | ]); | 63 | ]); |
| 64 | + $project_id_arr = explode(',',env('PROJECT_ID')) ?? []; | ||
| 65 | + if(in_array($this->user['project_id'],$project_id_arr)){ | ||
| 66 | + $this->response('success'); | ||
| 67 | + } | ||
| 64 | $lang_num = count($this->param['language']); | 68 | $lang_num = count($this->param['language']); |
| 65 | $keyword_num = (new Keyword())->counts(['route'=>['!=',null]]); | 69 | $keyword_num = (new Keyword())->counts(['route'=>['!=',null]]); |
| 66 | $data_num = $this->productNum() + $this->CustomNum() + $this->newsNum() + $this->blogNum(); | 70 | $data_num = $this->productNum() + $this->CustomNum() + $this->newsNum() + $this->blogNum(); |
| 67 | $number = $keyword_num * 18 + $lang_num * $data_num; | 71 | $number = $keyword_num * 18 + $lang_num * $data_num; |
| 68 | - if($number >= 45000){ | ||
| 69 | - $this->response('success',Code::SUCCESS,['msg'=>'翻译数量过多, 大概页面数量:'.$number.', 磁盘空间占用可能会超过40G,请谨慎使用!']); | 72 | + if($number >= 450000){ |
| 73 | + $this->response('success',Code::SUCCESS,['msg'=>'翻译数量过多, 大概页面数量:'.$number.', 磁盘空间占用可能会超过40G,请联系管理员操作!']); | ||
| 70 | } | 74 | } |
| 75 | + //? Copyright - 2010-2024 : All Rights Reserved.© Copyright - 2010-2024 : All Rights Reserved. | ||
| 71 | $this->response('success'); | 76 | $this->response('success'); |
| 72 | } | 77 | } |
| 73 | 78 |
| @@ -88,7 +88,6 @@ class MonthReportController extends BaseController | @@ -88,7 +88,6 @@ class MonthReportController extends BaseController | ||
| 88 | ])->count(); | 88 | ])->count(); |
| 89 | $info['service_duration'] = $this->user['service_duration'];//服务天数 | 89 | $info['service_duration'] = $this->user['service_duration'];//服务天数 |
| 90 | $info['ip_total'] = (new Visit())->count();//ip总数 | 90 | $info['ip_total'] = (new Visit())->count();//ip总数 |
| 91 | - | ||
| 92 | $info['remain_day'] = $this->user['remain_day'];//剩余服务天数 | 91 | $info['remain_day'] = $this->user['remain_day'];//剩余服务天数 |
| 93 | $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); | 92 | $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); |
| 94 | $info['month_total'] = (int)$info['month_total']; | 93 | $info['month_total'] = (int)$info['month_total']; |
| @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\Product\ProductLogic; | @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\Product\ProductLogic; | ||
| 12 | use App\Http\Requests\Bside\Product\ProductRequest; | 12 | use App\Http\Requests\Bside\Product\ProductRequest; |
| 13 | use App\Models\Product\Category; | 13 | use App\Models\Product\Category; |
| 14 | use App\Models\Product\CategoryRelated; | 14 | use App\Models\Product\CategoryRelated; |
| 15 | +use App\Models\Product\Detail; | ||
| 15 | use App\Models\Product\Extend; | 16 | use App\Models\Product\Extend; |
| 16 | use App\Models\Product\ExtendInfo; | 17 | use App\Models\Product\ExtendInfo; |
| 17 | use App\Models\Product\Keyword; | 18 | use App\Models\Product\Keyword; |
| @@ -678,7 +679,11 @@ class ProductController extends BaseController | @@ -678,7 +679,11 @@ class ProductController extends BaseController | ||
| 678 | $new_content = htmlentities($contents); | 679 | $new_content = htmlentities($contents); |
| 679 | } | 680 | } |
| 680 | if (!empty($new_content)){ | 681 | if (!empty($new_content)){ |
| 681 | - $productInfo['content'] = $new_content . $productInfo['content']; | 682 | + $detailModel = new Detail(); |
| 683 | + $detailInfo = $detailModel->read(['column_id'=>1]); | ||
| 684 | + if($detailInfo !== false && !empty($detailInfo['content'])){ | ||
| 685 | + $productInfo['content'] = $new_content . $detailInfo['content']['content']; | ||
| 686 | + } | ||
| 682 | } | 687 | } |
| 683 | $this->response('success',Code::SUCCESS,$productInfo); | 688 | $this->response('success',Code::SUCCESS,$productInfo); |
| 684 | } | 689 | } |
| @@ -263,6 +263,7 @@ class UserLoginLogic | @@ -263,6 +263,7 @@ class UserLoginLogic | ||
| 263 | $info['upload_config'] = $project['upload_config']; | 263 | $info['upload_config'] = $project['upload_config']; |
| 264 | $info['main_lang_id'] = $project['main_lang_id']; | 264 | $info['main_lang_id'] = $project['main_lang_id']; |
| 265 | $info['image_max'] = $project['image_max']; | 265 | $info['image_max'] = $project['image_max']; |
| 266 | + $info['is_del_inquiry'] = $project['is_del_inquiry'] ?? 0; | ||
| 266 | $info['uptime_type'] = $this->getHistory($project); | 267 | $info['uptime_type'] = $this->getHistory($project); |
| 267 | $info['uptime'] = $project['uptime']; | 268 | $info['uptime'] = $project['uptime']; |
| 268 | $info['is_update_language'] = $project['is_update_language']; | 269 | $info['is_update_language'] = $project['is_update_language']; |
app/Models/Ai/AiTdkErrorLog.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Ai; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | + | ||
| 7 | +class AiTdkErrorLog extends Base | ||
| 8 | +{ | ||
| 9 | + //设置关联表名 | ||
| 10 | + protected $table = 'gl_ai_tdk_error_log'; | ||
| 11 | + //自动维护create_at创建时间 updated_at修改时间 | ||
| 12 | + public $timestamps = true; | ||
| 13 | + | ||
| 14 | + public static function insertLog($project_id, $table, $table_id, $prompt){ | ||
| 15 | + $model = new self(); | ||
| 16 | + $model->project_id = $project_id; | ||
| 17 | + $model->table_name = $table; | ||
| 18 | + $model->table_id = $table_id; | ||
| 19 | + $model->prompt = $prompt; | ||
| 20 | + $model->save(); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public static function getLog($project_id, $table, $table_id){ | ||
| 24 | + return self::where('project_id', $project_id)->where('table_name', $table)->where('table_id', $table_id)->first(); | ||
| 25 | + } | ||
| 26 | +} |
-
请 注册 或 登录 后发表评论