作者 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 = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']); 88 + $res = (new FormGlobalsoApi())->getMonthInquiry($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;
@@ -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())->getInquiryAll($url,$v['month']); 112 + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']);
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;
@@ -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 = (new FormGlobalsoApi())->getInquiryAll($url,$v); 83 + $res = (new FormGlobalsoApi())->getMonthInquiry($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 echo date('Y-m-d H:i:s') . '返回值:'.json_encode($res) . PHP_EOL; 86 echo date('Y-m-d H:i:s') . '返回值:'.json_encode($res) . PHP_EOL;
@@ -179,4 +179,20 @@ class FormGlobalsoApi @@ -179,4 +179,20 @@ class FormGlobalsoApi
179 } 179 }
180 return $res; 180 return $res;
181 } 181 }
  182 +
  183 + /**
  184 + * @remark :按月份统计
  185 + * @name :inquiry
  186 + * @author :lyh
  187 + * @method :post
  188 + * @time :2024/8/16 10:16
  189 + */
  190 + public function getMonthInquiry($url,$month){
  191 + $url = 'https://'.$url.'/';
  192 + $token = md5($url.date("Y-m-d"));
  193 + $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;
  194 + $res = http_get($url,['charset=utf-8']);
  195 + echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
  196 + return $res;
  197 + }
182 } 198 }