作者 赵彬吉
... ... @@ -7,7 +7,7 @@
* @time :2025/2/21 11:12
*/
namespace App\Console\Commands\AiBlog;
namespace App\Console\Commands\Ai;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
... ...
... ... @@ -7,7 +7,7 @@
* @time :2025/2/14 11:14
*/
namespace App\Console\Commands\AiBlog;
namespace App\Console\Commands\Ai;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
... ... @@ -22,6 +22,13 @@ 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 AiBlogListTask extends Command
{
/**
... ...
... ... @@ -7,7 +7,7 @@
* @time :2025/2/14 11:14
*/
namespace App\Console\Commands\AiBlog;
namespace App\Console\Commands\Ai;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
... ... @@ -74,7 +74,7 @@ class AiBlogTask extends Command
//拿到返回的路由查看是否重复
$route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $item['project_id']);
if($route != $result['data']['url']){
$aiBlogService->updateDetail(['route'=>$this->param['route']]);
$aiBlogService->updateDetail(['route'=>$route,'task_id'=>$item['task_id']]);
}
$aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]);
DB::disconnect('custom_mysql');
... ...
<?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\AiVideo;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
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;
class AiVideoTask extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'save_ai_video';
/**
* The console command description.
*
* @var string
*/
protected $description = '查询ai_video是否已经生成';
public function handle(){
$aiBlogTaskModel = new AiBlogTaskModel();
while (true){
$list = $aiBlogTaskModel->list(['status'=>1,'type'=>3],'id',['*'],'asc',1000);
if(empty($list)){
sleep(300);
continue;
}
$updateProject = [];
foreach ($list as $item){
echo '开始->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
//获取配置
$aiSettingInfo = $this->getSetting($item['project_id']);
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->task_id = $item['task_id'];
$result = $aiBlogService->getDetail();
if($result['status'] != 200){
sleep(5);
continue;
}
//保存当前项目ai_blog数据
ProjectServer::useProject($item['project_id']);
$aiVideoModel = new AiVideo();
$aiBlogInfo = $aiVideoModel->read(['task_id'=>$item['task_id']],['id']);
if($aiBlogInfo === false){
$aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
continue;
}
if (!in_array($result['data']['author_id'], $updateProject[$item['project_id']] ?? [])) {
$updateProject[$item['project_id']][] = $result['data']['author_id'];
}
//拿到返回的路由查看是否重复
$route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_VIDEO, $aiBlogInfo['id'], $item['project_id']);
if($route != $result['data']['url']){
$aiBlogService->updateDetail(['route'=>$route,'task_id'=>$item['task_id']]);
}
$aiVideoModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]);
DB::disconnect('custom_mysql');
$aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
}
//TODO::更新列表页及作者
$this->updateProject($updateProject);
echo '结束->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
}
return true;
}
/**
* @remark :更新项目作者页面及列表页
* @name :updateProject
* @author :lyh
* @method :post
* @time :2025/3/4 10:25
*/
public function updateProject($updateProject){
if(empty($updateProject)){
return true;
}
foreach ($updateProject as $project_id => $author){
ProjectServer::useProject($project_id);
$aiSettingInfo = $this->getSetting($project_id);
// $this->updateBlogList($aiSettingInfo);
//更新作者
foreach ($author as $val){
$this->updateAiBlogAuthor($aiSettingInfo,$val);
}
DB::disconnect('custom_mysql');
}
return true;
}
/**
* @remark :获取项目配置
* @name :getSetting
* @author :lyh
* @method :post
* @time :2025/2/14 11:27
*/
public function getSetting($project_id){
$ai_cache = Cache::get('ai_blog_'.$project_id);
if($ai_cache){
return $ai_cache;
}
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
Cache::put('ai_blog_'.$project_id,$aiSettingInfo,3600);
return $aiSettingInfo;
}
/**
* @remark :更新作者的页面
* @name :updateAiBlogAuthor
* @author :lyh
* @method :post
* @time :2025/2/21 11:53
*/
public function updateAiBlogAuthor($aiSettingInfo,$author_id){
if(empty($author_id)){
return true;
}
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->author_id = $author_id;
$result = $aiBlogService->getAuthorDetail();
if(isset($result['status']) && $result['status'] == 200){
//当前作者的页面
$aiBlogAuthorModel = new AiBlogAuthor();
if(!empty($result['data']['section'])){
$aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$author_id]);
}
}
return true;
}
/**
* @remark :更新列表页
* @name :updateBlogList
* @author :lyh
* @method :post
* @time :2025/2/26 15:42
*/
public function updateBlogList($aiSettingInfo){
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$page = 1;
$saveData = [];
$result = $aiBlogService->getAiBlogList($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 = $aiBlogService->getAiBlogList($page,15);
if(isset($result['status']) && $result['status'] == 200){
$saveData[] = [
'route'=>$page,
'text'=>$result['data']['section'],
];
}
}
$aiBlogListModel = new AiBlogList();
if(!empty($saveData)){
//写一条路由信息
$aiBlogListModel->truncate();
$aiBlogListModel->insertAll($saveData);
}
return true;
}
}
... ...
... ... @@ -65,8 +65,18 @@ class UpdateRoute extends Command
ProjectServer::useProject($v['id']);
$webSettingModel = new WebSetting();
$settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);
if($settingInfo !== false && ($settingInfo['anchor_num'] > 3)){
$webSettingModel->edit(['anchor_num'=>3],['project_id'=>$v['id']]);
if($settingInfo === false){
echo date('Y-m-d H:i:s') . '当前项目的设置数据不存在:'.$v['id'] . PHP_EOL;
//新增一条数据
$data = [
'anchor_setting'=>'["3","4","5"]',
'anchor_is_enable'=>1,
'anchor_page_num'=>1,
'anchor_num'=>2,
'anchor_keyword_is_enable'=>1,
'project_id'=>$v['id']
];
$webSettingModel->add($data);
}
DB::disconnect('custom_mysql');
}
... ...
... ... @@ -31,6 +31,17 @@ class InquiryForwardController extends BaseController
if (isset($this->param['message'])) {
$this->map['message'] = ['like', '%' . $this->map['message'] . '%'];
}
if (isset($this->param['start_date']) && isset($this->param['end_date'])) {
$this->map['inquiry_date'] = ['between', [$this->map['start_date'], $this->map['end_date']]];
unset($this->map['start_date']);
unset($this->map['end_date']);
} elseif (isset($this->param['start_date'])) {
$this->map['inquiry_date'] = ['>=', $this->map['start_date']];
unset($this->map['start_date']);
} elseif (isset($this->param['end_date'])) {
$this->map['inquiry_date'] = ['<=', $this->map['end_date']];
unset($this->map['end_date']);
}
$lists = $inquiryForwardLogic->getInquiryLists($this->map, $this->page, $this->row, $this->order);
$this->response('success', Code::SUCCESS, $lists);
}
... ...
... ... @@ -380,7 +380,7 @@ class ProjectController extends BaseController
* @time :2023/8/18 14:44
*/
public function handleParam(&$item){
if($item['type'] != Project::TYPE_ZERO){
if(($item['type'] != Project::TYPE_ZERO)){
$data = APublicModel::getNumByProjectId($item['id']);
}
if($item['type'] == Project::TYPE_ONE){//建站中
... ...
... ... @@ -65,7 +65,7 @@ class AiBlogController extends BaseController
foreach ($lists['list'] as $k => $v){
$v['image'] = getImageUrl($v['image']);
if(!empty($v['route'])){
$v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];
$v['route'] = $this->user['domain'] . 'blog/' . $v['route'];
}
$lists['list'][$k] = $v;
}
... ... @@ -106,7 +106,7 @@ class AiBlogController extends BaseController
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['image'] = getImageUrl($v['image']);
$v['route'] = $this->user['test_domain'] . 'user/' . $v['route'];
$v['route'] = $this->user['domain'] . 'user/' . $v['route'];
$lists['list'][$k] = $v;
}
}
... ... @@ -173,9 +173,7 @@ class AiBlogController extends BaseController
$lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
if(!empty($v['route'])){
$v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];
}
$v['route'] = $this->user['domain'] . 'top-blog/' . (($v['route'] > 1) ? $v['route'] : '');
$lists['list'][$k] = $v;
}
}
... ...
... ... @@ -70,8 +70,42 @@ class AiVideoController extends BaseController
'keyword.required' => '关键字不能为空',
'type.required' => '场景不能为空',
]);
//获取当前项目的ai_blog设置
$result = $aiVideoLogic->sendTask();
$this->response('success',Code::SUCCESS,$result);
}
/**
* @remark :更新任务
* @name :save
* @author :lyh
* @method :post
* @time :2025/3/6 10:51
*/
public function save(AiVideoLogic $aiVideoLogic){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '关键字不能为空',
]);
$aiVideoLogic->videoSave();
$this->response('success');
}
/**
* @remark :删除ai视频
* @name :delete
* @author :lyh
* @method :post
* @time :2025/3/6 9:56
*/
public function delete(AiVideoLogic $aiVideoLogic)
{
$this->request->validate([
'ids'=>['required'],
],[
'ids.required' => 'ID不能为空'
]);
$result = $aiVideoLogic->videoDelete();
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
... ... @@ -38,7 +38,7 @@ class ComController extends BaseController
}
$lists = $projectMenuModel->list($this->map,'sort');
$menu = array();
foreach ($lists as $k => $v){
foreach ($lists as $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $lists);
... ... @@ -57,9 +57,10 @@ class ComController extends BaseController
*/
public function seo_get_menu(){
$seoMenuModel = new ProjectMenuSeo();
$this->map['status'] = 0;
$lists = $seoMenuModel->list($this->map,'sort');
$menu = array();
foreach ($lists as $k => $v){
foreach ($lists as $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $lists);
... ...
... ... @@ -65,6 +65,14 @@ class InquiryForwardLogic extends BaseLogic
public function getInquiryLists($map, $page, $row, $order = 'id', $filed = ['*'])
{
$lists = $this->model->lists($map, $page, $row, $order, $filed);
//获取各个状态询盘总数
$lists['count_stat'] = [
'all_count' => 0,
'un_count' => 0,
'suc_count' => 0,
'inv_count' => 0,
];
return $this->success($lists);
}
... ...
... ... @@ -111,7 +111,7 @@ class ProjectLogic extends BaseLogic
//升级项目采集完成时间
$info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
//获取项目所属行业
$info['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
$info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
return $this->success($info);
}
... ... @@ -182,8 +182,6 @@ class ProjectLogic extends BaseLogic
$this->saveProjectAfter($this->param['project_after']);
//单独保存小语种配置
$this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']);
//单独保存行业信息
ProjectIndustryRelated::saveRelated($this->param['id'],$this->param['industry'] ?? []);
//同步图片文件
$this->syncImageFile($this->param['project_location'],$this->param['id']);
//同步信息表
... ... @@ -427,6 +425,8 @@ class ProjectLogic extends BaseLogic
* @time :2023/8/30 13:45
*/
protected function saveProjectDeployOptimize($deploy_optimize){
//单独保存行业信息
ProjectIndustryRelated::saveRelated($deploy_optimize['project_id'],$deploy_optimize['industry'] ?? []);
$deployOptimizeModel = new DeployOptimize();
if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
//更改域名
... ...
... ... @@ -56,7 +56,7 @@ class AiBlogLogic extends BaseLogic
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]);
$res = $aiBlogService->updateDetail(['task_id'=>$this->param['task_id'],'title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
... ... @@ -101,12 +101,12 @@ class AiBlogLogic extends BaseLogic
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en'));
$result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']);
$result = $aiBlogService->createTask($this->param['keyword'],2,'blog',$this->param['anchor'] ?? []);
if($result['status'] == 200){
$aiBlogTaskModel = new AiBlogTask();
$aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]);
$aiBlogModel = new AiBlog();
$aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],
$aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'anchor'=>json_encode($this->param['anchor'] ?? [],true)
]);
}
return $this->success();
... ...
... ... @@ -50,41 +50,18 @@ class AiVideoLogic extends BaseLogic
* @method :post
* @time :2023/7/5 14:46
*/
public function blogSave(){
public function videoSave(){
try {
if(!empty($this->param['image'])){
$this->param['image'] = str_replace_url($this->param['image']);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']);
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_VIDEO, $this->param['id'], $this->user['project_id']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :编辑作者
* @name :saveAuthor
* @author :lyh
* @method :post
* @time :2025/2/21 14:46
*/
public function saveBlogAuthor(){
try {
$aiAuthorModel = new AiBlogAuthor();
if(!empty($this->param['image'])){
$this->param['image'] = str_replace_url($this->param['image']);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $this->param['id'], $this->user['project_id']);
$aiAuthorModel->edit($this->param,['id'=>$this->param['id']]);
$aiBlogService = new AiBlogService();
$aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]);
$aiBlogService->updateDetail(['task_id'=>$this->param['task_id'],'title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
... ... @@ -97,7 +74,7 @@ class AiVideoLogic extends BaseLogic
* @author :lyh
* @method :post
* @time :2025/2/14 10:28
* @detail :type=2/生成文章 type=3/更新列表页记录
* @detail :createTask =>type=2/生成文章
* @detail :status=1/待执行
*/
public function sendTask(){
... ... @@ -106,23 +83,23 @@ class AiVideoLogic extends BaseLogic
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en'));
$result = $aiBlogService->createTask($this->param['keyword'],$this->param['type'],'video');
$result = $aiBlogService->createTask($this->param['keyword'],2,'video',$this->param['anchor'] ?? []);
if($result['status'] == 200){
$aiBlogTaskModel = new AiBlogTask();
$aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'task_id'=>$result['data']['task_id'],'status'=>1]);
$this->model->addReturnId(['keyword'=>$this->param['keyword'],'status'=>1,'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id']]);
$this->model->addReturnId(['keyword'=>$this->param['keyword'],'status'=>1,'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'anchor'=>json_encode($this->param['anchor'] ?? [],true)]);
}
return $this->success();
}
/**
* @remark :删除
* @name :blogDelete
* @remark :删除aiVideo
* @name :videoDelete
* @author :lyh
* @method :post
* @time :2025/2/20 18:21
* @time :2025/3/6 10:00
*/
public function blogDelete(){
public function videoDelete(){
try {
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
... ... @@ -132,12 +109,11 @@ class AiVideoLogic extends BaseLogic
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->delDetail($info['task_id']);
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
RouteMap::delRoute(RouteMap::SOURCE_AI_VIDEO, $id, $this->user['project_id']);
$this->model->del(['id'=>$id]);
}
shell_exec('php artisan save_ai_blog_list '.$this->user['project_id'].' > /dev/null 2>&1 &');
}catch (\Exception $e){
$this->fail('删除失败');
$this->fail('删除失败,请联系管理员');
}
return $this->success();
}
... ...
... ... @@ -64,7 +64,7 @@ class WebSettingTextLogic extends BaseLogic
$this->param['anchor_keyword_is_enable'] = 0;
}
$data = [
'anchor_setting'=>$this->param['anchor_setting'],
'anchor_setting'=>$this->param['anchor_setting'] ?? [],
'anchor_is_enable'=>$this->param['anchor_is_enable'],
'anchor_num'=>$this->param['anchor_num'] ?? 0,
'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0,
... ... @@ -72,6 +72,7 @@ class WebSettingTextLogic extends BaseLogic
];
$web_setting->edit($data,['project_id'=>$this->user['project_id']]);
$this->model->del(['project_id'=>$this->user['project_id']]);
if(!empty($this->param['data'])){
foreach ($this->param['data'] as $k => $v){
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
... ... @@ -79,6 +80,7 @@ class WebSettingTextLogic extends BaseLogic
$this->param['data'][$k] = $v;
}
$this->model->insert($this->param['data']);
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ...
... ... @@ -17,6 +17,7 @@ class Category extends Base
protected $table = 'gl_product_category';
//连接数据库
protected $connection = 'custom_mysql';
use SoftDeletes;
const STATUS_ACTIVE = 1;
//新闻产品分类列表分页条数
... ...
... ... @@ -34,6 +34,7 @@ class RouteMap extends Base
//自定义模块
const SOURCE_MODULE = 'module';
const SOURCE_AI_BLOG = 'ai_blog';
const SOURCE_AI_VIDEO = 'ai_video';
const SOURCE_AI_BLOG_AUTHOR = 'ai_blog_author';//ai博客作者
const SOURCE_AI_BLOG_LIST = 'ai_blog_list';
//自定义模块分类
... ...
... ... @@ -70,16 +70,17 @@ class AiBlogService
* @time :2025/2/13 14:39
* @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url
*/
public function createTask($keyword,$type = 2,$subtype = 'Blog',$template_id = 1){
public function createTask($keyword,$type = 2,$subtype = 'Blog',$anchor = []){
$request_url = $this->url.'api/task/create';
$param = [
'mch_id'=>$this->mch_id,
'keyword'=>$keyword,
'type'=>$type,
'subtype'=>$subtype,
'url'=>$this->route,
'template_id'=>$template_id
];
$param['anchor'] = json_encode($anchor,true);
$param['url'] = $this->route;
$param['mch_id'] = $this->mch_id;
$param['template_id'] = 1;
$this->sign = $this->generateSign($param,$this->key);
$param['sign'] = $this->sign;
$result = http_post($request_url,json_encode($param,true));
... ...
... ... @@ -152,6 +152,13 @@ Route::middleware(['bloginauth'])->group(function () {
//ai生成相关接口
Route::prefix('ai')->group(function () {
//ai视屏
Route::prefix('video')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'lists'])->name('ai_video_lists');
Route::any('/getInfo', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'getInfo'])->name('ai_video_getInfo');
Route::any('/sendTask', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'sendTask'])->name('ai_video_sendTask');
Route::any('/del', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'delete'])->name('ai_video_delete');
});
//ai
Route::any('/news/', [\App\Http\Controllers\Bside\Ai\AiNewsController::class, 'save'])->name('ai_news_save');
Route::any('/blog/getAiBlog', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'getAiBlog'])->name('ai_blog_getAiBlog');
... ...