Merge remote-tracking branch 'origin/master' into akun
正在显示
16 个修改的文件
包含
122 行增加
和
44 行删除
| @@ -2,13 +2,9 @@ | @@ -2,13 +2,9 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Console\Commands\DayCount; | 3 | namespace App\Console\Commands\DayCount; |
| 4 | 4 | ||
| 5 | -use App\Helper\Common; | ||
| 6 | use App\Helper\FormGlobalsoApi; | 5 | use App\Helper\FormGlobalsoApi; |
| 7 | use App\Models\Domain\DomainInfo; | 6 | use App\Models\Domain\DomainInfo; |
| 8 | -use App\Models\Inquiry\InquiryForm; | ||
| 9 | use App\Models\Inquiry\InquiryFormData; | 7 | use App\Models\Inquiry\InquiryFormData; |
| 10 | -use App\Models\Project\DeployBuild; | ||
| 11 | -use App\Models\Project\DeployOptimize; | ||
| 12 | use App\Models\Project\Project; | 8 | use App\Models\Project\Project; |
| 13 | use App\Services\ProjectServer; | 9 | use App\Services\ProjectServer; |
| 14 | use Carbon\Carbon; | 10 | use Carbon\Carbon; |
| @@ -12,7 +12,6 @@ namespace App\Console\Commands\DayCount; | @@ -12,7 +12,6 @@ namespace App\Console\Commands\DayCount; | ||
| 12 | use App\Helper\FormGlobalsoApi; | 12 | use App\Helper\FormGlobalsoApi; |
| 13 | use App\Models\Inquiry\InquiryFormData; | 13 | use App\Models\Inquiry\InquiryFormData; |
| 14 | use App\Models\Project\Project; | 14 | use App\Models\Project\Project; |
| 15 | -use App\Models\Visit\Visit; | ||
| 16 | use App\Services\ProjectServer; | 15 | use App\Services\ProjectServer; |
| 17 | use Illuminate\Console\Command; | 16 | use Illuminate\Console\Command; |
| 18 | use Illuminate\Support\Facades\DB; | 17 | use Illuminate\Support\Facades\DB; |
| @@ -2,16 +2,11 @@ | @@ -2,16 +2,11 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Console\Commands\DayCount; | 3 | namespace App\Console\Commands\DayCount; |
| 4 | 4 | ||
| 5 | -use App\Helper\Common; | ||
| 6 | use App\Helper\FormGlobalsoApi; | 5 | use App\Helper\FormGlobalsoApi; |
| 7 | use App\Models\Domain\DomainInfo; | 6 | use App\Models\Domain\DomainInfo; |
| 8 | -use App\Models\Inquiry\InquiryForm; | ||
| 9 | use App\Models\Inquiry\InquiryFormData; | 7 | use App\Models\Inquiry\InquiryFormData; |
| 10 | -use App\Models\Project\DeployBuild; | ||
| 11 | -use App\Models\Project\DeployOptimize; | ||
| 12 | use App\Models\Project\Project; | 8 | use App\Models\Project\Project; |
| 13 | use App\Services\ProjectServer; | 9 | use App\Services\ProjectServer; |
| 14 | -use Carbon\Carbon; | ||
| 15 | use Illuminate\Console\Command; | 10 | use Illuminate\Console\Command; |
| 16 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
| 17 | use Illuminate\Support\Facades\Log; | 12 | use Illuminate\Support\Facades\Log; |
| @@ -14,7 +14,6 @@ use App\Models\Domain\DomainInfo; | @@ -14,7 +14,6 @@ use App\Models\Domain\DomainInfo; | ||
| 14 | use App\Models\Inquiry\InquiryFormData; | 14 | use App\Models\Inquiry\InquiryFormData; |
| 15 | use App\Models\Project\DeployOptimize; | 15 | use App\Models\Project\DeployOptimize; |
| 16 | use App\Models\Project\Project; | 16 | use App\Models\Project\Project; |
| 17 | -use App\Models\Visit\Visit; | ||
| 18 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 19 | use Illuminate\Console\Command; | 18 | use Illuminate\Console\Command; |
| 20 | use Illuminate\Support\Facades\DB; | 19 | use Illuminate\Support\Facades\DB; |
| @@ -61,9 +61,8 @@ class TemplateLog extends Command | @@ -61,9 +61,8 @@ class TemplateLog extends Command | ||
| 61 | * @time :2024/7/10 14:48 | 61 | * @time :2024/7/10 14:48 |
| 62 | */ | 62 | */ |
| 63 | public function deleteTemplate(){ | 63 | public function deleteTemplate(){ |
| 64 | - $startDate = date("Y-m-01 00:00:00"); | ||
| 65 | - $endDate = date("Y-m-t 23:59:59"); | 64 | + $date = date('Y-m-d H:i:s', strtotime('-30 days')); |
| 66 | $templateLogModel = new BTemplateLog(); | 65 | $templateLogModel = new BTemplateLog(); |
| 67 | - return $templateLogModel->del(['created_at'=>['not between'=>[$startDate,$endDate]]]); | 66 | + return $templateLogModel->del(['created_at'=>['<=',$date]]); |
| 68 | } | 67 | } |
| 69 | } | 68 | } |
| @@ -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 通过任务生成转发对象, 更具转发对象获取对应数据, 写入着陆记录 |
| @@ -326,6 +375,11 @@ class RelayInquiry extends Command | @@ -326,6 +375,11 @@ class RelayInquiry extends Command | ||
| 326 | $pre = 0; | 375 | $pre = 0; |
| 327 | $start_time = time(); | 376 | $start_time = time(); |
| 328 | $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始 | 377 | $seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始 |
| 378 | + $exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first(); | ||
| 379 | + if($exists){ | ||
| 380 | + $this->output('转发站点邮件已存在'); | ||
| 381 | + continue; | ||
| 382 | + } | ||
| 329 | // 写入推送详情 | 383 | // 写入推送详情 |
| 330 | $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $form->phone, $message, $message_id, $device_port, | 384 | $re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $form->phone, $message, $message_id, $device_port, |
| 331 | $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds)); | 385 | $user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds)); |
| @@ -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{ |
| @@ -93,7 +93,10 @@ class ReplaceHtml extends Command | @@ -93,7 +93,10 @@ class ReplaceHtml extends Command | ||
| 93 | public function createReplacePageHtmlLog($info){ | 93 | public function createReplacePageHtmlLog($info){ |
| 94 | $saveData = []; | 94 | $saveData = []; |
| 95 | $customTemplateModel = new BCustomTemplate(); | 95 | $customTemplateModel = new BCustomTemplate(); |
| 96 | - $list = $customTemplateModel->list(['status'=>BCustomTemplate::STATUS_ACTIVE]); | 96 | + $list = $customTemplateModel->list(['status'=>BCustomTemplate::STATUS_ACTIVE,'html'=>['like','%'.trim($info['old_html']).'%']]); |
| 97 | + if(empty($list)){ | ||
| 98 | + return 0; | ||
| 99 | + } | ||
| 97 | foreach ($list as $v){ | 100 | foreach ($list as $v){ |
| 98 | $saveData[] = [ | 101 | $saveData[] = [ |
| 99 | 'replace_id'=>$info['id'], | 102 | 'replace_id'=>$info['id'], |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\ReplaceHtml; | 10 | namespace App\Console\Commands\ReplaceHtml; |
| 11 | 11 | ||
| 12 | +use App\Models\Template\BCustomTemplate; | ||
| 12 | use App\Models\Template\BTemplate; | 13 | use App\Models\Template\BTemplate; |
| 13 | use App\Models\Template\TemplateReplaceHtml; | 14 | use App\Models\Template\TemplateReplaceHtml; |
| 14 | use App\Models\Template\TemplateReplaceHtmlLog; | 15 | use App\Models\Template\TemplateReplaceHtmlLog; |
| @@ -87,12 +88,20 @@ class ReplaceHtmlLog extends Command | @@ -87,12 +88,20 @@ class ReplaceHtmlLog extends Command | ||
| 87 | if($info['template_id'] == 0){ | 88 | if($info['template_id'] == 0){ |
| 88 | $bTemplateModel->formatQuery($condition)->update(['html' => DB::raw("REPLACE(html, '$old_html', '$html')")]); | 89 | $bTemplateModel->formatQuery($condition)->update(['html' => DB::raw("REPLACE(html, '$old_html', '$html')")]); |
| 89 | }else{ | 90 | }else{ |
| 91 | + if($info['source'] == 9 && $info['is_custom'] == 0){ | ||
| 92 | + (new BCustomTemplate())->formatQuery(['id'=>$source_id]) | ||
| 93 | + ->update([ | ||
| 94 | + 'html' => DB::raw("REPLACE(html, '" . addslashes($old_html) . "', '" . addslashes($html) . "')"), | ||
| 95 | + 'updated_at' => now(), | ||
| 96 | + ]); | ||
| 97 | + }else{ | ||
| 90 | $bTemplateModel->where($condition) | 98 | $bTemplateModel->where($condition) |
| 91 | ->update([ | 99 | ->update([ |
| 92 | 'main_html' => DB::raw("REPLACE(main_html, '" . addslashes($old_html) . "', '" . addslashes($html) . "')"), | 100 | 'main_html' => DB::raw("REPLACE(main_html, '" . addslashes($old_html) . "', '" . addslashes($html) . "')"), |
| 93 | 'updated_at' => now(), | 101 | 'updated_at' => now(), |
| 94 | ]); | 102 | ]); |
| 95 | } | 103 | } |
| 104 | + } | ||
| 96 | return true; | 105 | return true; |
| 97 | } | 106 | } |
| 98 | 107 |
| @@ -37,6 +37,10 @@ class WorkchatMessageSend extends Command | @@ -37,6 +37,10 @@ class WorkchatMessageSend extends Command | ||
| 37 | foreach ($tasks as $task) { | 37 | foreach ($tasks as $task) { |
| 38 | $this->output('开始推送消息' . $task->id); | 38 | $this->output('开始推送消息' . $task->id); |
| 39 | try { | 39 | try { |
| 40 | + //超过两小时 不推送了 | ||
| 41 | + if(time() - $task->send_time > 7200){ | ||
| 42 | + throw new \Exception('超时两小时未推送'); | ||
| 43 | + } | ||
| 40 | ProjectAssociationServices::getInstance()->sendMessage($task->friend_id, $task->content, $task->content_type); | 44 | ProjectAssociationServices::getInstance()->sendMessage($task->friend_id, $task->content, $task->content_type); |
| 41 | $this->output('推送消息' . $task->id . '成功'); | 45 | $this->output('推送消息' . $task->id . '成功'); |
| 42 | $task->status = MessagePush::STATUS_SUCCESS; | 46 | $task->status = MessagePush::STATUS_SUCCESS; |
| @@ -20,14 +20,14 @@ class Kernel extends ConsoleKernel | @@ -20,14 +20,14 @@ class Kernel extends ConsoleKernel | ||
| 20 | $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 | 20 | $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 |
| 21 | $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 | 21 | $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 |
| 22 | // $schedule->command('inspire')->hourly(); | 22 | // $schedule->command('inspire')->hourly(); |
| 23 | - $schedule->command('remain_day')->dailyAt('09:30')->withoutOverlapping(1); // 项目剩余服务时长 | 23 | +// $schedule->command('remain_day')->dailyAt('09:30')->withoutOverlapping(1); // 项目剩余服务时长 |
| 24 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 | 24 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 |
| 25 | $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 | 25 | $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 |
| 26 | - $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 | ||
| 27 | - $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 | 26 | +// $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 |
| 27 | +// $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 | ||
| 28 | $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 | 28 | $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 |
| 29 | $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 | 29 | $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 |
| 30 | - $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 | 30 | +// $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 |
| 31 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 | 31 | $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 |
| 32 | // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 | 32 | // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 |
| 33 | $schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次 | 33 | $schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次 |
| @@ -37,8 +37,6 @@ class Kernel extends ConsoleKernel | @@ -37,8 +37,6 @@ class Kernel extends ConsoleKernel | ||
| 37 | $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 | 37 | $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 |
| 38 | $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 | 38 | $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 |
| 39 | $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); | 39 | $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); |
| 40 | - // 每月15号执行任务 | ||
| 41 | - $schedule->command('delete_template_log')->monthlyOn(15, '00:01')->withoutOverlapping(); | ||
| 42 | // 每日推送已完成视频任务项目生成对应界面 | 40 | // 每日推送已完成视频任务项目生成对应界面 |
| 43 | //更新AI站点数据 | 41 | //更新AI站点数据 |
| 44 | $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); | 42 | $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); |
| @@ -34,14 +34,23 @@ class AdsController extends BaseController | @@ -34,14 +34,23 @@ class AdsController extends BaseController | ||
| 34 | */ | 34 | */ |
| 35 | public function fbAdsList(Request $request) | 35 | public function fbAdsList(Request $request) |
| 36 | { | 36 | { |
| 37 | - $ads_id = trim($request->input('ads_id')); | 37 | + $title = trim($request->input('title')); |
| 38 | $industry = trim($request->input('industry')); | 38 | $industry = trim($request->input('industry')); |
| 39 | - $result = ReInquiryTask::where(['status' => ReInquiryTask::STATUS_OPEN]) | ||
| 40 | - ->when($ads_id, function ($query, $ads_id) { | 39 | + $ad_id = trim($request->input('ad_id')); |
| 40 | + $status = $request->input('status', ''); | ||
| 41 | + $result = ReInquiryTask::when($ad_id, function ($query, $ads_id) { | ||
| 41 | return $query->where('ad_id', 'like', '%' . $ads_id . '%'); | 42 | return $query->where('ad_id', 'like', '%' . $ads_id . '%'); |
| 42 | }) | 43 | }) |
| 44 | + ->when($title, function ($query, $title) { | ||
| 45 | + return $query->where('title', 'like', '%' . $title . '%'); | ||
| 46 | + }) | ||
| 43 | ->when($industry, function ($query, $industry) { | 47 | ->when($industry, function ($query, $industry) { |
| 44 | - return $query->where('industry', $industry); | 48 | + return $query->where('industry', 'like', '%' . $industry . '%'); |
| 49 | + }) | ||
| 50 | + ->where(function ($query)use($status) { | ||
| 51 | + if(is_numeric($status)){ | ||
| 52 | + return $query->where('status', $status); | ||
| 53 | + } | ||
| 45 | }) | 54 | }) |
| 46 | ->orderBy('id', 'desc') | 55 | ->orderBy('id', 'desc') |
| 47 | ->paginate(); | 56 | ->paginate(); |
| @@ -43,7 +43,6 @@ class RankDataLogic extends BaseLogic | @@ -43,7 +43,6 @@ class RankDataLogic extends BaseLogic | ||
| 43 | public function index() | 43 | public function index() |
| 44 | { | 44 | { |
| 45 | $project_id = $this->user['project_id']; | 45 | $project_id = $this->user['project_id']; |
| 46 | - | ||
| 47 | //查数据 | 46 | //查数据 |
| 48 | $project = (new ProjectLogic())->getProjectInfo($project_id); | 47 | $project = (new ProjectLogic())->getProjectInfo($project_id); |
| 49 | $domain_info = (new DomainInfoLogic)->getDomainInfo($project_id); | 48 | $domain_info = (new DomainInfoLogic)->getDomainInfo($project_id); |
| @@ -87,6 +86,9 @@ class RankDataLogic extends BaseLogic | @@ -87,6 +86,9 @@ class RankDataLogic extends BaseLogic | ||
| 87 | //小语种列表 | 86 | //小语种列表 |
| 88 | $quanqiusou_api = new QuanqiusouApi(); | 87 | $quanqiusou_api = new QuanqiusouApi(); |
| 89 | $lang_data = $quanqiusou_api->getLangRankData($api_no); | 88 | $lang_data = $quanqiusou_api->getLangRankData($api_no); |
| 89 | + if(empty($lang_data)){ | ||
| 90 | + $data['langs_status'] = 1; | ||
| 91 | + } | ||
| 90 | $lang_data = Arr::setValueToKey($lang_data, 'language'); | 92 | $lang_data = Arr::setValueToKey($lang_data, 'language'); |
| 91 | $data['langs'] = []; | 93 | $data['langs'] = []; |
| 92 | $languageModel = new MinorLanguages(); | 94 | $languageModel = new MinorLanguages(); |
| @@ -131,7 +133,14 @@ class RankDataLogic extends BaseLogic | @@ -131,7 +133,14 @@ class RankDataLogic extends BaseLogic | ||
| 131 | 'Robots.txt文件优化', | 133 | 'Robots.txt文件优化', |
| 132 | 'Google站长工具优化设置' | 134 | 'Google站长工具优化设置' |
| 133 | ]; | 135 | ]; |
| 134 | - | 136 | + if($project['type'] == 3){ |
| 137 | + $data['seo'] = [ | ||
| 138 | + 'H1,H2,H3标签', | ||
| 139 | + 'TDK设置(Title, Description, Keywords)', | ||
| 140 | + 'Sitemap.xml Google站长地图', | ||
| 141 | + 'Robots.txt文件优化', | ||
| 142 | + ]; | ||
| 143 | + } | ||
| 135 | //外链引荐域名 | 144 | //外链引荐域名 |
| 136 | $recomm_domain = $recomm_domain ? $recomm_domain->toArray() : []; | 145 | $recomm_domain = $recomm_domain ? $recomm_domain->toArray() : []; |
| 137 | $recomm_domain['data'] = Collection::make($recomm_domain['data'] ?? [])->sortBy('backlinks_num')->all(); | 146 | $recomm_domain['data'] = Collection::make($recomm_domain['data'] ?? [])->sortBy('backlinks_num')->all(); |
| @@ -381,6 +390,7 @@ class RankDataLogic extends BaseLogic | @@ -381,6 +390,7 @@ class RankDataLogic extends BaseLogic | ||
| 381 | public function syncRankData($api_no, $site_res, $force=false){ | 390 | public function syncRankData($api_no, $site_res, $force=false){ |
| 382 | $project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id'); | 391 | $project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id'); |
| 383 | foreach ($project_ids as $project_id) { | 392 | foreach ($project_ids as $project_id) { |
| 393 | + Log::channel('rank_data')->info('开始查项目:' . $project_id); | ||
| 384 | $project = Project::find($project_id); | 394 | $project = Project::find($project_id); |
| 385 | if (!$project) { | 395 | if (!$project) { |
| 386 | throw new \Exception($api_no . '关联的项目不存在'); | 396 | throw new \Exception($api_no . '关联的项目不存在'); |
| @@ -388,12 +398,14 @@ class RankDataLogic extends BaseLogic | @@ -388,12 +398,14 @@ class RankDataLogic extends BaseLogic | ||
| 388 | $api = new QuanqiusouApi(); | 398 | $api = new QuanqiusouApi(); |
| 389 | $model = RankData::where('project_id', $project_id)->where('lang', '')->first(); | 399 | $model = RankData::where('project_id', $project_id)->where('lang', '')->first(); |
| 390 | if (!$model || $model->updated_date != date('Y-m-d') || $force) { | 400 | if (!$model || $model->updated_date != date('Y-m-d') || $force) { |
| 401 | + Log::channel('rank_data')->info('开始接口数据:' . $project_id); | ||
| 391 | $res = $api->getGoogleRank($project_id, $api_no, '', 7, $force); | 402 | $res = $api->getGoogleRank($project_id, $api_no, '', 7, $force); |
| 392 | if (!$res) { | 403 | if (!$res) { |
| 393 | throw new \Exception("接口数据获取失败,api_no:{$api_no}"); | 404 | throw new \Exception("接口数据获取失败,api_no:{$api_no}"); |
| 394 | } | 405 | } |
| 395 | //收录数 | 406 | //收录数 |
| 396 | $indexed_pages_num = $site_res[$api_no] ?? 0; | 407 | $indexed_pages_num = $site_res[$api_no] ?? 0; |
| 408 | + Log::channel('rank_data')->info('开始保存:' . $project_id); | ||
| 397 | $this->save_rank($project_id, $res, $indexed_pages_num); | 409 | $this->save_rank($project_id, $res, $indexed_pages_num); |
| 398 | } | 410 | } |
| 399 | //有小语种的 | 411 | //有小语种的 |
| @@ -51,7 +51,7 @@ class InquiryFormData extends Base | @@ -51,7 +51,7 @@ class InquiryFormData extends Base | ||
| 51 | //5分钟内是否有重复数据 | 51 | //5分钟内是否有重复数据 |
| 52 | $is_exist = self::where('sign', $sign)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-5 minute')))->first(); | 52 | $is_exist = self::where('sign', $sign)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-5 minute')))->first(); |
| 53 | if($is_exist){ | 53 | if($is_exist){ |
| 54 | - return true; | 54 | + return 0; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | $model = new self(); | 57 | $model = new self(); |
| @@ -63,10 +63,10 @@ class MessagePush extends Base | @@ -63,10 +63,10 @@ class MessagePush extends Base | ||
| 63 | $model->type = self::TYPE_INQUIRY; | 63 | $model->type = self::TYPE_INQUIRY; |
| 64 | $model->ref_ids = $id; | 64 | $model->ref_ids = $id; |
| 65 | $model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!'; | 65 | $model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!'; |
| 66 | + $model->send_time = $submit_at; | ||
| 66 | }else{ | 67 | }else{ |
| 67 | //定时发送时间 | 68 | //定时发送时间 |
| 68 | - $send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime('+1 day')) : date('Y-m-d 09:00:00'); | ||
| 69 | - | 69 | + $send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime($submit_at . '+1 day')) : date('Y-m-d 09:00:00', strtotime($submit_at)); |
| 70 | $model = self::where('project_id', $project_id)->where('type', self::TYPE_INQUIRY)->where('send_time', $send_time)->first(); | 70 | $model = self::where('project_id', $project_id)->where('type', self::TYPE_INQUIRY)->where('send_time', $send_time)->first(); |
| 71 | if(!$model){ | 71 | if(!$model){ |
| 72 | $model = new self(); | 72 | $model = new self(); |
| @@ -159,13 +159,14 @@ class SyncSubmitTaskService | @@ -159,13 +159,14 @@ class SyncSubmitTaskService | ||
| 159 | Visit::isInquiry($data['ip']); | 159 | Visit::isInquiry($data['ip']); |
| 160 | 160 | ||
| 161 | //推送企微消息 | 161 | //推送企微消息 |
| 162 | + if($id){ | ||
| 162 | try { | 163 | try { |
| 163 | $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name']; | 164 | $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name']; |
| 164 | MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']); | 165 | MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']); |
| 165 | }catch (\Exception $e){ | 166 | }catch (\Exception $e){ |
| 166 | LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); | 167 | LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); |
| 167 | } | 168 | } |
| 168 | - | 169 | + } |
| 169 | 170 | ||
| 170 | return true; | 171 | return true; |
| 171 | } | 172 | } |
| @@ -189,6 +190,7 @@ class SyncSubmitTaskService | @@ -189,6 +190,7 @@ class SyncSubmitTaskService | ||
| 189 | $referrer_url = $url_arr['scheme'] . '://' . $url_arr['host'] . '/'; | 190 | $referrer_url = $url_arr['scheme'] . '://' . $url_arr['host'] . '/'; |
| 190 | } | 191 | } |
| 191 | } | 192 | } |
| 193 | + | ||
| 192 | $visit_data['referrer_url'] = $this->handle_referer($referrer_url); | 194 | $visit_data['referrer_url'] = $this->handle_referer($referrer_url); |
| 193 | $visit_data['device_port'] = $data['data']['device_port']??''; | 195 | $visit_data['device_port'] = $data['data']['device_port']??''; |
| 194 | $visit_data['url'] = $data['data']['url']??''; | 196 | $visit_data['url'] = $data['data']['url']??''; |
| @@ -201,7 +203,7 @@ class SyncSubmitTaskService | @@ -201,7 +203,7 @@ class SyncSubmitTaskService | ||
| 201 | if(!empty($data['is_cf'])){ | 203 | if(!empty($data['is_cf'])){ |
| 202 | $visit_data['is_inquiry'] = 1; | 204 | $visit_data['is_inquiry'] = 1; |
| 203 | } | 205 | } |
| 204 | - Visit::saveData($visit_data, $date); | 206 | + Visit::saveData($visit_data, $visit_data['updated_date']); |
| 205 | 207 | ||
| 206 | return true; | 208 | return true; |
| 207 | } | 209 | } |
-
请 注册 或 登录 后发表评论