作者 lyh

gx脚本

1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :UpdateVideoNumber.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2024/7/12 16:39  
8 - */  
9 -  
10 -namespace App\Console\Commands\KeywordInVideo;  
11 -  
12 -use Illuminate\Console\Command;  
13 -use Illuminate\Support\Facades\Cache;  
14 -  
15 -class UpdateVideoNumber extends Command  
16 -{  
17 - /**  
18 - * The name and signature of the console command.  
19 - *  
20 - * @var string  
21 - */  
22 - protected $signature = 'update_video_number';  
23 -  
24 - /**  
25 - * The console command description.  
26 - *  
27 - * @var string  
28 - */  
29 - protected $description = '更新每月视频数量';  
30 -  
31 - /**  
32 - * @remark :执行脚本(每月13日更新数量)  
33 - * @name :handle  
34 - * @author :lyh  
35 - * @method :post  
36 - * @time :2024/7/12 16:41  
37 - */  
38 - public function handle(){  
39 - if(date('Y-m-13') == date('Y-m-d')){  
40 - Cache::put('currentMonth13th',49000);  
41 - }  
42 - return true;  
43 - }  
44 -}  
@@ -59,10 +59,6 @@ class VideoTask extends Command @@ -59,10 +59,6 @@ class VideoTask extends Command
59 public function handle() 59 public function handle()
60 { 60 {
61 echo '开始:'.PHP_EOL; 61 echo '开始:'.PHP_EOL;
62 - $this->max_num = Cache::get('currentMonth13th');  
63 - if($this->max_num <= 0){  
64 - return true;  
65 - }  
66 Log::info('开始视频推广任务'); 62 Log::info('开始视频推广任务');
67 $this->createSubTask(); 63 $this->createSubTask();
68 $this->sendSubTask(); 64 $this->sendSubTask();
@@ -128,7 +124,6 @@ class VideoTask extends Command @@ -128,7 +124,6 @@ class VideoTask extends Command
128 if($rs && ($sub_task_num > 0)){ 124 if($rs && ($sub_task_num > 0)){
129 $sub_task_num--; 125 $sub_task_num--;
130 } 126 }
131 - Cache::put('currentMonth13th',$this->max_num--);  
132 } 127 }
133 } 128 }
134 $task_project->status = KeywordVideoTask::STATUS_CLOSE; 129 $task_project->status = KeywordVideoTask::STATUS_CLOSE;
@@ -48,15 +48,14 @@ class Demo extends Command @@ -48,15 +48,14 @@ class Demo extends Command
48 protected $description = 'demo'; 48 protected $description = 'demo';
49 49
50 public function handle(){ 50 public function handle(){
51 - $p = new PurchaserInfo();  
52 - $lists = $p->list();  
53 - foreach ($lists as $k => $v){  
54 - $info = $p->read(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer']]);  
55 - if($info === false){  
56 - continue;  
57 - }  
58 - $p->del(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer'],'id'=>['!=',$v['id']]]);  
59 - }  
60 - return true; 51 + $this->synchronizationFile('/upload/p/1720/file/2024-07/4d.mp4');
  52 + }
  53 +
  54 + public function synchronizationFile($path_name){
  55 + //同步到大文件
  56 + $file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
  57 + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
  58 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
  59 + return shell_exec($cmd);
61 } 60 }
62 } 61 }
@@ -36,7 +36,8 @@ class Kernel extends ConsoleKernel @@ -36,7 +36,8 @@ class Kernel extends ConsoleKernel
36 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 36 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
37 $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); 37 $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
38 // 每月15号执行任务 38 // 每月15号执行任务
39 - $schedule->command('delete_template_log')->monthlyOn(15, '00:00')->withoutOverlapping(); 39 + $schedule->command('delete_template_log')->monthlyOn(15, '00:01')->withoutOverlapping();
  40 + $schedule->command('update_video_number')->monthlyOn(13, '00:01')->withoutOverlapping();
40 // 每日推送已完成视频任务项目生成对应界面 41 // 每日推送已完成视频任务项目生成对应界面
41 $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); 42 $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
42 } 43 }