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