作者 Your Name
@@ -38,7 +38,6 @@ class SyncFile extends Command @@ -38,7 +38,6 @@ class SyncFile extends Command
38 echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; 38 echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
39 $errorFileModel->edit(['status'=>1],['id'=>$v['id']]); 39 $errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
40 } 40 }
41 - gc_collect_cycles();  
42 } 41 }
43 echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL; 42 echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
44 return true; 43 return true;
  1 +<?php
  2 +
  3 +namespace App\Console\Commands\Sync;
  4 +
  5 +
  6 +use App\Exceptions\InquiryFilterException;
  7 +use App\Models\Project\Project;
  8 +use App\Models\SyncSubmitTask\SyncSubmitTaskZbj as SyncSubmitTaskModel;
  9 +use App\Services\SyncSubmitTaskService;
  10 +use Illuminate\Console\Command;
  11 +use Illuminate\Support\Facades\DB;
  12 +use Illuminate\Support\Facades\Redis;
  13 +use Illuminate\Support\Facades\Schema;
  14 +use Illuminate\Support\Str;
  15 +
  16 +/**
  17 + *
  18 + * Class SyncSubmitTask
  19 + * @package App\Console\Commands
  20 + * @author zbj
  21 + * @date 2023/11/28
  22 + */
  23 +class SyncSubmitTaskZbj extends Command
  24 +{
  25 +
  26 + protected $signature = 'sync_submit_task_zbj';
  27 + protected $description = '询盘、访问异步任务';
  28 +
  29 + public function handle()
  30 + {
  31 + $backup = false;
  32 + while (true) {
  33 + $task_id = $this->getTaskId();
  34 + if ($task_id > 2000000) {
  35 + $backup = true;
  36 + }
  37 + if (empty($task_id)) {
  38 + if ($backup) {
  39 + $this->backup();
  40 + $backup = false;
  41 + }
  42 + sleep(5);
  43 + continue;
  44 + }
  45 + $this->output('任务' . $task_id . '开始');
  46 + $task_info = SyncSubmitTaskModel::find($task_id);
  47 + if (empty($task_info) || $task_info->status != 3) {
  48 + $this->output('任务不存在或者已执行');
  49 + continue;
  50 + }
  51 + try {
  52 + $project = Project::getProjectByDomain($task_info['data']['domain'] ?? '');
  53 + $task_info->project_id = $project->id;
  54 +
  55 + SyncSubmitTaskService::handler($task_info, $task_info->created_at);
  56 + $task_info->status = 1;
  57 + $task_info->save();
  58 +
  59 + $this->output('任务完成');
  60 + } catch (InquiryFilterException $e) {
  61 + $task_info->status = 1;
  62 + $task_info->is_filtered = 1;
  63 + $task_info->remark = $e->getMessage();
  64 + $task_info->save();
  65 +
  66 + $this->output('任务完成');
  67 + } catch (\Exception $e) {
  68 + $task_info->retry = $task_info->retry + 1;
  69 + if ($task_info->retry >= 3) {
  70 + $task_info->status = 2;
  71 + $task_info->remark = Str::substr($e->getMessage(), 0, 200);
  72 + } else {
  73 + Redis::lpush('sync_submit_task_zbj', $task_id);
  74 + }
  75 + $task_info->save();
  76 +
  77 + $this->output('任务失败:' . $e->getMessage());
  78 + }
  79 + }
  80 + }
  81 +
  82 + public function getTaskId()
  83 + {
  84 + $task_id = Redis::rpop('sync_submit_task_zbj');
  85 + if (empty($task_id)) {
  86 + $ids = SyncSubmitTaskModel::where('status', 3)->limit(100)->pluck('id');
  87 + foreach ($ids as $id) {
  88 + Redis::lpush('sync_submit_task_zbj', $id);
  89 + }
  90 + $task_id = Redis::rpop('sync_submit_task_zbj');
  91 + }
  92 + return $task_id;
  93 + }
  94 +
  95 + /**
  96 + * 输出处理日志
  97 + */
  98 + public function output($message): bool
  99 + {
  100 + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
  101 + return true;
  102 + }
  103 +
  104 + /**
  105 + * 备份数据
  106 + * @author zbj
  107 + * @date 2024/1/23
  108 + */
  109 + public function backup()
  110 + {
  111 + DB::beginTransaction();
  112 + try {
  113 + $table = (new SyncSubmitTaskModel())->getTable();
  114 + $new_table = $table . '_backup_' . date('Ymd');
  115 +
  116 + //重命名当前表
  117 + Schema::rename($table, $new_table);
  118 + //克隆表数据
  119 + DB::statement('CREATE TABLE ' . $table . ' LIKE ' . $new_table);
  120 +
  121 + DB::commit();
  122 +
  123 + $this->output('数据备份成功');
  124 + } catch (\Exception $e) {
  125 + $this->output('数据备份失败' . $e->getMessage());
  126 + DB::rollBack();
  127 + }
  128 + return true;
  129 + }
  130 +}
