作者 lyh

gx

  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 +}
@@ -50,7 +50,7 @@ class UpdateProductCategory extends Command @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
50 public function handle(){ 50 public function handle(){
51 //获取所有项目 51 //获取所有项目
52 $projectModel = new Project(); 52 $projectModel = new Project();
53 - $list = $projectModel->list(['id'=>['in',[621]]],'id',['id']); 53 + $list = $projectModel->list(['id'=>['in',[1077]]],'id',['id']);
54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; 54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
55 try { 55 try {
56 foreach ($list as $v) { 56 foreach ($list as $v) {