Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate
正在显示
9 个修改的文件
包含
202 行增加
和
34 行删除
| @@ -220,7 +220,7 @@ class VideoTask extends Command | @@ -220,7 +220,7 @@ class VideoTask extends Command | ||
| 220 | if (count($productIds)<7){ | 220 | if (count($productIds)<7){ |
| 221 | $product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray(); | 221 | $product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray(); |
| 222 | $number = 40; | 222 | $number = 40; |
| 223 | - $product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds)))); | 223 | + $product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds))); |
| 224 | $randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get(); | 224 | $randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get(); |
| 225 | $products = $productsQuery->merge($randomData); | 225 | $products = $productsQuery->merge($randomData); |
| 226 | }else{ | 226 | }else{ |
| @@ -229,7 +229,7 @@ class VideoTask extends Command | @@ -229,7 +229,7 @@ class VideoTask extends Command | ||
| 229 | }else{ | 229 | }else{ |
| 230 | $product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray(); | 230 | $product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray(); |
| 231 | $number = 40; | 231 | $number = 40; |
| 232 | - $product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds)))); | 232 | + $product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds))); |
| 233 | $products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get(); | 233 | $products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get(); |
| 234 | } | 234 | } |
| 235 | } | 235 | } |
| @@ -780,13 +780,30 @@ class ProjectUpdate extends Command | @@ -780,13 +780,30 @@ class ProjectUpdate extends Command | ||
| 780 | $image = $item['images'] ?? ''; | 780 | $image = $item['images'] ?? ''; |
| 781 | } | 781 | } |
| 782 | $new_img = $this->source_download($image, $project_id, $domain, $web_url_domain, $home_url); | 782 | $new_img = $this->source_download($image, $project_id, $domain, $web_url_domain, $home_url); |
| 783 | + //描述 | ||
| 784 | + if (isset($item['description']) && $item['description']) { | ||
| 785 | + //匹配描述资源 | ||
| 786 | + $source_list = $this->html_preg($item['description'], $project_id, $domain, $web_url_domain, $home_url); | ||
| 787 | + if ($source_list) { | ||
| 788 | + foreach ($source_list as $vs) { | ||
| 789 | + if ($vs['download']) { | ||
| 790 | + //需要下载资源 | ||
| 791 | + $down_url = $this->source_download($vs['url_complete'], $project_id, $domain, $web_url_domain, $home_url); | ||
| 792 | + } else { | ||
| 793 | + //已经下载过资源 | ||
| 794 | + $down_url = getImageUrl($vs['url_complete']); | ||
| 795 | + } | ||
| 796 | + $item['description'] = str_replace($vs['url'], $down_url, $item['description']); | ||
| 797 | + } | ||
| 798 | + } | ||
| 799 | + } | ||
| 783 | $parent_id = $model->addReturnId([ | 800 | $parent_id = $model->addReturnId([ |
| 784 | 'project_id' => $project_id, | 801 | 'project_id' => $project_id, |
| 785 | 'title' => $item['name'], | 802 | 'title' => $item['name'], |
| 786 | 'image' => $new_img, | 803 | 'image' => $new_img, |
| 787 | 'pid' => $pid, | 804 | 'pid' => $pid, |
| 788 | 'keywords' => $item['keywords'] ?? '', | 805 | 'keywords' => $item['keywords'] ?? '', |
| 789 | - 'describe' => $item['description'] ?? '', | 806 | + 'describe' => (isset($item['description']) && $item['description']) ? $item['description'] : '', |
| 790 | 'original_id' => $item['id'], | 807 | 'original_id' => $item['id'], |
| 791 | 'route' => $route | 808 | 'route' => $route |
| 792 | ]); | 809 | ]); |
| @@ -978,4 +995,101 @@ class ProjectUpdate extends Command | @@ -978,4 +995,101 @@ class ProjectUpdate extends Command | ||
| 978 | return $key . $i; | 995 | return $key . $i; |
| 979 | } | 996 | } |
| 980 | } | 997 | } |
| 998 | + | ||
| 999 | + //正则匹配html资源 | ||
| 1000 | + protected function html_preg($html, $project_id, $domain, $web_url_domain, $home_url) | ||
| 1001 | + { | ||
| 1002 | + $source = []; | ||
| 1003 | + | ||
| 1004 | + if (!$html) { | ||
| 1005 | + return $source; | ||
| 1006 | + } | ||
| 1007 | + | ||
| 1008 | + //image | ||
| 1009 | + preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_img); | ||
| 1010 | + $img = $result_img[2] ?? []; | ||
| 1011 | + foreach ($img as $vi) { | ||
| 1012 | + $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url); | ||
| 1013 | + if ($check_vi && (!in_array($check_vi, $source))) { | ||
| 1014 | + $source[] = $check_vi; | ||
| 1015 | + } | ||
| 1016 | + } | ||
| 1017 | + | ||
| 1018 | + //video | ||
| 1019 | + preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video); | ||
| 1020 | + $video = $result_video[2] ?? []; | ||
| 1021 | + foreach ($video as $vv) { | ||
| 1022 | + $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url); | ||
| 1023 | + if ($check_vv && (!in_array($check_vv, $source))) { | ||
| 1024 | + $source[] = $check_vv; | ||
| 1025 | + } | ||
| 1026 | + } | ||
| 1027 | + preg_match_all('/<video\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video_2); | ||
| 1028 | + $video_2 = $result_video_2[2] ?? []; | ||
| 1029 | + foreach ($video_2 as $vv2) { | ||
| 1030 | + $check_vv2 = $this->url_check($vv2, $project_id, $domain, $web_url_domain, $home_url); | ||
| 1031 | + if ($check_vv2 && (!in_array($check_vv2, $source))) { | ||
| 1032 | + $source[] = $check_vv2; | ||
| 1033 | + } | ||
| 1034 | + } | ||
| 1035 | + | ||
| 1036 | + //a标签下载资源 | ||
| 1037 | + preg_match_all('/<a\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_a); | ||
| 1038 | + $down = $result_a[2] ?? []; | ||
| 1039 | + foreach ($down as $vd) { | ||
| 1040 | + $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url); | ||
| 1041 | + if ($check_vd && (!in_array($check_vd, $source))) { | ||
| 1042 | + $source[] = $check_vd; | ||
| 1043 | + } | ||
| 1044 | + } | ||
| 1045 | + | ||
| 1046 | + return $source; | ||
| 1047 | + } | ||
| 1048 | + | ||
| 1049 | + //判断资源是否需要下载 | ||
| 1050 | + protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url) | ||
| 1051 | + { | ||
| 1052 | + $url = trim($url); | ||
| 1053 | + if ($url) { | ||
| 1054 | + $url = str_replace('"', '', $url); | ||
| 1055 | + $arr = parse_url($url); | ||
| 1056 | + $scheme = $arr['scheme'] ?? ''; | ||
| 1057 | + $host = $arr['host'] ?? ''; | ||
| 1058 | + $path = $arr['path'] ?? ''; | ||
| 1059 | + $query = $arr['query'] ?? ''; | ||
| 1060 | + | ||
| 1061 | + $path_arr = explode('.', $path); | ||
| 1062 | + $path_end = end($path_arr); | ||
| 1063 | + if ( | ||
| 1064 | + (empty($scheme) || $scheme == 'https' || $scheme == 'http') | ||
| 1065 | + && (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false)) | ||
| 1066 | + && $path | ||
| 1067 | + && (substr($path, 0, 1) == '/') | ||
| 1068 | + && (strpos($path, '.') !== false) | ||
| 1069 | + && (strpos($path_end, 'html') === false) | ||
| 1070 | + && (strpos($path_end, 'php') === false) | ||
| 1071 | + && (strpos($path_end, 'com') === false) | ||
| 1072 | + && (strpos($path_end, 'xml') === false) | ||
| 1073 | + ) { | ||
| 1074 | + $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | ||
| 1075 | + if (!$source) { | ||
| 1076 | + return [ | ||
| 1077 | + 'download' => true, | ||
| 1078 | + 'url' => $url, | ||
| 1079 | + 'url_complete' => ($scheme ?: 'https') . '://' . $domain . $path . ($query ? '?' . $query : '') | ||
| 1080 | + ]; | ||
| 1081 | + } else { | ||
| 1082 | + return [ | ||
| 1083 | + 'download' => false, | ||
| 1084 | + 'url' => $url, | ||
| 1085 | + 'url_complete' => $source['target'] | ||
| 1086 | + ]; | ||
| 1087 | + } | ||
| 1088 | + } else { | ||
| 1089 | + return false; | ||
| 1090 | + } | ||
| 1091 | + } else { | ||
| 1092 | + return false; | ||
| 1093 | + } | ||
| 1094 | + } | ||
| 981 | } | 1095 | } |
| @@ -19,13 +19,13 @@ class Kernel extends ConsoleKernel | @@ -19,13 +19,13 @@ class Kernel extends ConsoleKernel | ||
| 19 | $schedule->command('remain_day')->dailyAt('08:00')->withoutOverlapping(1); // 项目剩余服务时长 | 19 | $schedule->command('remain_day')->dailyAt('08:00')->withoutOverlapping(1); // 项目剩余服务时长 |
| 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 | 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 |
| 21 | $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 | 21 | $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 |
| 22 | - $schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 | ||
| 23 | - $schedule->command('rank_data_external_links')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 | ||
| 24 | - $schedule->command('rank_data_indexed_pages')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次 | ||
| 25 | - $schedule->command('rank_data_recomm_domain')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 | 22 | + $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 |
| 23 | + $schedule->command('rank_data_external_links')->dailyAt('01:20')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次 | ||
| 24 | + $schedule->command('rank_data_indexed_pages')->dailyAt('01:30')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次 | ||
| 25 | + $schedule->command('rank_data_recomm_domain')->dailyAt('01:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次 | ||
| 26 | $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 | 26 | $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 |
| 27 | // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 | 27 | // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 |
| 28 | - $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次 | 28 | + $schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次 |
| 29 | $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 | 29 | $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 |
| 30 | $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 | 30 | $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 |
| 31 | $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 | 31 | $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 |
| @@ -35,7 +35,7 @@ class Kernel extends ConsoleKernel | @@ -35,7 +35,7 @@ class Kernel extends ConsoleKernel | ||
| 35 | $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 | 35 | $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 |
| 36 | $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 | 36 | $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 |
| 37 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 | 37 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 |
| 38 | - $schedule->command('domain_info')->dailyAt('01:00')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 | 38 | + $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 |
| 39 | $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 | 39 | $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 |
| 40 | // $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新 | 40 | // $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新 |
| 41 | $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK | 41 | $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK |
| @@ -43,8 +43,12 @@ class Kernel extends ConsoleKernel | @@ -43,8 +43,12 @@ class Kernel extends ConsoleKernel | ||
| 43 | // $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件 | 43 | // $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件 |
| 44 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 | 44 | $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 |
| 45 | 45 | ||
| 46 | - $schedule->command('recommended_suppliers')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 | 46 | + $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 |
| 47 | $schedule->command('notice_c')->dailyAt('02:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 | 47 | $schedule->command('notice_c')->dailyAt('02:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 |
| 48 | + // 每日推送视频任务 | ||
| 49 | + $schedule->command('video_task')->dailyAt('01:30')->withoutOverlapping(1); | ||
| 50 | + // 每日推送已完成视频任务项目生成对应界面 | ||
| 51 | + $schedule->command('notice_c')->dailyAt('02:00')->withoutOverlapping(1); | ||
| 48 | } | 52 | } |
| 49 | 53 | ||
| 50 | /** | 54 | /** |
| @@ -111,9 +111,9 @@ class OptimizationReportController extends BaseController | @@ -111,9 +111,9 @@ class OptimizationReportController extends BaseController | ||
| 111 | */ | 111 | */ |
| 112 | public function currentMonthCount($domain,$project_id){ | 112 | public function currentMonthCount($domain,$project_id){ |
| 113 | // 获取当前月的开始时间 | 113 | // 获取当前月的开始时间 |
| 114 | - $startTime = date('Y-m-01 00:00:00', strtotime('2024-01')); | 114 | + $startTime = date('Y-m-01', strtotime($this->param['date'])); |
| 115 | // 获取当前月的结束时间 | 115 | // 获取当前月的结束时间 |
| 116 | - $endTime = date('Y-m-t 23:59:59', strtotime('2024-01')); | 116 | + $endTime = date('Y-m-t', strtotime($this->param['date'])); |
| 117 | $arr = []; | 117 | $arr = []; |
| 118 | $arr = $this->inquiryCount($arr,$startTime,$endTime,$domain); | 118 | $arr = $this->inquiryCount($arr,$startTime,$endTime,$domain); |
| 119 | $arr = $this->flowCount($arr,$startTime,$endTime,$project_id); | 119 | $arr = $this->flowCount($arr,$startTime,$endTime,$project_id); |
| @@ -13,6 +13,7 @@ use App\Models\Product\Product; | @@ -13,6 +13,7 @@ use App\Models\Product\Product; | ||
| 13 | use App\Models\Project\OnlineCheck; | 13 | use App\Models\Project\OnlineCheck; |
| 14 | use App\Models\Project\Project; | 14 | use App\Models\Project\Project; |
| 15 | use App\Models\RouteMap\RouteMap; | 15 | use App\Models\RouteMap\RouteMap; |
| 16 | +use App\Models\User\User; | ||
| 16 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 17 | use Illuminate\Http\Request; | 18 | use Illuminate\Http\Request; |
| 18 | 19 | ||
| @@ -98,4 +99,32 @@ class PrivateController extends BaseController | @@ -98,4 +99,32 @@ class PrivateController extends BaseController | ||
| 98 | } | 99 | } |
| 99 | return $this->success($result); | 100 | return $this->success($result); |
| 100 | } | 101 | } |
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 验证当前用户是否存在 | ||
| 105 | + * TODO 查询手机号码是否是项目用户, 如果升级项目未上线项目return false; | ||
| 106 | + * @param Request $request | ||
| 107 | + * @return false|string | ||
| 108 | + */ | ||
| 109 | + public function hasUser(Request $request) | ||
| 110 | + { | ||
| 111 | + // 获取数据,初始化信息 | ||
| 112 | + $mobile = trim($request->input('mobile')); | ||
| 113 | + $result = ['mobile' => $mobile, 'v6_user' => false]; | ||
| 114 | + | ||
| 115 | + // 获取用户,验证用户 | ||
| 116 | + $project_ids = User::where(['mobile' => $mobile])->pluck('project_id')->toArray(); | ||
| 117 | + if (empty($project_ids)) | ||
| 118 | + return $this->success($result); | ||
| 119 | + | ||
| 120 | + $projects = Project::whereIn('id', $project_ids)->where('delete_status', 0)->get(); | ||
| 121 | + foreach ($projects as $project) { | ||
| 122 | + // 如果是升级项目 并且未上线状态,不算做有效用户 | ||
| 123 | + if ($project->is_upgrade == Project::IS_UPGRADE_TRUE && $project->type <= Project::TYPE_ONE) | ||
| 124 | + continue; | ||
| 125 | + $result['v6_user'] = true; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + return $this->success($result); | ||
| 129 | + } | ||
| 101 | } | 130 | } |
| @@ -54,7 +54,7 @@ class TranslateLogic extends BaseLogic | @@ -54,7 +54,7 @@ class TranslateLogic extends BaseLogic | ||
| 54 | if($info !== false){ | 54 | if($info !== false){ |
| 55 | $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); | 55 | $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE); |
| 56 | foreach ($data_read as $k => $v){ | 56 | foreach ($data_read as $k => $v){ |
| 57 | - $old_key[] = $k; | 57 | + $old_key[] = trim($k); |
| 58 | $data[] = [$k => $v]; | 58 | $data[] = [$k => $v]; |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| @@ -83,26 +83,9 @@ class TranslateLogic extends BaseLogic | @@ -83,26 +83,9 @@ class TranslateLogic extends BaseLogic | ||
| 83 | 83 | ||
| 84 | } | 84 | } |
| 85 | } | 85 | } |
| 86 | - $data = $this->unique_multidimensional_array($data); | ||
| 87 | return $this->success($data); | 86 | return $this->success($data); |
| 88 | } | 87 | } |
| 89 | 88 | ||
| 90 | - /** | ||
| 91 | - * @remark :多维数组去重 | ||
| 92 | - * @name :unique_multidimensional_array | ||
| 93 | - * @author :lyh | ||
| 94 | - * @method :post | ||
| 95 | - * @time :2024/3/8 16:38 | ||
| 96 | - */ | ||
| 97 | - public function unique_multidimensional_array($array) { | ||
| 98 | - // 将多维数组转换为字符串并进行去重 | ||
| 99 | - $uniqueArray = array_map('json_encode', $array); | ||
| 100 | - // 去除重复项 | ||
| 101 | - $uniqueArray = array_unique($uniqueArray); | ||
| 102 | - // 将字符串转换回多维数组 | ||
| 103 | - $uniqueArray = array_map('json_decode', $uniqueArray); | ||
| 104 | - return $uniqueArray; | ||
| 105 | - } | ||
| 106 | 89 | ||
| 107 | /** | 90 | /** |
| 108 | * @remark :获取图片列表 | 91 | * @remark :获取图片列表 |
| @@ -199,10 +182,11 @@ class TranslateLogic extends BaseLogic | @@ -199,10 +182,11 @@ class TranslateLogic extends BaseLogic | ||
| 199 | if(FALSE !== strpos($country_class, 'country-flag')) { | 182 | if(FALSE !== strpos($country_class, 'country-flag')) { |
| 200 | continue; | 183 | continue; |
| 201 | } | 184 | } |
| 202 | - $need_tran[] = htmlspecialchars_decode(html_entity_decode($string)); | 185 | + $need_tran[] = trim(htmlspecialchars_decode(html_entity_decode($string))); |
| 203 | } | 186 | } |
| 204 | $need_tran[] = $description ? $description->attr['content'] : ''; | 187 | $need_tran[] = $description ? $description->attr['content'] : ''; |
| 205 | $need_tran[] = $keywords ? $keywords->attr['content'] : ''; | 188 | $need_tran[] = $keywords ? $keywords->attr['content'] : ''; |
| 189 | + $need_tran = array_unique($need_tran); | ||
| 206 | return $need_tran; | 190 | return $need_tran; |
| 207 | } | 191 | } |
| 208 | 192 |
| @@ -2,11 +2,12 @@ | @@ -2,11 +2,12 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Listeners; | 3 | namespace App\Listeners; |
| 4 | 4 | ||
| 5 | -use Illuminate\Contracts\Queue\ShouldQueue; | 5 | +use App\Enums\Common\Common; |
| 6 | use Illuminate\Database\Events\QueryExecuted; | 6 | use Illuminate\Database\Events\QueryExecuted; |
| 7 | -use Illuminate\Queue\InteractsWithQueue; | 7 | +use Illuminate\Support\Facades\Cache; |
| 8 | use Illuminate\Support\Facades\Log; | 8 | use Illuminate\Support\Facades\Log; |
| 9 | -use Illuminate\Support\Facades\Redis; | 9 | +use Illuminate\Support\Facades\Route; |
| 10 | +use Illuminate\Support\Str; | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * 监听数据库sql执行事件 | 13 | * 监听数据库sql执行事件 |
| @@ -47,6 +48,33 @@ class QueryListener | @@ -47,6 +48,33 @@ class QueryListener | ||
| 47 | $log = $log.' [ RunTime:'.$event->time.'ms ] '; | 48 | $log = $log.' [ RunTime:'.$event->time.'ms ] '; |
| 48 | Log::debug($log); | 49 | Log::debug($log); |
| 49 | } | 50 | } |
| 51 | + //监听9644这个api_no是TM咋个被改的 | ||
| 52 | + if (in_array(9644, $event->bindings) && Str::contains($event->sql, 'update') && Str::contains($event->sql, '`api_no` =')) { | ||
| 53 | + //记录debug 根据这个溯源 | ||
| 54 | + $trace = debug_backtrace(); | ||
| 55 | + $traces = []; | ||
| 56 | + foreach ($trace as $index => $caller) { | ||
| 57 | + if ($index === 0) { | ||
| 58 | + continue; // 跳过当前方法的调用信息 | ||
| 59 | + } | ||
| 60 | + $file = $caller['file']; | ||
| 61 | + $line = $caller['line']; | ||
| 62 | + $class = $caller['class']; | ||
| 63 | + $method = $caller['function']; | ||
| 64 | + $traces[] = "Method $method called from $class in file $file at line $line\n"; | ||
| 65 | + } | ||
| 66 | + //用户信息 哪个改的 还是脚本跑的 | ||
| 67 | + $token = request()->header('token'); | ||
| 68 | + Log::channel('test')->info('api_no updated', [ | ||
| 69 | + 'sql' => $event->sql, | ||
| 70 | + 'bindings' => $event->bindings, | ||
| 71 | + 'route' => Route::current(), | ||
| 72 | + 'request' => request()->all(), | ||
| 73 | + 'a_info' => Cache::get(Common::MANAGE_TOKEN . $token), | ||
| 74 | + 'b_info' => Cache::get($token), | ||
| 75 | + 'trace' => $traces | ||
| 76 | + ]); | ||
| 77 | + } | ||
| 50 | }catch (\Exception $exception){ | 78 | }catch (\Exception $exception){ |
| 51 | Log::error('log sql error:'.$exception->getMessage()); | 79 | Log::error('log sql error:'.$exception->getMessage()); |
| 52 | } | 80 | } |
| @@ -72,6 +72,12 @@ return [ | @@ -72,6 +72,12 @@ return [ | ||
| 72 | 'via' => \App\Factory\LogFormatterFactory::class, | 72 | 'via' => \App\Factory\LogFormatterFactory::class, |
| 73 | 'prefix' => 'rank_data', | 73 | 'prefix' => 'rank_data', |
| 74 | ], | 74 | ], |
| 75 | + //测试数据日志 | ||
| 76 | + 'test' => [ | ||
| 77 | + 'driver' => 'custom', | ||
| 78 | + 'via' => \App\Factory\LogFormatterFactory::class, | ||
| 79 | + 'prefix' => 'test', | ||
| 80 | + ], | ||
| 75 | 'wechatside' => [ | 81 | 'wechatside' => [ |
| 76 | 'driver' => 'custom', | 82 | 'driver' => 'custom', |
| 77 | 'via' => \App\Factory\LogFormatterFactory::class, | 83 | 'via' => \App\Factory\LogFormatterFactory::class, |
| @@ -24,4 +24,7 @@ Route::get('get_project_route', [\App\Http\Controllers\Api\PrivateController::cl | @@ -24,4 +24,7 @@ Route::get('get_project_route', [\App\Http\Controllers\Api\PrivateController::cl | ||
| 24 | Route::any('get_product_images', [\App\Http\Controllers\Api\ProductController::class, 'getImages'])->name('api.get_product_images'); | 24 | Route::any('get_product_images', [\App\Http\Controllers\Api\ProductController::class, 'getImages'])->name('api.get_product_images'); |
| 25 | Route::post('inquiry_submit', [\App\Http\Controllers\Api\InquiryController::class, 'submit'])->name('api.inquiry_submit'); | 25 | Route::post('inquiry_submit', [\App\Http\Controllers\Api\InquiryController::class, 'submit'])->name('api.inquiry_submit'); |
| 26 | Route::any('getOptimizationReport', [\App\Http\Controllers\Api\OptimizationReportController::class, 'getOptimizationReport'])->name('api.getOptimizationReport'); | 26 | Route::any('getOptimizationReport', [\App\Http\Controllers\Api\OptimizationReportController::class, 'getOptimizationReport'])->name('api.getOptimizationReport'); |
| 27 | +// 视频任务回调信息 | ||
| 27 | Route::post('video_task_callback', [\App\Http\Controllers\Api\NoticeController::class, 'videoTaskCallback'])->name('api.video_task_callback'); | 28 | Route::post('video_task_callback', [\App\Http\Controllers\Api\NoticeController::class, 'videoTaskCallback'])->name('api.video_task_callback'); |
| 29 | +// 验证是否为6.0用户 | ||
| 30 | +Route::any('has_user', [\App\Http\Controllers\Api\PrivateController::class, 'hasUser'])->name('api.has_user'); |
-
请 注册 或 登录 后发表评论