TemplateLabel.php 1.5 KB
<?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'=>'最新',
                ];
            }
            //设置为最新
        }
        //清空所有的最近标签
    }
}