@@ -10,11 +10,16 @@ use App\Models\HomeCount\Count; @@ -10,11 +10,16 @@ use App\Models\HomeCount\Count;
10 use App\Models\Inquiry\InquiryFormData; 10 use App\Models\Inquiry\InquiryFormData;
11 use App\Models\Nav\BNav; 11 use App\Models\Nav\BNav;
12 use App\Models\Nav\BNavGroup; 12 use App\Models\Nav\BNavGroup;
  13 +use App\Models\Project\OnlineCheck;
13 use App\Models\Project\Project; 14 use App\Models\Project\Project;
14 use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel; 15 use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
15 use App\Models\WebSetting\Translate as TranslateModel; 16 use App\Models\WebSetting\Translate as TranslateModel;
  17 +use App\Models\WebSetting\WebLanguage;
16 use App\Services\ProjectServer; 18 use App\Services\ProjectServer;
  19 +use Carbon\Carbon;
17 use Illuminate\Console\Command; 20 use Illuminate\Console\Command;
  21 +use Illuminate\Support\Facades\DB;
  22 +use Illuminate\Support\Facades\Redis;
18 23
19 /** 24 /**
20 * Class Test 25 * Class Test
@@ -53,6 +58,19 @@ class Test extends Command @@ -53,6 +58,19 @@ class Test extends Command
53 */ 58 */
54 public function handle() 59 public function handle()
55 { 60 {
  61 + $date = '2024-05-16';
  62 + $list = $this->getProjectList();
  63 + foreach ($list as $item){
  64 + ProjectServer::useProject($item['project_id']);
  65 + //pv统计
  66 + $pv_num = $this->pv_num($date);
  67 + //ip统计
  68 + $ip_num = $this->ip_num($date);
  69 +
  70 + echo $item['project_id'] . ',pv:' . $pv_num . ',ip:' . $ip_num . PHP_EOL;
  71 + }
  72 + exit;
  73 +
56 74
57 $i=0; 75 $i=0;
58 while (true){ 76 while (true){
@@ -167,4 +185,78 @@ class Test extends Command @@ -167,4 +185,78 @@ class Test extends Command
167 $arr['country'] = json_encode($top20); 185 $arr['country'] = json_encode($top20);
168 return $arr; 186 return $arr;
169 } 187 }
  188 +
  189 + protected function getProjectList($type = 1){
  190 + $ru_lang_id = WebLanguage::getIdByLang('ru');
  191 +
  192 + //推广项目
  193 + $list = Project::with('domainInfo')
  194 + ->leftJoin('gl_project_deploy_optimize as pdo', 'pdo.project_id', '=', 'gl_project.id')
  195 + ->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
  196 + ->where('pdo.domain', '>', 0)
  197 + ->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
  198 + ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
  199 + ->where('gl_project.is_upgrade', 0) //非升级项目
  200 + ->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
  201 + ->where(function ($query) use ($type) {
  202 + if($type == 1){
  203 + //1-3个月项目
  204 + $startTime = Carbon::now()->addMonths(-4)->toDateString();
  205 + $endTime = Carbon::now()->addMonths(-1)->toDateString();
  206 + $query->whereBetween('pdo.start_date', [$startTime,$endTime]);
  207 + }elseif($type == 2){
  208 + //4-8个月项目
  209 + $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
  210 + $endTime = Carbon::now()->addMonths(-4)->endOfDay()->toDateTimeString();
  211 + $query->whereBetween('pdo.start_date', [$startTime,$endTime]);
  212 + }else{
  213 + //大于9个月项目
  214 + $startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
  215 + $query->where('pdo.start_date', '<', $startTime);
  216 + }
  217 + })->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])
  218 + ->orderBy('project_id')
  219 + ->get();
  220 + //其他地方在引流的域名
  221 + $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
  222 + $data = [];
  223 + foreach ($list as $project) {
  224 + $lang = WebLanguage::getLangById($project['main_lang_id']??1)['short'];
  225 + if(empty($project->domainInfo['domain'])){
  226 + continue;
  227 + }
  228 + //其他地方在引流就不再引流了
  229 + if(in_array($project->domainInfo['domain'], $other)){
  230 + continue;
  231 + }
  232 + $data[] = [
  233 + 'project_id' => $project['project_id'],
  234 + 'domain' => 'https://' . $project->domainInfo['domain'] . '/',
  235 + 'lang' => $lang
  236 + ];
  237 + }
  238 + return $data;
  239 + }
  240 + /**
  241 + * @name :(统计pv)pv_num
  242 + * @author :lyh
  243 + * @method :post
  244 + * @time :2023/6/14 15:40
  245 + */
  246 + public function pv_num($yesterday){
  247 + $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->where('updated_date', $yesterday)->count();
  248 + return $pv;
  249 + }
  250 +
  251 + /**
  252 + * @name :(统计ip)ip_num
  253 + * @author :lyh
  254 + * @method :post
  255 + * @time :2023/6/14 15:40
  256 + */
  257 + public function ip_num($yesterday)
  258 + {
  259 + $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->where('updated_date', $yesterday)->count();
  260 + return $ip;
  261 + }
