作者 lyh

gx ai视频

... ... @@ -79,6 +79,7 @@ class AiBlogAuthorTask extends Command
ProjectServer::useProject($info['project_id']);
$this->saveAiBlogAuthor($result['data'] ?? [],$info['project_id']);
RouteMap::setRoute('top-blog',RouteMap::SOURCE_AI_BLOG_LIST,0,$info['project_id']);//写一条列表页路由
RouteMap::setRoute('top-video',RouteMap::SOURCE_AI_VIDEO_LIST,0,$info['project_id']);//写一条列表页路由
DB::disconnect('custom_mysql');
//修改任务状态
$aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]);
... ...
<?php
/**
* @remark :
* @name :AiBlogTask.php
* @author :lyh
* @method :post
* @time :2025/2/14 11:14
*/
namespace App\Console\Commands\Ai;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\Ai\AiVideoList;
use App\Models\Domain\DomainInfo;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
use App\Services\AiVideoService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use function Symfony\Component\String\s;
/***
* @remark :根据项目更新blog列表
* @name :AiBlogListTask
* @author :lyh
* @method :post
* @time :2025/3/6 9:45
*/
class AiVideoListTask extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'save_ai_video_list {project_id}';
/**
* The console command description.
*
* @var string
*/
protected $description = '生成video列表';
public function handle(){
$project_id = $this->argument('project_id');
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('执行的项目id->'.$project_id, true) . PHP_EOL, FILE_APPEND);
ProjectServer::useProject($project_id);
$this->updateBlogList($project_id);
// $this->curlDelRoute($project_id);
DB::disconnect('custom_mysql');
return true;
}
/**
* @remark :更新列表页数据
* @name :updateBlogList
* @author :lyh
* @method :post
* @time :2025/3/5 11:07
*/
public function updateBlogList($project_id){
$aiVideoService = new AiVideoService($project_id);
$page = 1;
$saveData = [];
$result = $aiVideoService->getAiVideoList($page,15);
if(!isset($result['status']) && $result['status'] != 200){
return true;
}
$total_page = $result['data']['total_page'];
//组装数据保存
$saveData[] = [
'route'=>$page,
'text'=>$result['data']['section'],
];
while ($total_page > $page){
$page++;
$result = $aiVideoService->getAiVideoList($page,15);
if(isset($result['status']) && $result['status'] == 200){
$saveData[] = [
'route'=>$page,
'text'=>$result['data']['section'],
];
}
}
$aiVideoListModel = new AiVideoList();
if(!empty($saveData)){
//写一条路由信息
$aiVideoListModel->truncate();
$aiVideoListModel->insertAll($saveData);
}
return true;
}
/**
* @remark :通知C端生成界面
* @name :sendNotice
* @author :lyh
* @method :post
* @time :2025/3/6 11:51
*/
public function curlDelRoute($project_id){
$domainModel = new DomainInfo();
//获取项目域名
$domain = $domainModel->getProjectIdDomain($project_id);
if(!empty($domain)){
$c_url = $domain.'api/update_page/';
$param = [
'project_id' => $project_id,
'type' => 1,
'route' => 3,
'url' => ['top-blog'],
'language'=> [],
'is_sitemap' => 0
];
http_post($c_url, json_encode($param));
}
return true;
}
}
... ...
... ... @@ -90,11 +90,12 @@ class AfterDayCount extends Command
->whereRaw("FIND_IN_SET('7', gl_project_deploy_optimize.special) = 0 AND FIND_IN_SET('8', gl_project_deploy_optimize.special) = 0")
->count();
$rate = number_format($qualified_count / $project_count, 2);
$threeMonthsAgo = date('Y-m-d 00:00:00', strtotime('-3 months'));
$threeMonthsAgo = date('Y-m-d', strtotime('-3 months'));
$three_project_count = $projectModel->where('gl_project.extend_type',0)
->where('gl_project.delete_status',0)
->where('gl_project.old_project_id',0)
->where('gl_project.created_at','<=',$threeMonthsAgo)
->where('gl_project.created_at','>=',$threeMonthsAgo.' 00:00:00')
->where('gl_project.created_at','<=',$threeMonthsAgo.' 23:59:59')
->whereIn('gl_project_deploy_optimize.optimist_mid',$idArr)
->whereIn('gl_project.type',[2,4])
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
... ... @@ -105,7 +106,8 @@ class AfterDayCount extends Command
->whereIn('gl_project.id',$projectIdArr)
->where('gl_project.delete_status',0)
->where('gl_project.old_project_id',0)
->where('gl_project.created_at','<=',$threeMonthsAgo)
->where('gl_project.created_at','>=',$threeMonthsAgo.' 00:00:00')
->where('gl_project.created_at','<=',$threeMonthsAgo.' 23:59:59')
->whereIn('gl_project_deploy_optimize.optimist_mid',$idArr)
->whereIn('gl_project.type',[2,4])
->where('gl_project_deploy_build.plan','!=',0)
... ... @@ -124,7 +126,7 @@ class AfterDayCount extends Command
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
->whereRaw("FIND_IN_SET('2', gl_project.level) = 0 AND FIND_IN_SET('3', gl_project.level) = 0")
->whereRaw("FIND_IN_SET('7', gl_project_deploy_optimize.special) = 0 AND FIND_IN_SET('8', gl_project_deploy_optimize.special) = 0")
->pluck('gl_project.title')->toArray();
->select(['gl_project.title','gl_project.finish_remain_day','gl_project_deploy_optimize.start_date'])->get()->toArray();
$saveData[] = [
'date'=>date('Y-m-d', strtotime('yesterday')),
'type'=> $key,
... ...
... ... @@ -37,6 +37,7 @@ class RouteMap extends Base
const SOURCE_AI_VIDEO = 'ai_video';
const SOURCE_AI_BLOG_AUTHOR = 'ai_blog_author';//ai博客作者
const SOURCE_AI_BLOG_LIST = 'ai_blog_list';
const SOURCE_AI_VIDEO_LIST = 'ai_blog_video';
//自定义模块分类
const SOURCE_MODULE_CATE = 'module_category';
... ...