作者 李宇航

合并分支 'master-server' 到 'master'

修改获取询盘脚本



查看合并请求 !800
@@ -82,7 +82,7 @@ class Count extends Command @@ -82,7 +82,7 @@ class Count extends Command
82 $arr['created_at'] = date('Y-m-d H:i:s'); 82 $arr['created_at'] = date('Y-m-d H:i:s');
83 $arr['updated_at'] = date('Y-m-d H:i:s'); 83 $arr['updated_at'] = date('Y-m-d H:i:s');
84 //询盘统计 84 //询盘统计
85 - $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); 85 + $arr = $this->inquiry($arr,$v['test_domain'], $v['id'] , $v['is_upgrade'] ?? 0);
86 if($arr === false){ 86 if($arr === false){
87 continue; 87 continue;
88 } 88 }
@@ -134,8 +134,8 @@ class Count extends Command @@ -134,8 +134,8 @@ class Count extends Command
134 * @method :post 134 * @method :post
135 * @time :2023/6/14 15:44 135 * @time :2023/6/14 15:44
136 */ 136 */
137 - public function inquiry($arr,$domain,$project_id){  
138 - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); 137 + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){
  138 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade);
139 if($inquiry_list == false){ 139 if($inquiry_list == false){
140 return false; 140 return false;
141 } 141 }
@@ -175,6 +175,7 @@ class Count extends Command @@ -175,6 +175,7 @@ class Count extends Command
175 'gl_project.id AS id', 175 'gl_project.id AS id',
176 'gl_project.type AS type', 176 'gl_project.type AS type',
177 'gl_project.extend_type AS extend_type', 177 'gl_project.extend_type AS extend_type',
  178 + 'gl_project.is_upgrade AS is_upgrade',
178 'gl_project.remain_day AS remain_day', 179 'gl_project.remain_day AS remain_day',
179 'gl_project.finish_remain_day AS finish_remain_day', 180 'gl_project.finish_remain_day AS finish_remain_day',
180 'gl_project_deploy_build.test_domain AS test_domain', 181 'gl_project_deploy_build.test_domain AS test_domain',
@@ -101,8 +101,8 @@ class CountAll extends Command @@ -101,8 +101,8 @@ class CountAll extends Command
101 * @method :post 101 * @method :post
102 * @time :2023/6/14 15:44 102 * @time :2023/6/14 15:44
103 */ 103 */
104 - public function inquiry($arr,$domain,$project_id){  
105 - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); 104 + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){
  105 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade);
106 if($inquiry_list == false){ 106 if($inquiry_list == false){
107 return false; 107 return false;
108 } 108 }
@@ -32,7 +32,7 @@ class CountDate extends Command @@ -32,7 +32,7 @@ class CountDate extends Command
32 * 32 *
33 * @var string 33 * @var string
34 */ 34 */
35 - protected $description = '统计昨日数据'; 35 + protected $description = '时间统计记录';
36 36
37 /** 37 /**
38 * @name :(定时执行生成昨日数据统计)handle 38 * @name :(定时执行生成昨日数据统计)handle
@@ -84,7 +84,7 @@ class CountDate extends Command @@ -84,7 +84,7 @@ class CountDate extends Command
84 $arr['created_at'] = date('Y-m-d H:i:s'); 84 $arr['created_at'] = date('Y-m-d H:i:s');
85 $arr['updated_at'] = date('Y-m-d H:i:s'); 85 $arr['updated_at'] = date('Y-m-d H:i:s');
86 //询盘统计 86 //询盘统计
87 - $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); 87 + $arr = $this->inquiry($arr,$v['test_domain'], $v['id'],$v['is_upgrade'] ?? 0);
88 if($arr === false){ 88 if($arr === false){
89 continue; 89 continue;
90 } 90 }
@@ -136,8 +136,8 @@ class CountDate extends Command @@ -136,8 +136,8 @@ class CountDate extends Command
136 * @method :post 136 * @method :post
137 * @time :2023/6/14 15:44 137 * @time :2023/6/14 15:44
138 */ 138 */
139 - public function inquiry($arr,$domain,$project_id){  
140 - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); 139 + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){
  140 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade);
