作者 lyh

变更数据

... ... @@ -10,6 +10,7 @@
namespace App\Console\Commands\Ai;
use App\Models\Ai\AiVideo;
use App\Models\AyrShare\AyrShare;
use App\Models\Domain\DomainInfo;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
... ... @@ -241,7 +242,15 @@ class AiVideoAutoPublish extends Command
$storage = $aiVideoTaskModel->videoSetting()[$video_setting ?? 1];
$frequency = $aiVideoTaskModel->videoFrequency()[$frequency_setting ?? 1];
$frequencyArr = explode('-',$frequency);
$result = $aiVideoService->createTask($info['title'],$info['remark'],array_slice($info['images'], 0, 8),[],$storage);
if($storage == 'YOUTUBE'){
//查看是否有ayr账号
$ayrModel = new AyrShare();
$ayrInfo = $ayrModel->read(['project_id'=>$this->param['project_id'],'bind_platforms'=>['like','%"youtube"%'],'profile_key'=>['!=',null]]);
if($ayrInfo !== false){
$ayrshare_profile_key = $ayrInfo['profile_key'];
}
}
$result = $aiVideoService->createTask($info['title'],$info['remark'],array_slice($info['images'], 0, 8),[],$storage,$ayrshare_profile_key ?? '');
if($result['status'] == 200){
$next_auto_date = date('Y-m-d', strtotime('+' . mt_rand($frequencyArr[0] ?? 5,$frequencyArr[1] ?? 7) . 'days')); //每5-7天自动发布
$aiVideoTaskModel->addReturnId(['next_auto_date'=>$next_auto_date,'task_id'=>$result['data']['task_id'],'project_id'=>$info['project_id'],'storage'=>$storage]);
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiVideo;
use App\Models\AyrShare\AyrShare;
use App\Models\Project\AiBlogTask;
use App\Models\Project\AiVideoTask;
use App\Models\Project\ProjectAiSetting;
... ... @@ -66,8 +67,16 @@ class AiVideoLogic extends BaseLogic
$aiVideoTaskModel = new AiVideoTask();
$aiVideoService = new AiVideoService($this->user['project_id']);
$storage = $aiVideoTaskModel->videoSetting()[$this->user['video_setting'] ?? 1];
if($storage == 'YOUTUBE'){
//查看是否有ayr账号
$ayrModel = new AyrShare();
$ayrInfo = $ayrModel->read(['project_id'=>$this->param['project_id'],'bind_platforms'=>['like','%"youtube"%'],'profile_key'=>['!=',null]]);
if($ayrInfo !== false){
$ayrshare_profile_key = $ayrInfo['profile_key'];
}
}
//todo::获取ayr的key
$result = $aiVideoService->createTask($this->param['title'],$this->param['description'],$this->param['images'],$this->param['anchor'] ?? [],$storage);
$result = $aiVideoService->createTask($this->param['title'],$this->param['description'],$this->param['images'],$this->param['anchor'] ?? [],$storage,$ayrshare_profile_key ?? '');
if($result['status'] == 200){
$aiVideoTaskModel->addReturnId(['task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'storage'=>$storage]);
$id = $this->model->addReturnId(['title'=>$this->param['title'],'task_id'=>$result['data']['task_id'],'description'=>$this->param['description'],'project_id'=>$this->user['project_id'],'images'=>json_encode($this->param['images'],true),'anchor'=>json_encode($this->param['anchor'] ?? [],true)]);
... ...
... ... @@ -120,7 +120,7 @@ class GeoQuestionResLogic extends BaseLogic
'core_question_count'=>$core_question_count,//核心问题总数
'keywords_url_count'=>$keywordUrlCount,
'keywords_arr' => $keywordArr,
'core_keyword_url_count'=>$coreKeywordUrlCount ?? 0
'core_keyword_url_count'=>$coreKeywordUrlCount ?? 0,
];
}else{
$keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);
... ... @@ -147,6 +147,11 @@ class GeoQuestionResLogic extends BaseLogic
->where('hit','!=',0)->whereIn('platform',['openai', 'gemini','google_ai_overview'])
->select(DB::raw('COUNT(DISTINCT question) as total'))
->value('total');
$latestCreatedAt = $questionLogModel
->where('project_id', $this->user['project_id'])
->orderBy('id', 'desc')
->value('created_at');
$data['date'] = $latestCreatedAt ? date('Y-m-d', strtotime($latestCreatedAt)) : null;
return $this->success($data);
}
... ...