作者 lyh

gx脚本demo

@@ -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 = $this->inquiry($url,$v['month']); 88 + $res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
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;
@@ -191,13 +191,4 @@ class MonthAllCount extends Command @@ -191,13 +191,4 @@ class MonthAllCount extends Command
191 return $arr; 191 return $arr;
192 } 192 }
193 193
194 - public function inquiry($url,$month){  
195 - $url = 'https://'.$url.'/';  
196 - $token = md5($url.date("Y-m-d"));  
197 - $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;  
198 - $res = http_get($url,['charset=utf-8']);  
199 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
200 - return $res;  
201 - }  
202 -  
203 } 194 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Console\Commands\MonthlyCount; 10 namespace App\Console\Commands\MonthlyCount;
11 11
  12 +use App\Helper\FormGlobalsoApi;
12 use App\Models\Com\UpdateOldInfo; 13 use App\Models\Com\UpdateOldInfo;
13 use App\Models\Domain\DomainInfo; 14 use App\Models\Domain\DomainInfo;
14 use App\Models\Inquiry\InquiryFormData; 15 use App\Models\Inquiry\InquiryFormData;
@@ -108,7 +109,7 @@ class MonthCount extends Command @@ -108,7 +109,7 @@ class MonthCount extends Command
108 // 获取当月结束时间 109 // 获取当月结束时间
109 $end = date('Y-m-t', strtotime($v['month'])); 110 $end = date('Y-m-t', strtotime($v['month']));
110 $arr['project_id'] = $project_id; 111 $arr['project_id'] = $project_id;
111 - $res = $this->inquiry($url,$v['month']); 112 + $res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
112 $arr['total'] = $arr['month_total'] = 0; 113 $arr['total'] = $arr['month_total'] = 0;
113 if(isset($res['data']['count'])){ 114 if(isset($res['data']['count'])){
114 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;
@@ -212,13 +213,4 @@ class MonthCount extends Command @@ -212,13 +213,4 @@ class MonthCount extends Command
212 return $arr; 213 return $arr;
213 } 214 }
214 215
215 - public function inquiry($url,$month){  
216 - $url = 'https://'.$url.'/';  
217 - $token = md5($url.date("Y-m-d"));  
218 - $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;  
219 - $res = http_get($url,['charset=utf-8']);  
220 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
221 - return $res;  
222 - }  
223 -  
224 } 216 }
@@ -80,7 +80,7 @@ class MonthProjectCount extends Command @@ -80,7 +80,7 @@ class MonthProjectCount extends Command
80 // 获取当月结束时间 80 // 获取当月结束时间
81 $end = date('Y-m-t', strtotime($v)); 81 $end = date('Y-m-t', strtotime($v));
82 $arr['project_id'] = $project_id; 82 $arr['project_id'] = $project_id;
83 - $res = $this->inquiry($url,$v); 83 + $res = (new FormGlobalsoApi())->getInquiryAll($url,$v);
84 echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL; 84 echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL;
85 $arr['total'] = $arr['month_total'] = 0; 85 $arr['total'] = $arr['month_total'] = 0;
86 if(isset($res['data']['count'])){ 86 if(isset($res['data']['count'])){
@@ -188,15 +188,6 @@ class MonthProjectCount extends Command @@ -188,15 +188,6 @@ class MonthProjectCount extends Command
188 return $arr; 188 return $arr;
189 } 189 }
190 190
191 - public function inquiry($url,$month){  
192 - $url = 'https://'.$url.'/';  
193 - $token = md5($url.date("Y-m-d"));  
194 - $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;  
195 - $res = http_get($url,['charset=utf-8']);  
196 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
197 - return $res;  
198 - }  
199 -  
200 /** 191 /**
201 * @remark :补齐月份 192 * @remark :补齐月份
202 * @name :fillMissingMonths 193 * @name :fillMissingMonths