作者 lyh

gx脚本demo

... ... @@ -85,7 +85,7 @@ class MonthAllCount extends Command
// 获取当月结束时间
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
$res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']);
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
... ...
... ... @@ -109,7 +109,7 @@ class MonthCount extends Command
// 获取当月结束时间
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
$res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']);
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
... ...
... ... @@ -80,7 +80,7 @@ class MonthProjectCount extends Command
// 获取当月结束时间
$end = date('Y-m-t', strtotime($v));
$arr['project_id'] = $project_id;
$res = (new FormGlobalsoApi())->getInquiryAll($url,$v);
$res = (new FormGlobalsoApi())->getMonthInquiry($url,$v);
echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL;
$arr['total'] = $arr['month_total'] = 0;
echo date('Y-m-d H:i:s') . '返回值:'.json_encode($res) . PHP_EOL;
... ...
... ... @@ -179,4 +179,20 @@ class FormGlobalsoApi
}
return $res;
}
/**
* @remark :按月份统计
* @name :inquiry
* @author :lyh
* @method :post
* @time :2024/8/16 10:16
*/
public function getMonthInquiry($url,$month){
$url = 'https://'.$url.'/';
$token = md5($url.date("Y-m-d"));
$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;
$res = http_get($url,['charset=utf-8']);
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
}
... ...