170 } 262 }
@@ -21,6 +21,7 @@ use Illuminate\Console\Command; @@ -21,6 +21,7 @@ use Illuminate\Console\Command;
21 use Illuminate\Database\Eloquent\Model; 21 use Illuminate\Database\Eloquent\Model;
22 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
23 use Illuminate\Support\Facades\Log; 23 use Illuminate\Support\Facades\Log;
  24 +use Illuminate\Support\Facades\Redis;
24 use Illuminate\Support\Str; 25 use Illuminate\Support\Str;
25 26
26 /** 27 /**
@@ -172,22 +173,32 @@ class WebTrafficFix extends Command @@ -172,22 +173,32 @@ class WebTrafficFix extends Command
172 $date = $this->argument('date'); 173 $date = $this->argument('date');
173 $need_num = $this->argument('need_num'); 174 $need_num = $this->argument('need_num');
174 175
175 - $project_list = $this->getProjectList($type); 176 + // $project_list = $this->getProjectList($type);
  177 + // exit;
  178 + while (true) {
176 179
  180 +
  181 + $project = Redis::rpop('web_traffic_fix');
  182 + if(empty($project)){
  183 +
  184 + break;
  185 + }
  186 + $project_list = [json_decode($project, true)];
177 foreach ($project_list as $project) { 187 foreach ($project_list as $project) {
178 ProjectServer::useProject($project['project_id']); 188 ProjectServer::useProject($project['project_id']);
179 - if($project['project_id'] <= 135){  
180 - continue;  
181 - } 189 + // if($project['project_id'] <= 135){
  190 + // continue;
  191 + // }
182 echo 'project_id:' . $project['project_id'] . PHP_EOL; 192 echo 'project_id:' . $project['project_id'] . PHP_EOL;
183 Log::info('web_traffic_fix project_id:' . $project['project_id']); 193 Log::info('web_traffic_fix project_id:' . $project['project_id']);
184 - $ip_num = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $date)->count();  
185 - if($ip_num >= 30){ 194 + $ip_num = DB::connection('custom_mysql')->table('gl_customer_visit')->where('updated_date', $date)->count();
  195 + if ($ip_num >= 30) {
  196 + echo $ip_num . PHP_EOL;
186 continue; 197 continue;
187 } 198 }
188 199
189 $randomTime = []; 200 $randomTime = [];
190 - for ($i=0;$i<$need_num-$ip_num;$i++){ 201 + for ($i = 0; $i < $need_num - $ip_num; $i++) {
191 $randomTime[] = Carbon::make($date)->addSeconds(rand(0, 86400))->toDateTimeString(); 202 $randomTime[] = Carbon::make($date)->addSeconds(rand(0, 86400))->toDateTimeString();
192 } 203 }
193 sort($randomTime); 204 sort($randomTime);
@@ -195,7 +206,8 @@ class WebTrafficFix extends Command @@ -195,7 +206,8 @@ class WebTrafficFix extends Command
195 $project_urls = $this->getProductUrls($project['project_id']); 206 $project_urls = $this->getProductUrls($project['project_id']);
196 $project_urls['home'] = $project['domain']; 207 $project_urls['home'] = $project['domain'];
197 208
198 - foreach ($randomTime as $time){ 209 + $data = [];
  210 + foreach ($randomTime as $time) {
199 //随机引流间隔 211 //随机引流间隔
200 $res_sjjg = $this->get_rand($this->sjjg); 212 $res_sjjg = $this->get_rand($this->sjjg);
201 if ($res_sjjg == 1) { 213 if ($res_sjjg == 1) {
@@ -207,10 +219,9 @@ class WebTrafficFix extends Command @@ -207,10 +219,9 @@ class WebTrafficFix extends Command
207 //随机客户端 219 //随机客户端
208 $project['device_port'] = $this->get_rand($this->yddzb); 220 $project['device_port'] = $this->get_rand($this->yddzb);
209 $project['user_agent'] = $project['device_port'] == 1 ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua); 221 $project['user_agent'] = $project['device_port'] == 1 ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
210 - 222 + $a = time();
211 $project['ip'] = $this->getIpAreas([$project['project_id']], $time)[0] ?? ''; 223 $project['ip'] = $this->getIpAreas([$project['project_id']], $time)[0] ?? '';
212 -  
213 - foreach ($project['visit_urls'] as $url){ 224 + foreach ($project['visit_urls'] as $url) {
214 $time = Carbon::make($time)->addSeconds(rand(2, 15))->toDateTimeString(); 225 $time = Carbon::make($time)->addSeconds(rand(2, 15))->toDateTimeString();
215 $url_array = parse_url($project['domain']); 226 $url_array = parse_url($project['domain']);
216 $referrer_url = $this->getReferer($project['ip']['ip_area'], $project['lang']); 227 $referrer_url = $this->getReferer($project['ip']['ip_area'], $project['lang']);
@@ -226,14 +237,19 @@ class WebTrafficFix extends Command @@ -226,14 +237,19 @@ class WebTrafficFix extends Command
226 'referrer_url' => $referrer_url 237 'referrer_url' => $referrer_url
227 ], 238 ],
228 ]; 239 ];
229 - $task = new SyncSubmitTask();  
230 - $task->data = json_encode($array);  
231 - $task->type = SyncSubmitTask::TYPE_VISIT;  
232 - $task->created_at = $time;  
233 - $task->status = 3;  
234 - $task->traffic = 1;  
235 - $task->save(); 240 + $data[] = [
  241 + 'data' => json_encode($array),
  242 + 'type' => SyncSubmitTask::TYPE_VISIT,
  243 + 'created_at' => $time,
  244 + 'updated_at' => $time,
  245 + 'status' => 3,
  246 + 'traffic' => 1,
  247 + 'project_id' => $project['project_id'],
  248 + ];
  249 + }
  250 +
236 } 251 }
  252 + DB::table('gl_sync_submit_task_20240516')->insert($data);
237 } 253 }
238 } 254 }
239 Log::info('web_traffic_fix finish'); 255 Log::info('web_traffic_fix finish');
@@ -279,7 +295,7 @@ class WebTrafficFix extends Command @@ -279,7 +295,7 @@ class WebTrafficFix extends Command
279 ->get(); 295 ->get();
280 //其他地方在引流的域名 296 //其他地方在引流的域名
281 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray(); 297 $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
282 - $data = []; 298 +
283 foreach ($list as $project) { 299 foreach ($list as $project) {
284 $lang = WebLanguage::getLangById($project['main_lang_id']??1)['short']; 300 $lang = WebLanguage::getLangById($project['main_lang_id']??1)['short'];
285 if(empty($project->domainInfo['domain'])){ 301 if(empty($project->domainInfo['domain'])){
@@ -289,13 +305,15 @@ class WebTrafficFix extends Command @@ -289,13 +305,15 @@ class WebTrafficFix extends Command
289 if(in_array($project->domainInfo['domain'], $other)){ 305 if(in_array($project->domainInfo['domain'], $other)){
290 continue; 306 continue;
291 } 307 }
292 - $data[] = [ 308 + $data = [
293 'project_id' => $project['project_id'], 309 'project_id' => $project['project_id'],
294 'domain' => 'https://' . $project->domainInfo['domain'] . '/', 310 'domain' => 'https://' . $project->domainInfo['domain'] . '/',
295 'lang' => $lang 311 'lang' => $lang
296 ]; 312 ];
  313 +
  314 + Redis::lpush('web_traffic_fix', json_encode($data));
297 } 315 }
298 - return $data; 316 + return true;
299 } 317 }
300 318
301 /** 319 /**
@@ -355,19 +373,26 @@ class WebTrafficFix extends Command @@ -355,19 +373,26 @@ class WebTrafficFix extends Command
355 $main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : []; 373 $main_countries = !empty($config->main_countries) ? explode(',',$config->main_countries) : [];
356 $filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : []; 374 $filter_countries = !empty($config->filter_countries) ? explode(',',$config->filter_countries) : [];
357 375
358 - //根据地区随机取该地区的IP  
359 - $ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)  
360 - ->where(function ($query) use ($main_countries, $filter_countries){  
361 if($main_countries){ 376 if($main_countries){
362 - $query->whereIn('ip_area', $main_countries); 377 + $areas = $main_countries;
363 } 378 }
  379 +
364 if($filter_countries){ 380 if($filter_countries){
365 - $query->whereNotIn('ip_area', $main_countries); 381 + $areas2 = [];
  382 + foreach ($areas as $v){
  383 + if(!in_array($v, $filter_countries)){
  384 + $areas2[] = $v;
  385 + }
  386 + }
  387 + $areas = $areas2;
366 } 388 }
367 - })->inRandomOrder()->first(); 389 +
  390 + //根据地区随机取该地区的IP
  391 + $ipdata = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)->inRandomOrder()->first();
368 if(!$ipdata){ 392 if(!$ipdata){
369 continue; 393 continue;
370 } 394 }
  395 +
371 $ipdata = (array)$ipdata ?: []; 396 $ipdata = (array)$ipdata ?: [];
372 $ipdata['diff'] = $time_zones[$ipdata['ip_area']]; 397 $ipdata['diff'] = $time_zones[$ipdata['ip_area']];
373 $data[] = $ipdata; 398 $data[] = $ipdata;
  1 +<?php
  2 +
  3 +namespace App\Models\SyncSubmitTask;
  4 +
  5 +use Illuminate\Database\Eloquent\Model;
  6 +use Illuminate\Support\Facades\Log;
  7 +use Illuminate\Support\Facades\Redis;
  8 +
  9 +/**
  10 + * @method static where(string $string, mixed $ip)
  11 + * @method static create(array $data)
  12 + */
  13 +class SyncSubmitTaskZbj extends Model
  14 +{
  15 +
  16 + const TYPE_INQUIRY = 'inquiry';
  17 + const TYPE_VISIT = 'visit';
  18 +
  19 + const TRAFFIC_DEFAULT = 0;
  20 + const TRAFFIC_TRUE = 1;
  21 +
  22 + //设置关联表名
  23 + /**
  24 + * @var mixed
  25 + */
  26 + protected $table = 'gl_sync_submit_task_20240516';
  27 +
  28 + protected $casts = [
  29 + 'data' => 'array',
  30 + ];
  31 +
  32 + /**
  33 + * @param $type
  34 + * @param $data
  35 + * @return bool
  36 + * @author zbj
  37 + * @date 2023/11/28
  38 + */
  39 + public static function addTask($type, $data): bool
  40 + {
  41 + if (empty($data)) {
  42 + return false;
  43 + }
  44 + try {
  45 + $data = [
  46 + 'data' => $data['data'],
  47 + 'domain' => !empty($data['domain']) ? $data['domain'] : request()->getHost(),
  48 + 'ip' => !empty($data['ip']) ? $data['ip'] : request()->getClientIp(),
  49 + 'referer' => !empty($data['referer']) ? $data['referer'] : request()->header('Referer'),
  50 + 'user_agent' => !empty($data['user_agent']) ? $data['user_agent'] : request()->header('user_agent'),
  51 + ];
  52 +
  53 + if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){
  54 + return false;
  55 + }
  56 +
  57 + $model = new self();
  58 + $model->type = $type;
  59 + $model->data = $data;
  60 + !empty($data['submit_time']) && $model->created_at = $data['submit_time'];
  61 + $model->save();
  62 +
  63 + } catch (\Exception $e) {
  64 + Log::error('SyncSubmitTask addTask error', ['msg' => $e->getMessage(), 'data' => $data]);
  65 + return false;
  66 + }
  67 + return true;
  68 + }
  69 +}
