|
|
|
1
|
+<?php
|
|
|
|
2
|
+/**
|
|
|
|
3
|
+ * @remark :
|
|
|
|
4
|
+ * @name :TemplateLabel.php
|
|
|
|
5
|
+ * @author :lyh
|
|
|
|
6
|
+ * @method :post
|
|
|
|
7
|
+ * @time :2024/6/3 11:33
|
|
|
|
8
|
+ */
|
|
|
|
9
|
+
|
|
|
|
10
|
+namespace App\Console\Commands\TemplateLabel;
|
|
|
|
11
|
+
|
|
|
|
12
|
+use Illuminate\Console\Command;
|
|
|
|
13
|
+use App\Models\Template\TemplateLabel as TemplateLabelModel;
|
|
|
|
14
|
+
|
|
|
|
15
|
+class TemplateLabel extends Command
|
|
|
|
16
|
+{
|
|
|
|
17
|
+ /**
|
|
|
|
18
|
+ * The name and signature of the console command.
|
|
|
|
19
|
+ *
|
|
|
|
20
|
+ * @var string
|
|
|
|
21
|
+ */
|
|
|
|
22
|
+ protected $signature = 'template_label';
|
|
|
|
23
|
+
|
|
|
|
24
|
+ /**
|
|
|
|
25
|
+ * The console command description.
|
|
|
|
26
|
+ *
|
|
|
|
27
|
+ * @var string
|
|
|
|
28
|
+ */
|
|
|
|
29
|
+ protected $description = '设置label';
|
|
|
|
30
|
+
|
|
|
|
31
|
+ /**
|
|
|
|
32
|
+ * @remark :执行脚本
|
|
|
|
33
|
+ * @name :handle
|
|
|
|
34
|
+ * @author :lyh
|
|
|
|
35
|
+ * @method :post
|
|
|
|
36
|
+ * @time :2024/6/3 11:35
|
|
|
|
37
|
+ */
|
|
|
|
38
|
+ public function handle(){
|
|
|
|
39
|
+ //清除当前所有最新标签
|
|
|
|
40
|
+ $labelModel = new TemplateLabelModel();
|
|
|
|
41
|
+ //获取最近5天左侧的记录
|
|
|
|
42
|
+ $start_time = now()->subDays(7)->startOfDay()->toDateString();
|
|
|
|
43
|
+ $end_time = now()->startOfDay()->toDateString();
|
|
|
|
44
|
+ $info = $labelModel->read(['created_at'=>['between',[$start_time,$end_time]]]);
|
|
|
|
45
|
+ if($info === false){
|
|
|
|
46
|
+ return false;
|
|
|
|
47
|
+ }
|
|
|
|
48
|
+ //清空所有的最近标签
|
|
|
|
49
|
+ }
|
|
|
|
50
|
+} |