141 if($inquiry_list == false){ 141 if($inquiry_list == false){
142 return false; 142 return false;
143 } 143 }
@@ -177,6 +177,7 @@ class CountDate extends Command @@ -177,6 +177,7 @@ class CountDate extends Command
177 'gl_project.id AS id', 177 'gl_project.id AS id',
178 'gl_project.type AS type', 178 'gl_project.type AS type',
179 'gl_project.extend_type AS extend_type', 179 'gl_project.extend_type AS extend_type',
  180 + 'gl_project.is_upgrade AS is_upgrade',
180 'gl_project.remain_day AS remain_day', 181 'gl_project.remain_day AS remain_day',
181 'gl_project.finish_remain_day AS finish_remain_day', 182 'gl_project.finish_remain_day AS finish_remain_day',
182 'gl_project_deploy_build.test_domain AS test_domain', 183 'gl_project_deploy_build.test_domain AS test_domain',
@@ -52,7 +52,7 @@ class CountProject extends Command @@ -52,7 +52,7 @@ class CountProject extends Command
52 * @method :post 52 * @method :post
53 * @time :2024/1/8 9:05 53 * @time :2024/1/8 9:05
54 */ 54 */
55 - public function count($project_id){ 55 + public function count($project_id,$is_upgrade = 0){
56 $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date') 56 $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date')
57 ->groupBy('updated_date')->get()->toArray(); 57 ->groupBy('updated_date')->get()->toArray();
58 $project = new Project(); 58 $project = new Project();
@@ -87,7 +87,7 @@ class CountProject extends Command @@ -87,7 +87,7 @@ class CountProject extends Command
87 $arr['compliance_day'] = $projectInfo['finish_remain_day']; 87 $arr['compliance_day'] = $projectInfo['finish_remain_day'];
88 //剩余服务时常 88 //剩余服务时常
89 $arr['service_day'] = $projectInfo['remain_day']; 89 $arr['service_day'] = $projectInfo['remain_day'];
90 - $arr = $this->inquiry($arr,$domain, $project_id); 90 + $arr = $this->inquiry($arr,$domain, $project_id,$projectInfo['is_upgrade'] ?? 0);
91 //查询当天数据是否存在 存在则更新 91 //查询当天数据是否存在 存在则更新
92 $info = $count->read(['date'=>$v['updated_date'],'project_id'=>$project_id]); 92 $info = $count->read(['date'=>$v['updated_date'],'project_id'=>$project_id]);
93 if($info === false){ 93 if($info === false){
@@ -144,8 +144,8 @@ class CountProject extends Command @@ -144,8 +144,8 @@ class CountProject extends Command
144 * @method :post 144 * @method :post
145 * @time :2023/6/14 15:44 145 * @time :2023/6/14 15:44
146 */ 146 */
147 - public function inquiry($arr,$domain,$project_id){  
148 - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); 147 + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){
  148 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade);
149 if($inquiry_list == false){ 149 if($inquiry_list == false){
150 return false; 150 return false;
151 } 151 }
@@ -59,7 +59,7 @@ class MonthAllCount extends Command @@ -59,7 +59,7 @@ class MonthAllCount extends Command
59 } 59 }
60 ProjectServer::useProject($v['id']); 60 ProjectServer::useProject($v['id']);
61 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
62 - $this->count($v['id'], $url); 62 + $this->count($v['id'], $url ,$v['is_upgrade']);
63 DB::disconnect('custom_mysql'); 63 DB::disconnect('custom_mysql');
64 } 64 }
65 } 65 }
@@ -71,7 +71,7 @@ class MonthAllCount extends Command @@ -71,7 +71,7 @@ class MonthAllCount extends Command
71 * @method :post 71 * @method :post
72 * @time :2024/1/8 9:05 72 * @time :2024/1/8 9:05
73 */ 73 */
74 - public function count($project_id,$url){ 74 + public function count($project_id,$url,$is_upgrade = 0){
75 $list = DB::connection('custom_mysql')->table('gl_customer_visit') 75 $list = DB::connection('custom_mysql')->table('gl_customer_visit')
76 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) 76 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
77 ->groupBy('month')->get()->toArray(); 77 ->groupBy('month')->get()->toArray();
@@ -85,7 +85,7 @@ class MonthAllCount extends Command @@ -85,7 +85,7 @@ class MonthAllCount extends Command
85 // 获取当月结束时间 85 // 获取当月结束时间
86 $end = date('Y-m-t', strtotime($v['month'])); 86 $end = date('Y-m-t', strtotime($v['month']));
87 $arr['project_id'] = $project_id; 87 $arr['project_id'] = $project_id;
88 - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']); 88 + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month'],$is_upgrade ?? 0);
89 $arr['total'] = $arr['month_total'] = 0; 89 $arr['total'] = $arr['month_total'] = 0;
90 if(isset($res['data']['count'])){ 90 if(isset($res['data']['count'])){
91 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 91 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
@@ -67,7 +67,7 @@ class MonthCount extends Command @@ -67,7 +67,7 @@ class MonthCount extends Command
67 } 67 }
68 ProjectServer::useProject($v['id']); 68 ProjectServer::useProject($v['id']);
69 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; 69 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
70 - $this->count($v['id'], $url); 70 + $this->count($v['id'], $url ,$v['is_upgrade'] ?? 0);
71 DB::disconnect('custom_mysql'); 71 DB::disconnect('custom_mysql');
72 } 72 }
73 } 73 }
@@ -99,7 +99,7 @@ class MonthCount extends Command @@ -99,7 +99,7 @@ class MonthCount extends Command
99 * @method :post 99 * @method :post
100 * @time :2024/1/8 9:05 100 * @time :2024/1/8 9:05
101 */ 101 */
102 - public function count($project_id,$url){ 102 + public function count($project_id,$url,$is_upgrade = 0){
103 $arr = []; 103 $arr = [];
104 $v = ['month'=>date('Y-m')]; 104 $v = ['month'=>date('Y-m')];
105 $monthCountModel = new MonthCountModel(); 105 $monthCountModel = new MonthCountModel();
@@ -109,7 +109,7 @@ class MonthCount extends Command @@ -109,7 +109,7 @@ class MonthCount extends Command
109 // 获取当月结束时间 109 // 获取当月结束时间
110 $end = date('Y-m-t', strtotime($v['month'])); 110 $end = date('Y-m-t', strtotime($v['month']));
111 $arr['project_id'] = $project_id; 111 $arr['project_id'] = $project_id;
112 - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']); 112 + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month'],$is_upgrade ?? 0);
113 $arr['total'] = $arr['month_total'] = 0; 113 $arr['total'] = $arr['month_total'] = 0;
114 if(isset($res['data']['count'])){ 114 if(isset($res['data']['count'])){
115 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 115 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
@@ -67,7 +67,7 @@ class MonthCountDate extends Command @@ -67,7 +67,7 @@ class MonthCountDate extends Command
67 } 67 }
68 ProjectServer::useProject($v['id']); 68 ProjectServer::useProject($v['id']);
69 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; 69 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
70 - $this->count($v['id'], $url); 70 + $this->count($v['id'], $url , $v['is_upgrade'] ?? 0);
71 DB::disconnect('custom_mysql'); 71 DB::disconnect('custom_mysql');
72 } 72 }
73 } 73 }
@@ -99,7 +99,7 @@ class MonthCountDate extends Command @@ -99,7 +99,7 @@ class MonthCountDate extends Command
99 * @method :post 99 * @method :post
100 * @time :2024/1/8 9:05 100 * @time :2024/1/8 9:05
101 */ 101 */
102 - public function count($project_id,$url){ 102 + public function count($project_id,$url,$is_upgrade){
103 $arr = []; 103 $arr = [];
104 $date = $this->argument('date'); 104 $date = $this->argument('date');
105 $v = ['month'=>$date]; 105 $v = ['month'=>$date];
@@ -110,7 +110,7 @@ class MonthCountDate extends Command @@ -110,7 +110,7 @@ class MonthCountDate extends Command
110 // 获取当月结束时间 110 // 获取当月结束时间
111 $end = date('Y-m-t', strtotime($v['month'])); 111 $end = date('Y-m-t', strtotime($v['month']));
112 $arr['project_id'] = $project_id; 112 $arr['project_id'] = $project_id;
113 - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']); 113 + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month'],$is_upgrade ?? 0);
114 $arr['total'] = $arr['month_total'] = 0; 114 $arr['total'] = $arr['month_total'] = 0;
115 if(isset($res['data']['count'])){ 115 if(isset($res['data']['count'])){
116 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 116 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
@@ -49,8 +49,10 @@ class MonthProjectCount extends Command @@ -49,8 +49,10 @@ class MonthProjectCount extends Command
49 $info = $domainModel->read(['project_id'=>$project_id]); 49 $info = $domainModel->read(['project_id'=>$project_id]);
50 $url = $info['domain']; 50 $url = $info['domain'];
51 } 51 }
  52 + $projectModel = new Project();
  53 + $projectInfo = $projectModel->read(['id'=>$project_id]);
