Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
4 个修改的文件
包含
76 行增加
和
18 行删除
| @@ -64,6 +64,6 @@ class TemplateLog extends Command | @@ -64,6 +64,6 @@ class TemplateLog extends Command | ||
| 64 | $startDate = date("Y-m-01 00:00:00"); | 64 | $startDate = date("Y-m-01 00:00:00"); |
| 65 | $endDate = date("Y-m-t 23:59:59"); | 65 | $endDate = date("Y-m-t 23:59:59"); |
| 66 | $templateLogModel = new BTemplateLog(); | 66 | $templateLogModel = new BTemplateLog(); |
| 67 | - return $templateLogModel->del(['created_at'=>['not between'=>[$startDate,$endDate]]]); | 67 | + return $templateLogModel->del(['created_at'=>['not between',[$startDate,$endDate]]]); |
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| @@ -2,12 +2,12 @@ | @@ -2,12 +2,12 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Console\Commands\Domain; | 3 | namespace App\Console\Commands\Domain; |
| 4 | 4 | ||
| 5 | +use App\Models\Devops\ServerConfig; | ||
| 5 | use App\Models\Devops\ServersIp; | 6 | use App\Models\Devops\ServersIp; |
| 6 | use App\Models\Domain\DomainInfo; | 7 | use App\Models\Domain\DomainInfo; |
| 7 | use App\Models\Project\Project; | 8 | use App\Models\Project\Project; |
| 8 | use App\Services\BatchExportService; | 9 | use App\Services\BatchExportService; |
| 9 | use Illuminate\Console\Command; | 10 | use Illuminate\Console\Command; |
| 10 | -use Symfony\Component\Process\Process; | ||
| 11 | 11 | ||
| 12 | class ProjectDomainCheck extends Command | 12 | class ProjectDomainCheck extends Command |
| 13 | { | 13 | { |
| @@ -16,7 +16,7 @@ class ProjectDomainCheck extends Command | @@ -16,7 +16,7 @@ class ProjectDomainCheck extends Command | ||
| 16 | 16 | ||
| 17 | public function handle() | 17 | public function handle() |
| 18 | { | 18 | { |
| 19 | - $map = ['项目id', '名称', '域名', '项目所选IP']; | 19 | + $map = ['项目id', '名称', '域名', '项目所选IP', '项目实际IP']; |
| 20 | 20 | ||
| 21 | //获取所有恢复项目 | 21 | //获取所有恢复项目 |
| 22 | $domain_model = new DomainInfo(); | 22 | $domain_model = new DomainInfo(); |
| @@ -28,16 +28,26 @@ class ProjectDomainCheck extends Command | @@ -28,16 +28,26 @@ class ProjectDomainCheck extends Command | ||
| 28 | 28 | ||
| 29 | foreach ($domain_list as $value) { | 29 | foreach ($domain_list as $value) { |
| 30 | $project_info = $project_model->read(['id' => $value->project_id], ['id', 'serve_id', 'company']); | 30 | $project_info = $project_model->read(['id' => $value->project_id], ['id', 'serve_id', 'company']); |
| 31 | - $server_ip_info = $server_ip_model->read(['id' => $project_info['serve_id']], ['ip', 'domain']); | 31 | + $server_ip_info = $server_ip_model->read(['id' => $project_info['serve_id']], ['servers_id', 'ip', 'domain']); |
| 32 | 32 | ||
| 33 | - if (check_domain_record($value->domain, $server_ip_info)) { | 33 | + if ($server_ip_info['servers_id'] == ServerConfig::SELF_SITE_ID) { |
| 34 | + //过滤自建站项目 | ||
| 35 | + continue; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + //获取域名解析 | ||
| 39 | + $records = dns_get_record($value->domain, DNS_A); | ||
| 40 | + $record_ip = $records[0]['ip'] ?? ''; | ||
| 41 | + $record_domain = $records[0]['host'] ?? ''; | ||
| 42 | + if ($record_domain == $server_ip_info['domain'] || $record_ip == $server_ip_info['ip']) { | ||
| 34 | continue; | 43 | continue; |
| 35 | } else { | 44 | } else { |
| 36 | $data[] = [ | 45 | $data[] = [ |
| 37 | $value->project_id, | 46 | $value->project_id, |
| 38 | $project_info['company'], | 47 | $project_info['company'], |
| 39 | $value->domain, | 48 | $value->domain, |
| 40 | - $server_ip_info['ip'] | 49 | + $server_ip_info['ip'], |
| 50 | + $record_ip, | ||
| 41 | ]; | 51 | ]; |
| 42 | } | 52 | } |
| 43 | } | 53 | } |
| @@ -13,6 +13,7 @@ use App\Models\Inquiry\ReInquiryDetailLog; | @@ -13,6 +13,7 @@ use App\Models\Inquiry\ReInquiryDetailLog; | ||
| 13 | use App\Models\Inquiry\ReInquiryForm; | 13 | use App\Models\Inquiry\ReInquiryForm; |
| 14 | use App\Models\Inquiry\ReInquiryTask; | 14 | use App\Models\Inquiry\ReInquiryTask; |
| 15 | use App\Models\Inquiry\ReInquiryText; | 15 | use App\Models\Inquiry\ReInquiryText; |
| 16 | +use App\Models\Project\InquiryFilterConfig; | ||
| 16 | use App\Models\Project\Project; | 17 | use App\Models\Project\Project; |
| 17 | use App\Models\WebSetting\WebLanguage; | 18 | use App\Models\WebSetting\WebLanguage; |
| 18 | use Illuminate\Console\Command; | 19 | use Illuminate\Console\Command; |
| @@ -177,10 +178,10 @@ class RelayInquiry extends Command | @@ -177,10 +178,10 @@ class RelayInquiry extends Command | ||
| 177 | $this->output('开始处理本轮询盘!'); | 178 | $this->output('开始处理本轮询盘!'); |
| 178 | foreach ($inquiry as $key=>$val) { | 179 | foreach ($inquiry as $key=>$val) { |
| 179 | $this->output('询盘ID:' . $val->id); | 180 | $this->output('询盘ID:' . $val->id); |
| 180 | - //询盘时间超过90分钟 就不处理了 | ||
| 181 | - if(time() - strtotime($val->inquiry_date) > 90 * 60){ | 181 | + //询盘时间超过2小时 就不处理了 |
| 182 | + if(time() - strtotime($val->inquiry_date) > 7200){ | ||
| 182 | $val->status = ReInquiryForm::STATUS_FORGO; | 183 | $val->status = ReInquiryForm::STATUS_FORGO; |
| 183 | - $val->remark = '超时90分钟未处理!'; | 184 | + $val->remark = '超时2小时未处理!'; |
| 184 | $val->save(); | 185 | $val->save(); |
| 185 | continue; | 186 | continue; |
| 186 | } | 187 | } |
| @@ -200,6 +201,14 @@ class RelayInquiry extends Command | @@ -200,6 +201,14 @@ class RelayInquiry extends Command | ||
| 200 | $val->save(); | 201 | $val->save(); |
| 201 | continue; | 202 | continue; |
| 202 | } | 203 | } |
| 204 | + //是否要过滤 | ||
| 205 | + $filter_res = $this->filter($val); | ||
| 206 | + if($filter_res !== true){ | ||
| 207 | + $val->status = ReInquiryForm::STATUS_FORGO; | ||
| 208 | + $val->remark = $filter_res; | ||
| 209 | + $val->save(); | ||
| 210 | + continue; | ||
| 211 | + } | ||
| 203 | 212 | ||
| 204 | try { | 213 | try { |
| 205 | $this->relayDetail($ad_task, $val); | 214 | $this->relayDetail($ad_task, $val); |
| @@ -213,6 +222,46 @@ class RelayInquiry extends Command | @@ -213,6 +222,46 @@ class RelayInquiry extends Command | ||
| 213 | return true; | 222 | return true; |
| 214 | } | 223 | } |
| 215 | 224 | ||
| 225 | + | ||
| 226 | + public function filter($data) | ||
| 227 | + { | ||
| 228 | + //通用过滤规则 | ||
| 229 | + $config = InquiryFilterConfig::getCacheInfoByProjectId(Project::DEMO_PROJECT_ID); | ||
| 230 | + //过滤内容 | ||
| 231 | + if(!empty($data['message']) && !empty($config['filter_contents'])) { | ||
| 232 | + foreach ($config['filter_contents'] as $filter_content) { | ||
| 233 | + if (Str::contains(strtolower($data['message']), strtolower($filter_content))) { | ||
| 234 | + return '过滤内容:' . $filter_content; | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + //过滤邮箱 | ||
| 239 | + if(!empty($data['email']) && !empty($config['filter_emails'])){ | ||
| 240 | + foreach ($config['filter_emails'] as $filter_email){ | ||
| 241 | + if(Str::contains(strtolower($data['email']), strtolower($filter_email))){ | ||
| 242 | + return '过滤邮箱:' . $filter_email; | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + //过滤电话 | ||
| 247 | + if(!empty($data['phone']) && !empty($config['filter_mobiles'])){ | ||
| 248 | + foreach ($config['filter_mobiles'] as $filter_mobile){ | ||
| 249 | + if(Str::contains(strtolower($data['phone']), strtolower($filter_mobile))){ | ||
| 250 | + return '过滤电话:' . $filter_mobile; | ||
| 251 | + } | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + //过滤姓名 | ||
| 255 | + if(!empty($data['full_name'] && !empty($config['filter_names']))){ | ||
| 256 | + foreach ($config['filter_names'] as $filter_name){ | ||
| 257 | + if(Str::contains(strtolower($data['full_name']), strtolower($filter_name))){ | ||
| 258 | + return '过滤姓名:' . $filter_name; | ||
| 259 | + } | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + return true; | ||
| 263 | + } | ||
| 264 | + | ||
| 216 | /** | 265 | /** |
| 217 | * 创建转发详情 | 266 | * 创建转发详情 |
| 218 | * TODO 通过任务生成转发对象, 更具转发对象获取对应数据, 写入着陆记录 | 267 | * TODO 通过任务生成转发对象, 更具转发对象获取对应数据, 写入着陆记录 |
| @@ -80,6 +80,7 @@ class postInquiry extends Command | @@ -80,6 +80,7 @@ class postInquiry extends Command | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | public function visit(ReInquiryDetail $detail, ReInquiryDetailLog $log){ | 82 | public function visit(ReInquiryDetail $detail, ReInquiryDetailLog $log){ |
| 83 | + $website = 'https://' . $detail['re_website'] . '/'; | ||
| 83 | if($detail['is_v6']) { | 84 | if($detail['is_v6']) { |
| 84 | $data = [ | 85 | $data = [ |
| 85 | 'ip' => $detail['ip'], | 86 | 'ip' => $detail['ip'], |
| @@ -88,30 +89,27 @@ class postInquiry extends Command | @@ -88,30 +89,27 @@ class postInquiry extends Command | ||
| 88 | 'referrer_url' => $detail['referrer'], | 89 | 'referrer_url' => $detail['referrer'], |
| 89 | 'user_agent' => $detail['user_agent'], | 90 | 'user_agent' => $detail['user_agent'], |
| 90 | ]; | 91 | ]; |
| 91 | - $res = Http::withoutVerifying()->post($detail['re_website'] . 'api/traffic_visit/', $data)->json(); | 92 | + $res = Http::withoutVerifying()->post($website . 'api/traffic_visit/', $data)->json(); |
| 92 | if (empty($res['status']) || $res['status'] != 200) { | 93 | if (empty($res['status']) || $res['status'] != 200) { |
| 93 | $log->status = ReInquiryDetailLog::STATUS_FAIL; | 94 | $log->status = ReInquiryDetailLog::STATUS_FAIL; |
| 94 | $log->remark = $res['message'] ?? ''; | 95 | $log->remark = $res['message'] ?? ''; |
| 95 | $log->save(); | 96 | $log->save(); |
| 96 | 97 | ||
| 97 | - Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $detail['re_website'] . 'api/traffic_visit/',$data]); | 98 | + Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $website . 'api/traffic_visit/',$data]); |
| 98 | return false; | 99 | return false; |
| 99 | } | 100 | } |
| 100 | }else{ | 101 | }else{ |
| 101 | //v4 v5分离项目 往测试链接推 | 102 | //v4 v5分离项目 往测试链接推 |
| 102 | - $website = $detail['re_website']; | ||
| 103 | $client = new \GuzzleHttp\Client(); | 103 | $client = new \GuzzleHttp\Client(); |
| 104 | $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [ | 104 | $site_array = $client->request('GET', "https://www.quanqiusou.cn/extend_api/saas/split.php", [ |
| 105 | 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 | 105 | 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号 |
| 106 | ])->getBody()->getContents(); | 106 | ])->getBody()->getContents(); |
| 107 | $site_array = json_decode($site_array, true); | 107 | $site_array = json_decode($site_array, true); |
| 108 | $mail_urls = array_column($site_array, 'main_url'); | 108 | $mail_urls = array_column($site_array, 'main_url'); |
| 109 | - $key = array_search('https://' . $detail['re_website'] . '/', $mail_urls); | 109 | + $key = array_search($website, $mail_urls); |
| 110 | if ($key !== false) { | 110 | if ($key !== false) { |
| 111 | // 分离项目 推送到测试链接 | 111 | // 分离项目 推送到测试链接 |
| 112 | $website = $site_array[$key]['test_url']; | 112 | $website = $site_array[$key]['test_url']; |
| 113 | - }else{ | ||
| 114 | - $website = 'https://' . $website . '/'; | ||
| 115 | } | 113 | } |
| 116 | 114 | ||
| 117 | $data = [ | 115 | $data = [ |
| @@ -138,6 +136,7 @@ class postInquiry extends Command | @@ -138,6 +136,7 @@ class postInquiry extends Command | ||
| 138 | } | 136 | } |
| 139 | 137 | ||
| 140 | public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){ | 138 | public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){ |
| 139 | + $website = 'https://' . $detail['re_website'] . '/'; | ||
| 141 | // v6 | 140 | // v6 |
| 142 | if($detail['is_v6']) { | 141 | if($detail['is_v6']) { |
| 143 | $data = [ | 142 | $data = [ |
| @@ -150,16 +149,16 @@ class postInquiry extends Command | @@ -150,16 +149,16 @@ class postInquiry extends Command | ||
| 150 | if($detail->email){ | 149 | if($detail->email){ |
| 151 | $data['email'] = $detail->email; | 150 | $data['email'] = $detail->email; |
| 152 | }else{ | 151 | }else{ |
| 153 | - $data['__amp_source_origin'] = trim($detail['re_website'], '/'); | 152 | + $data['__amp_source_origin'] = trim($website, '/'); |
| 154 | } | 153 | } |
| 155 | 154 | ||
| 156 | - $res = Http::withoutVerifying()->withHeaders(['User-Agent' => $detail['user_agent']])->post($detail['re_website'] . 'api/inquiryQd/', $data)->json(); | 155 | + $res = Http::withoutVerifying()->withHeaders(['User-Agent' => $detail['user_agent']])->post($website . 'api/inquiryQd/', $data)->json(); |
| 157 | if(empty($res['code']) || $res['code'] != 200){ | 156 | if(empty($res['code']) || $res['code'] != 200){ |
| 158 | $log->status = ReInquiryDetailLog::STATUS_FAIL; | 157 | $log->status = ReInquiryDetailLog::STATUS_FAIL; |
| 159 | $log->remark = $res['message'] ?? ''; | 158 | $log->remark = $res['message'] ?? ''; |
| 160 | $log->save(); | 159 | $log->save(); |
| 161 | 160 | ||
| 162 | - Log::channel('inquiry_relay')->error('inquiry_relay v6 inquiry error', [$res, $detail['website'] . 'api/inquiryQd/', $data]); | 161 | + Log::channel('inquiry_relay')->error('inquiry_relay v6 inquiry error', [$res, $website . 'api/inquiryQd/', $data]); |
| 163 | return false; | 162 | return false; |
| 164 | } | 163 | } |
| 165 | }else{ | 164 | }else{ |
-
请 注册 或 登录 后发表评论