正在显示
1 个修改的文件
包含
83 行增加
和
27 行删除
| @@ -43,35 +43,19 @@ class Yesterday extends Command | @@ -43,35 +43,19 @@ 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); | ||
| 49 | - if($inquiry_list['status'] == self::STATUS_ERROR){ | ||
| 50 | - $arr['inquiry_num'] = 0; | ||
| 51 | - }else{ | ||
| 52 | - $arr['inquiry_num'] = $inquiry_list['data']['total']; | ||
| 53 | - //询盘国家统计 | ||
| 54 | - $countryData = $inquiry_list['data']['data']; | ||
| 55 | - $countryArr = []; | ||
| 56 | - foreach ($countryData as $v1){ | ||
| 57 | - if(isset($countryArr[$v1['country']])){ | ||
| 58 | - $countryArr[$v1['country']]++; | ||
| 59 | - }else{ | ||
| 60 | - $countryArr[$v1['country']] = 0; | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | - arsort($countryArr); | ||
| 64 | - $top20 = array_slice($countryArr, 0, 20, true); | ||
| 65 | - $arr['country'] = json_encode($top20); | ||
| 66 | - } | 46 | + //统计时间 |
| 67 | $arr['date'] = $yesterday; | 47 | $arr['date'] = $yesterday; |
| 68 | - $rank_info = DB::table('gl_rank_data')->where(['updated_date'=>$yesterday,'lang'=>''])->select(['compliance_day'])->first(); | ||
| 69 | - if(empty($rank_info)){ | ||
| 70 | - $arr['compliance_day'] = 0; | ||
| 71 | - }else{ | ||
| 72 | - $arr['compliance_day'] = $rank_info->compliance_day; | ||
| 73 | - } | 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 | + //剩余服务时常 | ||
| 74 | $arr['service_day'] = $v['service_duration'] - Common::getDaysToTargetDate($v['created_at']); | 57 | $arr['service_day'] = $v['service_duration'] - Common::getDaysToTargetDate($v['created_at']); |
| 58 | + //项目id | ||
| 75 | $arr['project_id'] = $v['project_id']; | 59 | $arr['project_id'] = $v['project_id']; |
| 76 | $arr['created_at'] = date('Y-m-d H:i:s'); | 60 | $arr['created_at'] = date('Y-m-d H:i:s'); |
| 77 | $arr['updated_at'] = date('Y-m-d H:i:s'); | 61 | $arr['updated_at'] = date('Y-m-d H:i:s'); |
| @@ -81,4 +65,76 @@ class Yesterday extends Command | @@ -81,4 +65,76 @@ class Yesterday extends Command | ||
| 81 | DB::table('gl_count')->insert($data); | 65 | DB::table('gl_count')->insert($data); |
| 82 | echo $this->error; | 66 | echo $this->error; |
| 83 | } | 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); | ||
| 101 | + if($inquiry_list['status'] == self::STATUS_ERROR){ | ||
| 102 | + $arr['inquiry_num'] = 0; | ||
| 103 | + $arr['country'] = ''; | ||
| 104 | + }else{ | ||
| 105 | + $arr['inquiry_num'] = $inquiry_list['data']['total']; | ||
| 106 | + //询盘国家统计 | ||
| 107 | + $countryData = $inquiry_list['data']['data']; | ||
| 108 | + $countryArr = []; | ||
| 109 | + foreach ($countryData as $v1){ | ||
| 110 | + if(isset($countryArr[$v1['country']])){ | ||
| 111 | + $countryArr[$v1['country']]++; | ||
| 112 | + }else{ | ||
| 113 | + $countryArr[$v1['country']] = 0; | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + arsort($countryArr); | ||
| 117 | + $top20 = array_slice($countryArr, 0, 20, true); | ||
| 118 | + $arr['country'] = json_encode($top20); | ||
| 119 | + } | ||
| 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 | + //服务达标天数 | ||
| 132 | + $rank_info = DB::table('gl_rank_data')->where(['updated_date'=>$yesterday,'lang'=>''])->select(['compliance_day'])->first(); | ||
| 133 | + if(empty($rank_info)){ | ||
| 134 | + $compliance_day = 0; | ||
| 135 | + }else{ | ||
| 136 | + $compliance_day = $rank_info->compliance_day; | ||
| 137 | + } | ||
| 138 | + return $compliance_day; | ||
| 139 | + } | ||
| 84 | } | 140 | } |
-
请 注册 或 登录 后发表评论