作者 李宇航

合并分支 'develop' 到 'master'

Develop



查看合并请求 !414
@@ -143,6 +143,7 @@ class VideoTask extends Command @@ -143,6 +143,7 @@ class VideoTask extends Command
143 ], 143 ],
144 'task_id' => $task_id, 144 'task_id' => $task_id,
145 'callback_url' => env('APP_URL') . '/api/video_task_callback', 145 'callback_url' => env('APP_URL') . '/api/video_task_callback',
  146 + 'is_ytb'=>true
146 ]; 147 ];
147 $result = Http::post('http://216.250.255.116:7866/create_task', $data); 148 $result = Http::post('http://216.250.255.116:7866/create_task', $data);
148 $val->task_id = $task_id; 149 $val->task_id = $task_id;
@@ -216,7 +217,7 @@ class VideoTask extends Command @@ -216,7 +217,7 @@ class VideoTask extends Command
216 } 217 }
217 if (count($productIds)<7){ 218 if (count($productIds)<7){
218 $product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",1)->pluck('id')->toArray(); 219 $product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",1)->pluck('id')->toArray();
219 - $product_id = array_rand($product_all_id, 13-count($productIds)); 220 + $product_id = array_rand($product_all_id, 40-count($productIds));
220 $randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get(); 221 $randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
221 $products = $productsQuery->merge($randomData); 222 $products = $productsQuery->merge($randomData);
222 }else{ 223 }else{
@@ -224,19 +225,23 @@ class VideoTask extends Command @@ -224,19 +225,23 @@ class VideoTask extends Command
224 } 225 }
225 }else{ 226 }else{
226 $product_all_id = Product::where("project_id", $project_id)->where("status",1)->pluck('id')->toArray(); 227 $product_all_id = Product::where("project_id", $project_id)->where("status",1)->pluck('id')->toArray();
227 - $product_id = array_rand($product_all_id, 13); 228 + $product_id = array_rand($product_all_id, 40);
228 $products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get(); 229 $products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
229 } 230 }
230 } 231 }
231 $data = []; 232 $data = [];
232 if (!empty($products)){ 233 if (!empty($products)){
233 foreach ($products as $item){ 234 foreach ($products as $item){
234 - $data[] = !empty($item->thumb) && $item->thumb['url'] != "" ? getImageUrl($item->thumb['url']) : ""; 235 + if(empty($item->thumb) || ($item->thumb['url'] == "")){
  236 + continue;
  237 + }
  238 + if(count($data) > 13){
  239 + break;
  240 + }
  241 + $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
235 } 242 }
236 } 243 }
237 return $data; 244 return $data;
238 } 245 }
239 246
240 -  
241 -  
242 } 247 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Notice.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/3/6 16:01
  8 + */
  9 +
  10 +namespace App\Console\Commands\Notice;
  11 +
  12 +use App\Models\Com\KeywordVideoTaskLog;
  13 +use App\Models\Domain\DomainInfo;
  14 +use Illuminate\Console\Command;
  15 +use Illuminate\Support\Facades\DB;
  16 +
  17 +/**
  18 + * @remark :通知C端生成界面
  19 + * @name :Notice
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2024/3/6 16:01
  23 + */
  24 +class Notice extends Command
  25 +{
  26 + /**
  27 + * The name and signature of the console command.
  28 + *
  29 + * @var string
  30 + */
  31 + protected $signature = 'notice_c';
  32 +
  33 + /**
  34 + * The console command description.
  35 + *
  36 + * @var string
  37 + */
  38 + protected $description = '通知C端生成界面';
  39 +
  40 + /**
  41 + * @remark :通知C端生成界面
  42 + * @name :handle
  43 + * @author :lyh
  44 + * @method :post
  45 + * @time :2023/11/20 15:13
  46 + */
  47 + public function handle(){
  48 + $yesterday = date('Y-m-d', strtotime('yesterday'));
  49 + $keywordVideoModel = new KeywordVideoTaskLog();
  50 + $list = $keywordVideoModel->select('project_id')
  51 + ->groupBy('project_id')->whereBetween('created_at', [$yesterday.' 00:00:00',$yesterday.' 23:59:59'])->get()->toArray();
  52 + $project_arr = [];
  53 + if(empty($list)){
  54 + echo date('Y-m-d H:i:s') . '无需通知' . PHP_EOL;
  55 + return false;
  56 + }
  57 + foreach ($list as $k => $v){
  58 + $project_arr[] = $v['project_id'];
  59 + }
  60 + $domainModel = new DomainInfo();
  61 + $domainList = $domainModel->formatQuery(['project_id'=>['in',$project_arr]])->get()->toArray();
  62 + if(empty($domainList)){
  63 + echo date('Y-m-d H:i:s') . '无域名:'.json_encode($domainList) . PHP_EOL;
  64 + return false;
  65 + }
  66 + foreach ($domainList as $v1){
  67 + //TODO::通知C端
  68 + $this->curlDelRoute($v1['domain'],$v1['project_id']);
  69 + }
  70 + return true;
  71 + }
  72 +
  73 + /**
  74 + * @remark :删除路由通知C端
  75 + * @name :curlDelRoute
  76 + * @author :lyh
  77 + * @method :post
  78 + * @time :2023/11/30 14:43
  79 + */
  80 + public function curlDelRoute($domain,$project_id){
  81 + if (strpos($domain, 'https://') === false) {
  82 + $domain = 'https://' . $domain . '/';
  83 + }
  84 + $url = $domain.'api/update_page/?project_id='.$project_id.'&route=6';
  85 + shell_exec('curl -k "'.$url.'"');
  86 + return true;
  87 + }
  88 +}