作者 lyh

gx脚本demo

@@ -100,8 +100,8 @@ class MonthAllCount extends Command @@ -100,8 +100,8 @@ class MonthAllCount extends Command
100 $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0); 100 $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
101 } 101 }
102 $country = []; 102 $country = [];
103 - if(isset($res['data']['data'])){  
104 - $country = $res['data']['data']; 103 + if(isset($res['data']['country'])){
  104 + $country = $res['data']['country'];
105 } 105 }
106 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']); 106 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
107 foreach ($countryData as $v1){ 107 foreach ($countryData as $v1){
@@ -123,8 +123,8 @@ class MonthCount extends Command @@ -123,8 +123,8 @@ class MonthCount extends Command
123 $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0); 123 $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
124 } 124 }
125 $country = []; 125 $country = [];
126 - if(isset($res['data']['data'])){  
127 - $country = $res['data']['data']; 126 + if(isset($res['data']['country'])){
  127 + $country = $res['data']['country'];
128 } 128 }
129 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']); 129 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
130 foreach ($countryData as $v1){ 130 foreach ($countryData as $v1){
@@ -97,8 +97,8 @@ class MonthProjectCount extends Command @@ -97,8 +97,8 @@ class MonthProjectCount extends Command
97 } 97 }
98 echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL; 98 echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL;
99 $country = []; 99 $country = [];
100 - if(isset($res['data']['data'])){  
101 - $country = $res['data']['data']; 100 + if(isset($res['data']['country'])){
  101 + $country = $res['data']['country'];
102 } 102 }
103 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']); 103 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
104 foreach ($countryData as $v1){ 104 foreach ($countryData as $v1){
@@ -61,6 +61,7 @@ class Demo extends Command @@ -61,6 +61,7 @@ class Demo extends Command
61 $domain = "https://www.xawellauto.com/"; 61 $domain = "https://www.xawellauto.com/";
62 $token = md5($domain.date("Y-m-d")); 62 $token = md5($domain.date("Y-m-d"));
63 $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15"; 63 $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
  64 + $url = $url."&sta_date=2024-07";
64 try { 65 try {
65 $res = http_get($url,['charset=utf-8']); 66 $res = http_get($url,['charset=utf-8']);
66 } catch (\Exception | GuzzleException $e) { 67 } catch (\Exception | GuzzleException $e) {
@@ -68,7 +69,7 @@ class Demo extends Command @@ -68,7 +69,7 @@ class Demo extends Command
68 return false; 69 return false;
69 } 70 }
70 echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL; 71 echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
71 - return true; 72 + return $res;
72 } 73 }
73 74
74 // public function handle(){ 75 // public function handle(){
@@ -168,7 +168,7 @@ class FormGlobalsoApi @@ -168,7 +168,7 @@ class FormGlobalsoApi
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 $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
171 - if(!empty($start) && !empty($end)){ 171 + if(!empty($start_month)){
172 $url = $url."&sta_date=$start_month"; 172 $url = $url."&sta_date=$start_month";
173 } 173 }
174 try { 174 try {
@@ -177,7 +177,6 @@ class FormGlobalsoApi @@ -177,7 +177,6 @@ class FormGlobalsoApi
177 errorLog('提交询盘信息失败', $domain, $e); 177 errorLog('提交询盘信息失败', $domain, $e);
178 return false; 178 return false;
179 } 179 }
180 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
181 return $res; 180 return $res;
182 } 181 }
183 } 182 }