@@ -53,11 +53,14 @@ class Visit extends Base @@ -53,11 +53,14 @@ class Visit extends Base
53 /** 53 /**
54 * 访问写入 54 * 访问写入
55 */ 55 */
56 - public static function saveData($data) 56 + public static function saveData($data, $date)
57 { 57 {
  58 + if(!$date){
  59 + $date = date('Y-m-d');
  60 + }
58 //判断IP当天是否有一条数据 61 //判断IP当天是否有一条数据
59 - $visit = Visit::where("ip",$data['ip'])->where("created_at",">=",Carbon::now()->today()->startOfDay())  
60 - ->where("created_at","<=",Carbon::now()->today()->endOfDay()) 62 + $visit = Visit::where("ip",$data['ip'])->where("created_at",">=",Carbon::make($date)->startOfDay())
  63 + ->where("created_at","<=",Carbon::make($date)->endOfDay())
61 ->first(); 64 ->first();
62 DB::connection('custom_mysql')->beginTransaction(); 65 DB::connection('custom_mysql')->beginTransaction();
63 if (!empty($visit) && $visit->count() >= 1){ 66 if (!empty($visit) && $visit->count() >= 1){
@@ -31,7 +31,7 @@ class SyncSubmitTaskService @@ -31,7 +31,7 @@ class SyncSubmitTaskService
31 * @author zbj 31 * @author zbj
32 * @date 2023/11/28 32 * @date 2023/11/28
33 */ 33 */
34 - public static function handler($task) 34 + public static function handler($task, $date = '')
35 { 35 {
36 $data = $task['data']; 36 $data = $task['data'];
37 $checkIpCountry = self::checkIpCountry($data['domain'], $data['ip'], $task['type']); 37 $checkIpCountry = self::checkIpCountry($data['domain'], $data['ip'], $task['type']);
@@ -53,7 +53,7 @@ class SyncSubmitTaskService @@ -53,7 +53,7 @@ class SyncSubmitTaskService
53 53
54 $action = $task['type']; 54 $action = $task['type'];
55 $handler = new self(); 55 $handler = new self();
56 - return $handler->$action($data); 56 + return $handler->$action($data, $date);
57 } 57 }
58 58
59 59
@@ -85,7 +85,7 @@ class SyncSubmitTaskService @@ -85,7 +85,7 @@ class SyncSubmitTaskService
85 * @author zbj 85 * @author zbj
86 * @date 2023/12/4 86 * @date 2023/12/4
87 */ 87 */
88 - public function inquiry($data) 88 + public function inquiry($data, $date)
89 { 89 {
90 90
91 $this->inquiryFilter($data['project_id'], $data); 91 $this->inquiryFilter($data['project_id'], $data);
@@ -113,7 +113,7 @@ class SyncSubmitTaskService @@ -113,7 +113,7 @@ class SyncSubmitTaskService
113 * @author zbj 113 * @author zbj
114 * @date 2023/12/4 114 * @date 2023/12/4
115 */ 115 */
116 - public function visit($data) 116 + public function visit($data, $date)
117 { 117 {
118 118
119 $visit_data = $data['data']; 119 $visit_data = $data['data'];
@@ -132,7 +132,7 @@ class SyncSubmitTaskService @@ -132,7 +132,7 @@ class SyncSubmitTaskService
132 $visit_data['country'] = $data['country']; 132 $visit_data['country'] = $data['country'];
133 $visit_data['updated_date'] = $data['submit_at']->toDateString(); 133 $visit_data['updated_date'] = $data['submit_at']->toDateString();
134 $visit_data['created_at'] = $data['submit_at']; 134 $visit_data['created_at'] = $data['submit_at'];
135 - Visit::saveData($visit_data); 135 + Visit::saveData($visit_data, $date);
136 136
137 return true; 137 return true;
138 } 138 }