作者 lyh

gx

1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :ForwardInquiryCount.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2023/8/18 9:41  
8 - */  
9 -  
10 -namespace App\Console\Commands\MonthlyCount;  
11 -  
12 -use App\Models\Inquiry\ForwardCount;  
13 -use Carbon\Carbon;  
14 -use Illuminate\Console\Command;  
15 -use Illuminate\Support\Facades\DB;  
16 -  
17 -/**  
18 - * @remark :转发询盘人员统计  
19 - * @name :ForwardInquiryCount  
20 - * @author :lyh  
21 - * @method :post  
22 - * @time :2023/8/18 9:42  
23 - */  
24 -class ForwardInquiryCount extends Command  
25 -{  
26 - /**  
27 - * The name and signature of the console command.  
28 - *  
29 - * @var string  
30 - */  
31 - protected $signature = 'forward_count';  
32 -  
33 - /**  
34 - * The console command description.  
35 - *  
36 - * @var string  
37 - */  
38 - protected $description = '月转发报告统计';  
39 -  
40 - /**  
41 - * @remark :统计报告  
42 - * @name :handle  
43 - * @author :lyh  
44 - * @method :post  
45 - * @time :2023/8/18 9:52  
46 - */  
47 - public function handle(){  
48 - // 获取上个月的开始时间  
49 - $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();  
50 - // 获取上个月的结束时间  
51 - $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();  
52 - $list = DB::table('gl_inquiry_info')->groupBy('user_name')  
53 - ->select("user_name",DB::raw('COUNT(*) as count'))  
54 - ->where('send_time','>=',$startTime.' 00:00:00')  
55 - ->where('send_time','<=',$endTime.' 23:59:59')  
56 - ->get();  
57 - if(!empty($list)){  
58 - $list = $list->toArray();  
59 - $forwardModel = new ForwardCount();  
60 - foreach ($list as $v){  
61 - $data = [  
62 - 'date'=>Carbon::now()->subMonth()->format('Y-m'),  
63 - 'name'=>$v['user_name'],  
64 - 'count'=>$v['count']  
65 - ];  
66 - $forwardModel->add($data);  
67 - }  
68 - }  
69 - return 1;  
70 - }  
71 -}  
@@ -26,7 +26,6 @@ class Kernel extends ConsoleKernel @@ -26,7 +26,6 @@ class Kernel extends ConsoleKernel
26 // $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 26 // $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
27 // $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 27 // $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
28 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 28 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
29 - $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录  
30 // $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 29 // $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
31 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 30 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
32 // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 31 // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次