作者 lyh

gx脚本

<?php
/**
* @remark :
* @name :UpdateVideoNumber.php
* @author :lyh
* @method :post
* @time :2024/7/12 16:39
*/
namespace App\Console\Commands\KeywordInVideo;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
class UpdateVideoNumber extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update_video_number';
/**
* The console command description.
*
* @var string
*/
protected $description = '更新每月视频数量';
/**
* @remark :执行脚本(每月13日更新数量)
* @name :handle
* @author :lyh
* @method :post
* @time :2024/7/12 16:41
*/
public function handle(){
if(date('Y-m-13') == date('Y-m-d')){
Cache::put('currentMonth13th',49000);
}
return true;
}
}
... ... @@ -59,10 +59,6 @@ class VideoTask extends Command
public function handle()
{
echo '开始:'.PHP_EOL;
$this->max_num = Cache::get('currentMonth13th');
if($this->max_num <= 0){
return true;
}
Log::info('开始视频推广任务');
$this->createSubTask();
$this->sendSubTask();
... ... @@ -128,7 +124,6 @@ class VideoTask extends Command
if($rs && ($sub_task_num > 0)){
$sub_task_num--;
}
Cache::put('currentMonth13th',$this->max_num--);
}
}
$task_project->status = KeywordVideoTask::STATUS_CLOSE;
... ...
... ... @@ -48,15 +48,14 @@ class Demo extends Command
protected $description = 'demo';
public function handle(){
$p = new PurchaserInfo();
$lists = $p->list();
foreach ($lists as $k => $v){
$info = $p->read(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer']]);
if($info === false){
continue;
}
$p->del(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer'],'id'=>['!=',$v['id']]]);
}
return true;
$this->synchronizationFile('/upload/p/1720/file/2024-07/4d.mp4');
}
public function synchronizationFile($path_name){
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
}
... ...
... ... @@ -36,7 +36,8 @@ class Kernel extends ConsoleKernel
$schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
$schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
// 每月15号执行任务
$schedule->command('delete_template_log')->monthlyOn(15, '00:00')->withoutOverlapping();
$schedule->command('delete_template_log')->monthlyOn(15, '00:01')->withoutOverlapping();
$schedule->command('update_video_number')->monthlyOn(13, '00:01')->withoutOverlapping();
// 每日推送已完成视频任务项目生成对应界面
$schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
}
... ...