作者 lyh

gx

... ... @@ -88,6 +88,9 @@ class VideoTask extends Command
continue;
}
ProjectServer::useProject($task_project->project_id);
if(!empty($task_project->keywords)){
$task_project->keywords = explode(',',trim(',',$task_project->keywords));
}
$keyword = $this->getProjectKeyword($task_project->number,$task_project->keywords);
// 已经没有需要生成视频的关键词
if (!$keyword) {
... ... @@ -174,17 +177,19 @@ class VideoTask extends Command
public function getProjectKeyword($number,$keywords = [])
{
if(!empty($keywords)){
$keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray();
$keyword_id = Keyword::where('video', null)->whereIn("title", $keywords)
->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->pluck('id')->toArray();
if(count($keyword_id) == 0){
$keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')
->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();
}else{
$keyword_arr_id = Keyword::where('video', null)->whereNotIn("title", $keywords)->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')
->orderBy('id','asc')->limit($number - count($keyword_id))->pluck('id')->toArray();
$keyword_arr_id = Keyword::where('video', null)->whereNotIn("title", $keywords)->where('route', 'not like', '%-tag')
->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number - count($keyword_id))->pluck('id')->toArray();
$keyword_arr_id = array_merge($keyword_id,$keyword_arr_id);
}
}else{
$keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();
$keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag')
->whereNotNull('keyword_content')->orderBy('id','asc')->limit($number)->pluck('id')->toArray();
}
if(count($keyword_arr_id) == 0){
return [];
... ...
... ... @@ -100,6 +100,7 @@ class NoticeController extends BaseController
$keyword->video = $video;
$keyword->embed_code = $embed_code;
$keyword->video_thumb = $thumb;
$keyword->is_video_keyword = 1;
$keyword->save();
DB::disconnect('custom_mysql');
return 200;
... ...
... ... @@ -201,4 +201,26 @@ class KeywordController extends BaseController
}
$this->response('success');
}
/**
* @remark :批量操作关键字是否展示视频
* @name :batchKeywordIsVideo
* @author :lyh
* @method :post
* @time :2024/5/30 14:29
*/
public function batchKeywordIsVideo(){
$this->request->validate([
'title'=>['required','array', 'max:500']
],[
'title.required' => 'title不能为空',
'title.array' => 'title为数组',
'title.max' => '批量操作不能超过500条数据'
]);
$keywordModel = new Keyword();
foreach ($this->param['title'] as $v){
$keywordModel->edit(['is_video_keyword'=>$this->param['is_video_keyword']],['title'=>$v]);
}
$this->response('success');
}
}
... ...
... ... @@ -284,6 +284,7 @@ class UserLoginLogic
if($info['is_customized'] == 1){
$info['is_visualization'] = json_decode($project['is_visualization']);
}
$info['ai_video'] = $project['deploy_optimize']['ai_video'];
$info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority'];
//是否开通AMP
$is_amp = 0;
... ...
... ... @@ -266,6 +266,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd');
Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel');
Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete');
Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo');
Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled');
//产品参数
Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr');
... ...