|
@@ -2,11 +2,14 @@ |
|
@@ -2,11 +2,14 @@ |
|
2
|
|
2
|
|
|
3
|
namespace App\Console\Commands\MonthlyCount;
|
3
|
namespace App\Console\Commands\MonthlyCount;
|
|
4
|
|
4
|
|
|
|
|
5
|
+use App\Helper\FormGlobalsoApi;
|
|
5
|
use Carbon\Carbon;
|
6
|
use Carbon\Carbon;
|
|
6
|
use Illuminate\Console\Command;
|
7
|
use Illuminate\Console\Command;
|
|
7
|
|
8
|
|
|
8
|
class InquiryMonthlyCount extends Command
|
9
|
class InquiryMonthlyCount extends Command
|
|
9
|
{
|
10
|
{
|
|
|
|
11
|
+ const STATUS_ERROR = 400;
|
|
|
|
12
|
+ public $error = 0;
|
|
10
|
/**
|
13
|
/**
|
|
11
|
* The name and signature of the console command.
|
14
|
* The name and signature of the console command.
|
|
12
|
*
|
15
|
*
|
|
@@ -29,9 +32,40 @@ class InquiryMonthlyCount extends Command |
|
@@ -29,9 +32,40 @@ class InquiryMonthlyCount extends Command |
|
29
|
* @time :2023/6/30 9:32
|
32
|
* @time :2023/6/30 9:32
|
|
30
|
*/
|
33
|
*/
|
|
31
|
public function handle(){
|
34
|
public function handle(){
|
|
|
|
35
|
+ //统计数据
|
|
|
|
36
|
+ $arr = [];
|
|
32
|
// 获取上个月的开始时间
|
37
|
// 获取上个月的开始时间
|
|
33
|
$startTime = Carbon::now()->subMonth()->startOfMonth();
|
38
|
$startTime = Carbon::now()->subMonth()->startOfMonth();
|
|
34
|
// 获取上个月的结束时间
|
39
|
// 获取上个月的结束时间
|
|
35
|
$endTime = Carbon::now()->subMonth()->endOfMonth();
|
40
|
$endTime = Carbon::now()->subMonth()->endOfMonth();
|
|
36
|
}
|
41
|
}
|
|
|
|
42
|
+
|
|
|
|
43
|
+ /**
|
|
|
|
44
|
+ * @param $arr
|
|
|
|
45
|
+ * @param $domain
|
|
|
|
46
|
+ * @name :(询盘统计)inquiry
|
|
|
|
47
|
+ * @author :lyh
|
|
|
|
48
|
+ * @method :post
|
|
|
|
49
|
+ * @time :2023/6/14 15:44
|
|
|
|
50
|
+ */
|
|
|
|
51
|
+ public function inquiry($arr,$domain){
|
|
|
|
52
|
+ $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
|
|
|
|
53
|
+ $arr['count'] = $inquiry_list['data']['total'];
|
|
|
|
54
|
+ //询盘国家统计
|
|
|
|
55
|
+ $countryData = $inquiry_list['data']['data'];
|
|
|
|
56
|
+ $countryArr = [];
|
|
|
|
57
|
+ foreach ($countryData as $v1){
|
|
|
|
58
|
+ if(isset($countryArr[$v1['country']])){
|
|
|
|
59
|
+ $countryArr[$v1['country']]++;
|
|
|
|
60
|
+ }else{
|
|
|
|
61
|
+ $countryArr[$v1['country']] = 0;
|
|
|
|
62
|
+ }
|
|
|
|
63
|
+ }
|
|
|
|
64
|
+ arsort($countryArr);
|
|
|
|
65
|
+ $top20 = array_slice($countryArr, 0, 20, true);
|
|
|
|
66
|
+ $arr['country'] = json_encode($top20);
|
|
|
|
67
|
+
|
|
|
|
68
|
+ return $arr;
|
|
|
|
69
|
+ }
|
|
|
|
70
|
+
|
|
37
|
} |
71
|
} |