52 ProjectServer::useProject($project_id); 54 ProjectServer::useProject($project_id);
53 - $this->count($project_id,$url); 55 + $this->count($project_id,$url,$projectInfo['is_upgrade'] ?? 0);
54 DB::disconnect('custom_mysql'); 56 DB::disconnect('custom_mysql');
55 } 57 }
56 58
@@ -61,7 +63,7 @@ class MonthProjectCount extends Command @@ -61,7 +63,7 @@ class MonthProjectCount extends Command
61 * @method :post 63 * @method :post
62 * @time :2024/1/8 9:05 64 * @time :2024/1/8 9:05
63 */ 65 */
64 - public function count($project_id,$url){ 66 + public function count($project_id,$url,$is_upgrade = 0){
65 $data = []; 67 $data = [];
66 $list = DB::connection('custom_mysql')->table('gl_customer_visit') 68 $list = DB::connection('custom_mysql')->table('gl_customer_visit')
67 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) 69 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
@@ -80,7 +82,7 @@ class MonthProjectCount extends Command @@ -80,7 +82,7 @@ class MonthProjectCount extends Command
80 // 获取当月结束时间 82 // 获取当月结束时间
81 $end = date('Y-m-t', strtotime($v)); 83 $end = date('Y-m-t', strtotime($v));
82 $arr['project_id'] = $project_id; 84 $arr['project_id'] = $project_id;
83 - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v); 85 + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v ,$is_upgrade ?? 0);
84 echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL; 86 echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL;
85 $arr['total'] = $arr['month_total'] = 0; 87 $arr['total'] = $arr['month_total'] = 0;
86 if(isset($res['data']['count'])){ 88 if(isset($res['data']['count'])){
@@ -144,7 +144,7 @@ class Test extends Command @@ -144,7 +144,7 @@ class Test extends Command
144 try { 144 try {
145 $list = Count::where('date', '2023-12-11')->where('project_id', $project->id)->get(); 145 $list = Count::where('date', '2023-12-11')->where('project_id', $project->id)->get();
146 foreach ($list as $v){ 146 foreach ($list as $v){
147 - $arr = $this->inquiry([],$test_domain, $v['id']); 147 + $arr = $this->inquiry([],$test_domain, $v['id'],$project->is_upgrade ?? 0);
148 $v->inquiry_num = $arr['inquiry_num']; 148 $v->inquiry_num = $arr['inquiry_num'];
149 $v->country = $arr['country']; 149 $v->country = $arr['country'];
150 $v->save(); 150 $v->save();
@@ -157,8 +157,8 @@ class Test extends Command @@ -157,8 +157,8 @@ class Test extends Command
157 echo "finish"; 157 echo "finish";
158 } 158 }
159 159
160 - public function inquiry($arr,$domain,$project_id){  
161 - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); 160 + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){
  161 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade ?? 0);
162 if($inquiry_list['status'] == 400){ 162 if($inquiry_list['status'] == 400){
163 $arr['inquiry_num'] = 0; 163 $arr['inquiry_num'] = 0;
164 $countryArr = []; 164 $countryArr = [];
@@ -162,12 +162,19 @@ class FormGlobalsoApi @@ -162,12 +162,19 @@ class FormGlobalsoApi
162 * @method :post 162 * @method :post
163 * @time :2024/8/15 14:16 163 * @time :2024/8/15 14:16
164 */ 164 */
165 - public function getInquiryAll($domain){ 165 + public function getInquiryAll($domain,$is_upgrade = 0){
166 if (!(strpos($domain, 'https://') === 0)) { 166 if (!(strpos($domain, 'https://') === 0)) {
167 $domain = 'https://'.$domain.'/'; 167 $domain = 'https://'.$domain.'/';
168 } 168 }
169 $token = md5($domain.date("Y-m-d")); 169 $token = md5($domain.date("Y-m-d"));
170 - $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15"; 170 + $data = [
  171 + 'domain' => $domain,
  172 + 'token' => $token,
  173 + 'source'=> $is_upgrade ? '1,2,3,4' : '1,3',
  174 + 'num'=>15,
  175 + ];
  176 + $queryString = http_build_query($data);
  177 + $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?".$queryString;
171 try { 178 try {
172 $res = http_get($url,['charset=utf-8']); 179 $res = http_get($url,['charset=utf-8']);
173 } catch (\Exception | GuzzleException $e) { 180 } catch (\Exception | GuzzleException $e) {
@@ -184,10 +191,18 @@ class FormGlobalsoApi @@ -184,10 +191,18 @@ class FormGlobalsoApi
184 * @method :post 191 * @method :post
185 * @time :2024/8/16 10:16 192 * @time :2024/8/16 10:16
186 */ 193 */
187 - public function getMonthInquiry($url,$month){ 194 + public function getMonthInquiry($url,$month,$is_upgrade = 0){
188 $url = 'https://'.$url.'/'; 195 $url = 'https://'.$url.'/';
189 $token = md5($url.date("Y-m-d")); 196 $token = md5($url.date("Y-m-d"));
190 - $url = 'https://form.globalso.com/api/external-interface/country_con/15243d63ed5a5738?domain='.$url.'&token='.$token.'&source=1,2,3,4&model=month&sta_date='.$month; 197 + $data = [
  198 + 'domain' => $url,
  199 + 'token' => $token,
  200 + 'source'=> $is_upgrade ? '1,2,3,4' : '1,3',
  201 + 'model' => 'month',
  202 + 'sta_date'=>$month,
  203 + ];
  204 + $queryString = http_build_query($data);
  205 + $url = 'https://form.globalso.com/api/external-interface/country_con/15243d63ed5a5738?'.$queryString;
191 $res = http_get($url,['charset=utf-8']); 206 $res = http_get($url,['charset=utf-8']);
192 echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL; 207 echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
193 return $res; 208 return $res;
@@ -75,7 +75,7 @@ class OptimizationReportController extends BaseController @@ -75,7 +75,7 @@ class OptimizationReportController extends BaseController
75 //关键词排名明细 75 //关键词排名明细
76 $data['keywords_rank_list'] = $this->keywords_rank_list($this->param['project_id'],$projectInfo); 76 $data['keywords_rank_list'] = $this->keywords_rank_list($this->param['project_id'],$projectInfo);
77 //pv_ip统计 77 //pv_ip统计
78 - $data['pv_ip'] = $this->pv_ip($domain_info['domain']); 78 + $data['pv_ip'] = $this->pv_ip($domain_info['domain'],$projectInfo['is_upgrade']);
79 //30天统计 79 //30天统计
80 $data['count_30'] = $this->count_30_total(); 80 $data['count_30'] = $this->count_30_total();
81 //访问国家前10 81 //访问国家前10
@@ -321,10 +321,10 @@ class OptimizationReportController extends BaseController @@ -321,10 +321,10 @@ class OptimizationReportController extends BaseController
321 * @method :post 321 * @method :post
322 * @time :2024/3/7 16:53 322 * @time :2024/3/7 16:53
323 */ 323 */
324 - public function pv_ip($domain){ 324 + public function pv_ip($domain,$is_upgrade = 0){
325 $pv = (new VisitItem())->count(); 325 $pv = (new VisitItem())->count();
326 $ip = (new Visit())->count(); 326 $ip = (new Visit())->count();
327 - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); 327 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade ?? 0);
328 if(!empty($inquiry_list)){ 328 if(!empty($inquiry_list)){
329 $total = $inquiry_list['data']['count'] ?? 0; 329 $total = $inquiry_list['data']['count'] ?? 0;
330 } 330 }