|
...
|
...
|
@@ -2,11 +2,14 @@ |
|
|
|
|
|
|
|
namespace App\Console\Commands\MonthlyCount;
|
|
|
|
|
|
|
|
use App\Helper\FormGlobalsoApi;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
class InquiryMonthlyCount extends Command
|
|
|
|
{
|
|
|
|
const STATUS_ERROR = 400;
|
|
|
|
public $error = 0;
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
...
|
...
|
@@ -29,9 +32,40 @@ class InquiryMonthlyCount extends Command |
|
|
|
* @time :2023/6/30 9:32
|
|
|
|
*/
|
|
|
|
public function handle(){
|
|
|
|
//统计数据
|
|
|
|
$arr = [];
|
|
|
|
// 获取上个月的开始时间
|
|
|
|
$startTime = Carbon::now()->subMonth()->startOfMonth();
|
|
|
|
// 获取上个月的结束时间
|
|
|
|
$endTime = Carbon::now()->subMonth()->endOfMonth();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $arr
|
|
|
|
* @param $domain
|
|
|
|
* @name :(询盘统计)inquiry
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 15:44
|
|
|
|
*/
|
|
|
|
public function inquiry($arr,$domain){
|
|
|
|
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
|
|
|
|
$arr['count'] = $inquiry_list['data']['total'];
|
|
|
|
//询盘国家统计
|
|
|
|
$countryData = $inquiry_list['data']['data'];
|
|
|
|
$countryArr = [];
|
|
|
|
foreach ($countryData as $v1){
|
|
|
|
if(isset($countryArr[$v1['country']])){
|
|
|
|
$countryArr[$v1['country']]++;
|
|
|
|
}else{
|
|
|
|
$countryArr[$v1['country']] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
arsort($countryArr);
|
|
|
|
$top20 = array_slice($countryArr, 0, 20, true);
|
|
|
|
$arr['country'] = json_encode($top20);
|
|
|
|
|
|
|
|
return $arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|