TemplateLabel.php 1.2 KB
<?php
/**
 * @remark :
 * @name   :TemplateLabel.php
 * @author :lyh
 * @method :post
 * @time   :2024/6/3 11:33
 */

namespace App\Console\Commands\TemplateLabel;

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();
        $info = $labelModel->read(['created_at'=>['between',[$start_time,$end_time]]]);
        if($info === false){
            return false;
        }
        //清空所有的最近标签
    }
}