作者 lyh

gx

@@ -43,11 +43,64 @@ class Yesterday extends Command @@ -43,11 +43,64 @@ class Yesterday extends Command
43 foreach ($list as $v){ 43 foreach ($list as $v){
44 $v['test_domain'] = 'https://demomark.globalso.com/'; 44 $v['test_domain'] = 'https://demomark.globalso.com/';
45 $arr = []; 45 $arr = [];
46 - $arr['pv_num'] = DB::table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$v['test_domain'])->count();  
47 - $arr['ip_num'] = DB::table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$v['test_domain'])->count();  
48 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($v['test_domain'],'',1,100000000); 46 + //统计时间
  47 + $arr['date'] = $yesterday;
  48 + //pv统计
  49 + $arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']);
  50 + //ip统计
  51 + $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);
  52 + //询盘统计
  53 + $arr = $this->inquiry($arr,$v['test_domain']);
  54 + //服务达标天数
  55 + $arr['compliance_day'] = $this->compliance_day($yesterday);
  56 + //剩余服务时常
  57 + $arr['service_day'] = $v['service_duration'] - Common::getDaysToTargetDate($v['created_at']);
  58 + //项目id
  59 + $arr['project_id'] = $v['project_id'];
  60 + $arr['created_at'] = date('Y-m-d H:i:s');
  61 + $arr['updated_at'] = date('Y-m-d H:i:s');
  62 + $data[] = $arr;
  63 + }
  64 + //判断数据是否存在
  65 + DB::table('gl_count')->insert($data);
  66 + echo $this->error;
  67 + }
  68 +
  69 + /**
  70 + * @name :(统计pv)pv_num
  71 + * @author :lyh
  72 + * @method :post
  73 + * @time :2023/6/14 15:40
  74 + */
  75 + public function pv_num($yesterday,$domain){
  76 + $pv = DB::table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
  77 + return $pv;
  78 + }
  79 +
  80 + /**
  81 + * @name :(统计pv)pv_num
  82 + * @author :lyh
  83 + * @method :post
  84 + * @time :2023/6/14 15:40
  85 + */
  86 + public function ip_num($yesterday,$domain){
  87 + $ip = DB::table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
  88 + return $ip;
  89 + }
  90 +
  91 + /**
  92 + * @param $arr
  93 + * @param $domain
  94 + * @name :(询盘统计)inquiry
  95 + * @author :lyh
  96 + * @method :post
  97 + * @time :2023/6/14 15:44
  98 + */
  99 + public function inquiry($arr,$domain){
  100 + $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
49 if($inquiry_list['status'] == self::STATUS_ERROR){ 101 if($inquiry_list['status'] == self::STATUS_ERROR){
50 $arr['inquiry_num'] = 0; 102 $arr['inquiry_num'] = 0;
  103 + $arr['country'] = '';
51 }else{ 104 }else{
52 $arr['inquiry_num'] = $inquiry_list['data']['total']; 105 $arr['inquiry_num'] = $inquiry_list['data']['total'];
53 //询盘国家统计 106 //询盘国家统计
@@ -64,21 +117,24 @@ class Yesterday extends Command @@ -64,21 +117,24 @@ class Yesterday extends Command
64 $top20 = array_slice($countryArr, 0, 20, true); 117 $top20 = array_slice($countryArr, 0, 20, true);
65 $arr['country'] = json_encode($top20); 118 $arr['country'] = json_encode($top20);
66 } 119 }
67 - $arr['date'] = $yesterday; 120 + return $arr;
  121 + }
  122 +
  123 + /**
  124 + * @param $yesterday
  125 + * @name :(服务达标天数)compliance_day
  126 + * @author :lyh
  127 + * @method :post
  128 + * @time :2023/6/14 15:48
  129 + */
  130 + public function compliance_day($yesterday){
  131 + //服务达标天数
68 $rank_info = DB::table('gl_rank_data')->where(['updated_date'=>$yesterday,'lang'=>''])->select(['compliance_day'])->first(); 132 $rank_info = DB::table('gl_rank_data')->where(['updated_date'=>$yesterday,'lang'=>''])->select(['compliance_day'])->first();
69 if(empty($rank_info)){ 133 if(empty($rank_info)){
70 - $arr['compliance_day'] = 0; 134 + $compliance_day = 0;
71 }else{ 135 }else{
72 - $arr['compliance_day'] = $rank_info->compliance_day; 136 + $compliance_day = $rank_info->compliance_day;
73 } 137 }
74 - $arr['service_day'] = $v['service_duration'] - Common::getDaysToTargetDate($v['created_at']);  
75 - $arr['project_id'] = $v['project_id'];  
76 - $arr['created_at'] = date('Y-m-d H:i:s');  
77 - $arr['updated_at'] = date('Y-m-d H:i:s');  
78 - $data[] = $arr;  
79 - }  
80 - //判断数据是否存在  
81 - DB::table('gl_count')->insert($data);  
82 - echo $this->error; 138 + return $compliance_day;
83 } 139 }
84 } 140 }