作者 李宇航

合并分支 'develop' 到 'master'

Develop



查看合并请求 !414
... ... @@ -143,6 +143,7 @@ class VideoTask extends Command
],
'task_id' => $task_id,
'callback_url' => env('APP_URL') . '/api/video_task_callback',
'is_ytb'=>true
];
$result = Http::post('http://216.250.255.116:7866/create_task', $data);
$val->task_id = $task_id;
... ... @@ -216,7 +217,7 @@ class VideoTask extends Command
}
if (count($productIds)<7){
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",1)->pluck('id')->toArray();
$product_id = array_rand($product_all_id, 13-count($productIds));
$product_id = array_rand($product_all_id, 40-count($productIds));
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
$products = $productsQuery->merge($randomData);
}else{
... ... @@ -224,19 +225,23 @@ class VideoTask extends Command
}
}else{
$product_all_id = Product::where("project_id", $project_id)->where("status",1)->pluck('id')->toArray();
$product_id = array_rand($product_all_id, 13);
$product_id = array_rand($product_all_id, 40);
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
}
}
$data = [];
if (!empty($products)){
foreach ($products as $item){
$data[] = !empty($item->thumb) && $item->thumb['url'] != "" ? getImageUrl($item->thumb['url']) : "";
if(empty($item->thumb) || ($item->thumb['url'] == "")){
continue;
}
if(count($data) > 13){
break;
}
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
}
}
return $data;
}
}
... ...
<?php
/**
* @remark :
* @name :Notice.php
* @author :lyh
* @method :post
* @time :2024/3/6 16:01
*/
namespace App\Console\Commands\Notice;
use App\Models\Com\KeywordVideoTaskLog;
use App\Models\Domain\DomainInfo;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
/**
* @remark :通知C端生成界面
* @name :Notice
* @author :lyh
* @method :post
* @time :2024/3/6 16:01
*/
class Notice extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'notice_c';
/**
* The console command description.
*
* @var string
*/
protected $description = '通知C端生成界面';
/**
* @remark :通知C端生成界面
* @name :handle
* @author :lyh
* @method :post
* @time :2023/11/20 15:13
*/
public function handle(){
$yesterday = date('Y-m-d', strtotime('yesterday'));
$keywordVideoModel = new KeywordVideoTaskLog();
$list = $keywordVideoModel->select('project_id')
->groupBy('project_id')->whereBetween('created_at', [$yesterday.' 00:00:00',$yesterday.' 23:59:59'])->get()->toArray();
$project_arr = [];
if(empty($list)){
echo date('Y-m-d H:i:s') . '无需通知' . PHP_EOL;
return false;
}
foreach ($list as $k => $v){
$project_arr[] = $v['project_id'];
}
$domainModel = new DomainInfo();
$domainList = $domainModel->formatQuery(['project_id'=>['in',$project_arr]])->get()->toArray();
if(empty($domainList)){
echo date('Y-m-d H:i:s') . '无域名:'.json_encode($domainList) . PHP_EOL;
return false;
}
foreach ($domainList as $v1){
//TODO::通知C端
$this->curlDelRoute($v1['domain'],$v1['project_id']);
}
return true;
}
/**
* @remark :删除路由通知C端
* @name :curlDelRoute
* @author :lyh
* @method :post
* @time :2023/11/30 14:43
*/
public function curlDelRoute($domain,$project_id){
if (strpos($domain, 'https://') === false) {
$domain = 'https://' . $domain . '/';
}
$url = $domain.'api/update_page/?project_id='.$project_id.'&route=6';
shell_exec('curl -k "'.$url.'"');
return true;
}
}
... ...