作者 赵彬吉
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 * @time :2025/2/21 11:12 7 * @time :2025/2/21 11:12
8 */ 8 */
9 9
10 -namespace App\Console\Commands\AiBlog; 10 +namespace App\Console\Commands\Ai;
11 11
12 use App\Models\Ai\AiBlog; 12 use App\Models\Ai\AiBlog;
13 use App\Models\Ai\AiBlogAuthor; 13 use App\Models\Ai\AiBlogAuthor;
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 * @time :2025/2/14 11:14 7 * @time :2025/2/14 11:14
8 */ 8 */
9 9
10 -namespace App\Console\Commands\AiBlog; 10 +namespace App\Console\Commands\Ai;
11 11
12 use App\Models\Ai\AiBlog; 12 use App\Models\Ai\AiBlog;
13 use App\Models\Ai\AiBlogAuthor; 13 use App\Models\Ai\AiBlogAuthor;
@@ -22,6 +22,13 @@ use Illuminate\Support\Facades\Cache; @@ -22,6 +22,13 @@ use Illuminate\Support\Facades\Cache;
22 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
23 use function Symfony\Component\String\s; 23 use function Symfony\Component\String\s;
24 24
  25 +/***
  26 + * @remark :根据项目更新blog列表
  27 + * @name :AiBlogListTask
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/3/6 9:45
  31 + */
25 class AiBlogListTask extends Command 32 class AiBlogListTask extends Command
26 { 33 {
27 /** 34 /**
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 * @time :2025/2/14 11:14 7 * @time :2025/2/14 11:14
8 */ 8 */
9 9
10 -namespace App\Console\Commands\AiBlog; 10 +namespace App\Console\Commands\Ai;
11 11
12 use App\Models\Ai\AiBlog; 12 use App\Models\Ai\AiBlog;
13 use App\Models\Ai\AiBlogAuthor; 13 use App\Models\Ai\AiBlogAuthor;
@@ -74,7 +74,7 @@ class AiBlogTask extends Command @@ -74,7 +74,7 @@ class AiBlogTask extends Command
74 //拿到返回的路由查看是否重复 74 //拿到返回的路由查看是否重复
75 $route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $item['project_id']); 75 $route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $item['project_id']);
76 if($route != $result['data']['url']){ 76 if($route != $result['data']['url']){
77 - $aiBlogService->updateDetail(['route'=>$this->param['route']]); 77 + $aiBlogService->updateDetail(['route'=>$route,'task_id'=>$item['task_id']]);
78 } 78 }
79 $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']]); 79 $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']]);
80 DB::disconnect('custom_mysql'); 80 DB::disconnect('custom_mysql');
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AiBlogTask.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/2/14 11:14
  8 + */
  9 +
  10 +namespace App\Console\Commands\Ai;
  11 +
  12 +use App\Models\Ai\AiBlog;
  13 +use App\Models\Ai\AiBlogAuthor;
  14 +use App\Models\Ai\AiBlogList;
  15 +use App\Models\Ai\AiVideo;
  16 +use App\Models\Project\ProjectAiSetting;
  17 +use App\Models\RouteMap\RouteMap;
  18 +use App\Services\AiBlogService;
  19 +use App\Services\ProjectServer;
  20 +use Illuminate\Console\Command;
  21 +use App\Models\Project\AiBlogTask as AiBlogTaskModel;
  22 +use Illuminate\Support\Facades\Cache;
  23 +use Illuminate\Support\Facades\DB;
  24 +use function Symfony\Component\String\s;
  25 +
  26 +class AiVideoTask extends Command
  27 +{
  28 + /**
  29 + * The name and signature of the console command.
  30 + *
  31 + * @var string
  32 + */
  33 + protected $signature = 'save_ai_video';
  34 +
  35 + /**
  36 + * The console command description.
  37 + *
  38 + * @var string
  39 + */
  40 + protected $description = '查询ai_video是否已经生成';
  41 +
  42 + public function handle(){
  43 + $aiBlogTaskModel = new AiBlogTaskModel();
  44 + while (true){
  45 + $list = $aiBlogTaskModel->list(['status'=>1,'type'=>3],'id',['*'],'asc',1000);
  46 + if(empty($list)){
  47 + sleep(300);
  48 + continue;
  49 + }
  50 + $updateProject = [];
  51 + foreach ($list as $item){
  52 + echo '开始->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
  53 + //获取配置
  54 + $aiSettingInfo = $this->getSetting($item['project_id']);
  55 + $aiBlogService = new AiBlogService();
  56 + $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
  57 + $aiBlogService->key = $aiSettingInfo['key'];
  58 + $aiBlogService->task_id = $item['task_id'];
  59 + $result = $aiBlogService->getDetail();
  60 + if($result['status'] != 200){
  61 + sleep(5);
  62 + continue;
  63 + }
  64 + //保存当前项目ai_blog数据
  65 + ProjectServer::useProject($item['project_id']);
  66 + $aiVideoModel = new AiVideo();
  67 + $aiBlogInfo = $aiVideoModel->read(['task_id'=>$item['task_id']],['id']);
  68 + if($aiBlogInfo === false){
  69 + $aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
  70 + continue;
  71 + }
  72 + if (!in_array($result['data']['author_id'], $updateProject[$item['project_id']] ?? [])) {
  73 + $updateProject[$item['project_id']][] = $result['data']['author_id'];
  74 + }
  75 + //拿到返回的路由查看是否重复
  76 + $route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_VIDEO, $aiBlogInfo['id'], $item['project_id']);
  77 + if($route != $result['data']['url']){
  78 + $aiBlogService->updateDetail(['route'=>$route,'task_id'=>$item['task_id']]);
  79 + }
  80 + $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']]);
  81 + DB::disconnect('custom_mysql');
  82 + $aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
  83 + }
  84 + //TODO::更新列表页及作者
  85 + $this->updateProject($updateProject);
  86 + echo '结束->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
  87 + }
  88 + return true;
  89 + }
  90 +
  91 + /**
  92 + * @remark :更新项目作者页面及列表页
  93 + * @name :updateProject
  94 + * @author :lyh
  95 + * @method :post
  96 + * @time :2025/3/4 10:25
  97 + */
  98 + public function updateProject($updateProject){
  99 + if(empty($updateProject)){
  100 + return true;
  101 + }
  102 + foreach ($updateProject as $project_id => $author){
  103 + ProjectServer::useProject($project_id);
  104 + $aiSettingInfo = $this->getSetting($project_id);
  105 +// $this->updateBlogList($aiSettingInfo);
  106 + //更新作者
  107 + foreach ($author as $val){
  108 + $this->updateAiBlogAuthor($aiSettingInfo,$val);
  109 + }
  110 + DB::disconnect('custom_mysql');
  111 + }
  112 + return true;
  113 + }
  114 +
  115 + /**
  116 + * @remark :获取项目配置
  117 + * @name :getSetting
  118 + * @author :lyh
  119 + * @method :post
  120 + * @time :2025/2/14 11:27
  121 + */
  122 + public function getSetting($project_id){
  123 + $ai_cache = Cache::get('ai_blog_'.$project_id);
  124 + if($ai_cache){
  125 + return $ai_cache;
  126 + }
  127 + $projectAiSettingModel = new ProjectAiSetting();
  128 + $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
  129 + Cache::put('ai_blog_'.$project_id,$aiSettingInfo,3600);
  130 + return $aiSettingInfo;
  131 + }
  132 +
  133 + /**
  134 + * @remark :更新作者的页面
  135 + * @name :updateAiBlogAuthor
  136 + * @author :lyh
  137 + * @method :post
  138 + * @time :2025/2/21 11:53
  139 + */
  140 + public function updateAiBlogAuthor($aiSettingInfo,$author_id){
  141 + if(empty($author_id)){
  142 + return true;
  143 + }
  144 + $aiBlogService = new AiBlogService();
  145 + $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
  146 + $aiBlogService->key = $aiSettingInfo['key'];
  147 + $aiBlogService->author_id = $author_id;
  148 + $result = $aiBlogService->getAuthorDetail();
  149 + if(isset($result['status']) && $result['status'] == 200){
  150 + //当前作者的页面
  151 + $aiBlogAuthorModel = new AiBlogAuthor();
  152 + if(!empty($result['data']['section'])){
  153 + $aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$author_id]);
  154 + }
  155 + }
  156 + return true;
  157 + }
  158 +
  159 + /**
  160 + * @remark :更新列表页
  161 + * @name :updateBlogList
  162 + * @author :lyh
  163 + * @method :post
  164 + * @time :2025/2/26 15:42
  165 + */
  166 + public function updateBlogList($aiSettingInfo){
  167 + $aiBlogService = new AiBlogService();
  168 + $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
  169 + $aiBlogService->key = $aiSettingInfo['key'];
  170 + $page = 1;
  171 + $saveData = [];
  172 + $result = $aiBlogService->getAiBlogList($page,15);
  173 + if(!isset($result['status']) && $result['status'] != 200){
  174 + return true;
  175 + }
  176 + $total_page = $result['data']['total_page'];
  177 + //组装数据保存
  178 + $saveData[] = [
  179 + 'route'=>$page,
  180 + 'text'=>$result['data']['section'],
  181 + ];
  182 + while ($total_page > $page){
  183 + $page++;
  184 + $result = $aiBlogService->getAiBlogList($page,15);
  185 + if(isset($result['status']) && $result['status'] == 200){
  186 + $saveData[] = [
  187 + 'route'=>$page,
  188 + 'text'=>$result['data']['section'],
  189 + ];
  190 + }
  191 + }
  192 + $aiBlogListModel = new AiBlogList();
  193 + if(!empty($saveData)){
  194 + //写一条路由信息
  195 + $aiBlogListModel->truncate();
  196 + $aiBlogListModel->insertAll($saveData);
  197 + }
  198 + return true;
  199 + }
  200 +}
@@ -65,8 +65,18 @@ class UpdateRoute extends Command @@ -65,8 +65,18 @@ class UpdateRoute extends Command
65 ProjectServer::useProject($v['id']); 65 ProjectServer::useProject($v['id']);
66 $webSettingModel = new WebSetting(); 66 $webSettingModel = new WebSetting();
67 $settingInfo = $webSettingModel->read(['project_id'=>$v['id']]); 67 $settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);
68 - if($settingInfo !== false && ($settingInfo['anchor_num'] > 3)){  
69 - $webSettingModel->edit(['anchor_num'=>3],['project_id'=>$v['id']]); 68 + if($settingInfo === false){
  69 + echo date('Y-m-d H:i:s') . '当前项目的设置数据不存在:'.$v['id'] . PHP_EOL;
  70 + //新增一条数据
  71 + $data = [
  72 + 'anchor_setting'=>'["3","4","5"]',
  73 + 'anchor_is_enable'=>1,
  74 + 'anchor_page_num'=>1,
  75 + 'anchor_num'=>2,
  76 + 'anchor_keyword_is_enable'=>1,
  77 + 'project_id'=>$v['id']
  78 + ];
  79 + $webSettingModel->add($data);
70 } 80 }
71 DB::disconnect('custom_mysql'); 81 DB::disconnect('custom_mysql');
72 } 82 }
@@ -31,6 +31,17 @@ class InquiryForwardController extends BaseController @@ -31,6 +31,17 @@ class InquiryForwardController extends BaseController
31 if (isset($this->param['message'])) { 31 if (isset($this->param['message'])) {
32 $this->map['message'] = ['like', '%' . $this->map['message'] . '%']; 32 $this->map['message'] = ['like', '%' . $this->map['message'] . '%'];
33 } 33 }
  34 + if (isset($this->param['start_date']) && isset($this->param['end_date'])) {
  35 + $this->map['inquiry_date'] = ['between', [$this->map['start_date'], $this->map['end_date']]];
  36 + unset($this->map['start_date']);
  37 + unset($this->map['end_date']);
  38 + } elseif (isset($this->param['start_date'])) {
  39 + $this->map['inquiry_date'] = ['>=', $this->map['start_date']];
  40 + unset($this->map['start_date']);
  41 + } elseif (isset($this->param['end_date'])) {
  42 + $this->map['inquiry_date'] = ['<=', $this->map['end_date']];
  43 + unset($this->map['end_date']);
  44 + }
34 $lists = $inquiryForwardLogic->getInquiryLists($this->map, $this->page, $this->row, $this->order); 45 $lists = $inquiryForwardLogic->getInquiryLists($this->map, $this->page, $this->row, $this->order);
35 $this->response('success', Code::SUCCESS, $lists); 46 $this->response('success', Code::SUCCESS, $lists);
36 } 47 }
@@ -380,7 +380,7 @@ class ProjectController extends BaseController @@ -380,7 +380,7 @@ class ProjectController extends BaseController
380 * @time :2023/8/18 14:44 380 * @time :2023/8/18 14:44
381 */ 381 */
382 public function handleParam(&$item){ 382 public function handleParam(&$item){
383 - if($item['type'] != Project::TYPE_ZERO){ 383 + if(($item['type'] != Project::TYPE_ZERO)){
384 $data = APublicModel::getNumByProjectId($item['id']); 384 $data = APublicModel::getNumByProjectId($item['id']);
385 } 385 }
386 if($item['type'] == Project::TYPE_ONE){//建站中 386 if($item['type'] == Project::TYPE_ONE){//建站中
@@ -65,7 +65,7 @@ class AiBlogController extends BaseController @@ -65,7 +65,7 @@ class AiBlogController extends BaseController
65 foreach ($lists['list'] as $k => $v){ 65 foreach ($lists['list'] as $k => $v){
66 $v['image'] = getImageUrl($v['image']); 66 $v['image'] = getImageUrl($v['image']);
67 if(!empty($v['route'])){ 67 if(!empty($v['route'])){
68 - $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route']; 68 + $v['route'] = $this->user['domain'] . 'blog/' . $v['route'];
69 } 69 }
70 $lists['list'][$k] = $v; 70 $lists['list'][$k] = $v;
71 } 71 }
@@ -106,7 +106,7 @@ class AiBlogController extends BaseController @@ -106,7 +106,7 @@ class AiBlogController extends BaseController
106 if(!empty($lists) && !empty($lists['list'])){ 106 if(!empty($lists) && !empty($lists['list'])){
107 foreach ($lists['list'] as $k => $v){ 107 foreach ($lists['list'] as $k => $v){
108 $v['image'] = getImageUrl($v['image']); 108 $v['image'] = getImageUrl($v['image']);
109 - $v['route'] = $this->user['test_domain'] . 'user/' . $v['route']; 109 + $v['route'] = $this->user['domain'] . 'user/' . $v['route'];
110 $lists['list'][$k] = $v; 110 $lists['list'][$k] = $v;
111 } 111 }
112 } 112 }
@@ -173,9 +173,7 @@ class AiBlogController extends BaseController @@ -173,9 +173,7 @@ class AiBlogController extends BaseController
173 $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']); 173 $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']);
174 if(!empty($lists) && !empty($lists['list'])){ 174 if(!empty($lists) && !empty($lists['list'])){
175 foreach ($lists['list'] as $k => $v){ 175 foreach ($lists['list'] as $k => $v){
176 - if(!empty($v['route'])){  
177 - $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];  
178 - } 176 + $v['route'] = $this->user['domain'] . 'top-blog/' . (($v['route'] > 1) ? $v['route'] : '');
179 $lists['list'][$k] = $v; 177 $lists['list'][$k] = $v;
180 } 178 }
181 } 179 }
@@ -70,8 +70,42 @@ class AiVideoController extends BaseController @@ -70,8 +70,42 @@ class AiVideoController extends BaseController
70 'keyword.required' => '关键字不能为空', 70 'keyword.required' => '关键字不能为空',
71 'type.required' => '场景不能为空', 71 'type.required' => '场景不能为空',
72 ]); 72 ]);
73 - //获取当前项目的ai_blog设置  
74 $result = $aiVideoLogic->sendTask(); 73 $result = $aiVideoLogic->sendTask();
75 $this->response('success',Code::SUCCESS,$result); 74 $this->response('success',Code::SUCCESS,$result);
76 } 75 }
  76 +
  77 + /**
  78 + * @remark :更新任务
  79 + * @name :save
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2025/3/6 10:51
  83 + */
  84 + public function save(AiVideoLogic $aiVideoLogic){
  85 + $this->request->validate([
  86 + 'id'=>['required'],
  87 + ],[
  88 + 'id.required' => '关键字不能为空',
  89 + ]);
  90 + $aiVideoLogic->videoSave();
  91 + $this->response('success');
  92 + }
  93 +
  94 + /**
  95 + * @remark :删除ai视频
  96 + * @name :delete
  97 + * @author :lyh
  98 + * @method :post
  99 + * @time :2025/3/6 9:56
  100 + */
  101 + public function delete(AiVideoLogic $aiVideoLogic)
  102 + {
  103 + $this->request->validate([
  104 + 'ids'=>['required'],
  105 + ],[
  106 + 'ids.required' => 'ID不能为空'
  107 + ]);
  108 + $result = $aiVideoLogic->videoDelete();
  109 + $this->response('success',Code::SUCCESS,$result);
  110 + }
77 } 111 }
@@ -38,7 +38,7 @@ class ComController extends BaseController @@ -38,7 +38,7 @@ class ComController extends BaseController
38 } 38 }
39 $lists = $projectMenuModel->list($this->map,'sort'); 39 $lists = $projectMenuModel->list($this->map,'sort');
40 $menu = array(); 40 $menu = array();
41 - foreach ($lists as $k => $v){ 41 + foreach ($lists as $v){
42 $v = (array)$v; 42 $v = (array)$v;
43 if ($v['pid'] == 0) { 43 if ($v['pid'] == 0) {
44 $v['sub'] = _get_child($v['id'], $lists); 44 $v['sub'] = _get_child($v['id'], $lists);
@@ -57,9 +57,10 @@ class ComController extends BaseController @@ -57,9 +57,10 @@ class ComController extends BaseController
57 */ 57 */
58 public function seo_get_menu(){ 58 public function seo_get_menu(){
59 $seoMenuModel = new ProjectMenuSeo(); 59 $seoMenuModel = new ProjectMenuSeo();
  60 + $this->map['status'] = 0;
60 $lists = $seoMenuModel->list($this->map,'sort'); 61 $lists = $seoMenuModel->list($this->map,'sort');
61 $menu = array(); 62 $menu = array();
62 - foreach ($lists as $k => $v){ 63 + foreach ($lists as $v){
63 $v = (array)$v; 64 $v = (array)$v;
64 if ($v['pid'] == 0) { 65 if ($v['pid'] == 0) {
65 $v['sub'] = _get_child($v['id'], $lists); 66 $v['sub'] = _get_child($v['id'], $lists);
@@ -65,6 +65,14 @@ class InquiryForwardLogic extends BaseLogic @@ -65,6 +65,14 @@ class InquiryForwardLogic extends BaseLogic
65 public function getInquiryLists($map, $page, $row, $order = 'id', $filed = ['*']) 65 public function getInquiryLists($map, $page, $row, $order = 'id', $filed = ['*'])
66 { 66 {
67 $lists = $this->model->lists($map, $page, $row, $order, $filed); 67 $lists = $this->model->lists($map, $page, $row, $order, $filed);
  68 + //获取各个状态询盘总数
  69 + $lists['count_stat'] = [
  70 + 'all_count' => 0,
  71 + 'un_count' => 0,
  72 + 'suc_count' => 0,
  73 + 'inv_count' => 0,
  74 + ];
  75 +
68 return $this->success($lists); 76 return $this->success($lists);
69 } 77 }
70 78
@@ -111,7 +111,7 @@ class ProjectLogic extends BaseLogic @@ -111,7 +111,7 @@ class ProjectLogic extends BaseLogic
111 //升级项目采集完成时间 111 //升级项目采集完成时间
112 $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; 112 $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
113 //获取项目所属行业 113 //获取项目所属行业
114 - $info['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray(); 114 + $info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
115 115
116 return $this->success($info); 116 return $this->success($info);
117 } 117 }
@@ -182,8 +182,6 @@ class ProjectLogic extends BaseLogic @@ -182,8 +182,6 @@ class ProjectLogic extends BaseLogic
182 $this->saveProjectAfter($this->param['project_after']); 182 $this->saveProjectAfter($this->param['project_after']);
183 //单独保存小语种配置 183 //单独保存小语种配置
184 $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); 184 $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']);
185 - //单独保存行业信息  
186 - ProjectIndustryRelated::saveRelated($this->param['id'],$this->param['industry'] ?? []);  
187 //同步图片文件 185 //同步图片文件
188 $this->syncImageFile($this->param['project_location'],$this->param['id']); 186 $this->syncImageFile($this->param['project_location'],$this->param['id']);
189 //同步信息表 187 //同步信息表
@@ -427,6 +425,8 @@ class ProjectLogic extends BaseLogic @@ -427,6 +425,8 @@ class ProjectLogic extends BaseLogic
427 * @time :2023/8/30 13:45 425 * @time :2023/8/30 13:45
428 */ 426 */
429 protected function saveProjectDeployOptimize($deploy_optimize){ 427 protected function saveProjectDeployOptimize($deploy_optimize){
  428 + //单独保存行业信息
  429 + ProjectIndustryRelated::saveRelated($deploy_optimize['project_id'],$deploy_optimize['industry'] ?? []);
430 $deployOptimizeModel = new DeployOptimize(); 430 $deployOptimizeModel = new DeployOptimize();
431 if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){ 431 if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
432 //更改域名 432 //更改域名
@@ -56,7 +56,7 @@ class AiBlogLogic extends BaseLogic @@ -56,7 +56,7 @@ class AiBlogLogic extends BaseLogic
56 $aiBlogService = new AiBlogService(); 56 $aiBlogService = new AiBlogService();
57 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 57 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
58 $aiBlogService->key = $aiSettingInfo['key']; 58 $aiBlogService->key = $aiSettingInfo['key'];
59 - $aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]); 59 + $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']]);
60 }catch (\Exception $e){ 60 }catch (\Exception $e){
61 $this->fail('保存失败,请联系管理员'); 61 $this->fail('保存失败,请联系管理员');
62 } 62 }
@@ -101,12 +101,12 @@ class AiBlogLogic extends BaseLogic @@ -101,12 +101,12 @@ class AiBlogLogic extends BaseLogic
101 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 101 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
102 $aiBlogService->key = $aiSettingInfo['key']; 102 $aiBlogService->key = $aiSettingInfo['key'];
103 $aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en')); 103 $aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en'));
104 - $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); 104 + $result = $aiBlogService->createTask($this->param['keyword'],2,'blog',$this->param['anchor'] ?? []);
105 if($result['status'] == 200){ 105 if($result['status'] == 200){
106 $aiBlogTaskModel = new AiBlogTask(); 106 $aiBlogTaskModel = new AiBlogTask();
107 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]); 107 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]);
108 $aiBlogModel = new AiBlog(); 108 $aiBlogModel = new AiBlog();
109 - $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'], 109 + $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)
110 ]); 110 ]);
111 } 111 }
112 return $this->success(); 112 return $this->success();
@@ -50,41 +50,18 @@ class AiVideoLogic extends BaseLogic @@ -50,41 +50,18 @@ class AiVideoLogic extends BaseLogic
50 * @method :post 50 * @method :post
51 * @time :2023/7/5 14:46 51 * @time :2023/7/5 14:46
52 */ 52 */
53 - public function blogSave(){ 53 + public function videoSave(){
54 try { 54 try {
55 if(!empty($this->param['image'])){ 55 if(!empty($this->param['image'])){
56 $this->param['image'] = str_replace_url($this->param['image']); 56 $this->param['image'] = str_replace_url($this->param['image']);
57 } 57 }
58 - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']); 58 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_VIDEO, $this->param['id'], $this->user['project_id']);
59 $this->model->edit($this->param,['id'=>$this->param['id']]); 59 $this->model->edit($this->param,['id'=>$this->param['id']]);
60 $aiSettingInfo = $this->getProjectAiSetting(); 60 $aiSettingInfo = $this->getProjectAiSetting();
61 $aiBlogService = new AiBlogService(); 61 $aiBlogService = new AiBlogService();
62 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 62 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
63 $aiBlogService->key = $aiSettingInfo['key']; 63 $aiBlogService->key = $aiSettingInfo['key'];
64 - $aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]);  
65 - }catch (\Exception $e){  
66 - $this->fail('保存失败,请联系管理员');  
67 - }  
68 - return $this->success();  
69 - }  
70 -  
71 - /**  
72 - * @remark :编辑作者  
73 - * @name :saveAuthor  
74 - * @author :lyh  
75 - * @method :post  
76 - * @time :2025/2/21 14:46  
77 - */  
78 - public function saveBlogAuthor(){  
79 - try {  
80 - $aiAuthorModel = new AiBlogAuthor();  
81 - if(!empty($this->param['image'])){  
82 - $this->param['image'] = str_replace_url($this->param['image']);  
83 - }  
84 - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $this->param['id'], $this->user['project_id']);  
85 - $aiAuthorModel->edit($this->param,['id'=>$this->param['id']]);  
86 - $aiBlogService = new AiBlogService();  
87 - $aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]); 64 + $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']]);
88 }catch (\Exception $e){ 65 }catch (\Exception $e){
89 $this->fail('保存失败,请联系管理员'); 66 $this->fail('保存失败,请联系管理员');
90 } 67 }
@@ -97,7 +74,7 @@ class AiVideoLogic extends BaseLogic @@ -97,7 +74,7 @@ class AiVideoLogic extends BaseLogic
97 * @author :lyh 74 * @author :lyh
98 * @method :post 75 * @method :post
99 * @time :2025/2/14 10:28 76 * @time :2025/2/14 10:28
100 - * @detail :type=2/生成文章 type=3/更新列表页记录 77 + * @detail :createTask =>type=2/生成文章
101 * @detail :status=1/待执行 78 * @detail :status=1/待执行
102 */ 79 */
103 public function sendTask(){ 80 public function sendTask(){
@@ -106,23 +83,23 @@ class AiVideoLogic extends BaseLogic @@ -106,23 +83,23 @@ class AiVideoLogic extends BaseLogic
106 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 83 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
107 $aiBlogService->key = $aiSettingInfo['key']; 84 $aiBlogService->key = $aiSettingInfo['key'];
108 $aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en')); 85 $aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en'));
109 - $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type'],'video'); 86 + $result = $aiBlogService->createTask($this->param['keyword'],2,'video',$this->param['anchor'] ?? []);
110 if($result['status'] == 200){ 87 if($result['status'] == 200){
111 $aiBlogTaskModel = new AiBlogTask(); 88 $aiBlogTaskModel = new AiBlogTask();
112 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'task_id'=>$result['data']['task_id'],'status'=>1]); 89 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'task_id'=>$result['data']['task_id'],'status'=>1]);
113 - $this->model->addReturnId(['keyword'=>$this->param['keyword'],'status'=>1,'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id']]); 90 + $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)]);
114 } 91 }
115 return $this->success(); 92 return $this->success();
116 } 93 }
117 94
118 /** 95 /**
119 - * @remark :删除  
120 - * @name :blogDelete 96 + * @remark :删除aiVideo
  97 + * @name :videoDelete
121 * @author :lyh 98 * @author :lyh
122 * @method :post 99 * @method :post
123 - * @time :2025/2/20 18:21 100 + * @time :2025/3/6 10:00
124 */ 101 */
125 - public function blogDelete(){ 102 + public function videoDelete(){
126 try { 103 try {
127 $aiSettingInfo = $this->getProjectAiSetting(); 104 $aiSettingInfo = $this->getProjectAiSetting();
128 $aiBlogService = new AiBlogService(); 105 $aiBlogService = new AiBlogService();
@@ -132,12 +109,11 @@ class AiVideoLogic extends BaseLogic @@ -132,12 +109,11 @@ class AiVideoLogic extends BaseLogic
132 $aiBlogService->key = $aiSettingInfo['key']; 109 $aiBlogService->key = $aiSettingInfo['key'];
133 $aiBlogService->delDetail($info['task_id']); 110 $aiBlogService->delDetail($info['task_id']);
134 //删除路由映射 111 //删除路由映射
135 - RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); 112 + RouteMap::delRoute(RouteMap::SOURCE_AI_VIDEO, $id, $this->user['project_id']);
136 $this->model->del(['id'=>$id]); 113 $this->model->del(['id'=>$id]);
137 } 114 }
138 - shell_exec('php artisan save_ai_blog_list '.$this->user['project_id'].' > /dev/null 2>&1 &');  
139 }catch (\Exception $e){ 115 }catch (\Exception $e){
140 - $this->fail('删除失败'); 116 + $this->fail('删除失败,请联系管理员');
141 } 117 }
142 return $this->success(); 118 return $this->success();
143 } 119 }
@@ -64,7 +64,7 @@ class WebSettingTextLogic extends BaseLogic @@ -64,7 +64,7 @@ class WebSettingTextLogic extends BaseLogic
64 $this->param['anchor_keyword_is_enable'] = 0; 64 $this->param['anchor_keyword_is_enable'] = 0;
65 } 65 }
66 $data = [ 66 $data = [
67 - 'anchor_setting'=>$this->param['anchor_setting'], 67 + 'anchor_setting'=>$this->param['anchor_setting'] ?? [],
68 'anchor_is_enable'=>$this->param['anchor_is_enable'], 68 'anchor_is_enable'=>$this->param['anchor_is_enable'],
69 'anchor_num'=>$this->param['anchor_num'] ?? 0, 69 'anchor_num'=>$this->param['anchor_num'] ?? 0,
70 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0, 70 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0,
@@ -72,13 +72,15 @@ class WebSettingTextLogic extends BaseLogic @@ -72,13 +72,15 @@ class WebSettingTextLogic extends BaseLogic
72 ]; 72 ];
73 $web_setting->edit($data,['project_id'=>$this->user['project_id']]); 73 $web_setting->edit($data,['project_id'=>$this->user['project_id']]);
74 $this->model->del(['project_id'=>$this->user['project_id']]); 74 $this->model->del(['project_id'=>$this->user['project_id']]);
75 - foreach ($this->param['data'] as $k => $v){  
76 - $v['created_at'] = date('Y-m-d H:i:s');  
77 - $v['updated_at'] = date('Y-m-d H:i:s');  
78 - $v['project_id'] = $this->user['project_id'];  
79 - $this->param['data'][$k] = $v; 75 + if(!empty($this->param['data'])){
  76 + foreach ($this->param['data'] as $k => $v){
  77 + $v['created_at'] = date('Y-m-d H:i:s');
  78 + $v['updated_at'] = date('Y-m-d H:i:s');
  79 + $v['project_id'] = $this->user['project_id'];
  80 + $this->param['data'][$k] = $v;
  81 + }
  82 + $this->model->insert($this->param['data']);
80 } 83 }
81 - $this->model->insert($this->param['data']);  
82 DB::commit(); 84 DB::commit();
83 }catch (\Exception $e){ 85 }catch (\Exception $e){
84 DB::rollBack(); 86 DB::rollBack();
@@ -17,6 +17,7 @@ class Category extends Base @@ -17,6 +17,7 @@ class Category extends Base
17 protected $table = 'gl_product_category'; 17 protected $table = 'gl_product_category';
18 //连接数据库 18 //连接数据库
19 protected $connection = 'custom_mysql'; 19 protected $connection = 'custom_mysql';
  20 + use SoftDeletes;
20 21
21 const STATUS_ACTIVE = 1; 22 const STATUS_ACTIVE = 1;
22 //新闻产品分类列表分页条数 23 //新闻产品分类列表分页条数
@@ -34,6 +34,7 @@ class RouteMap extends Base @@ -34,6 +34,7 @@ class RouteMap extends Base
34 //自定义模块 34 //自定义模块
35 const SOURCE_MODULE = 'module'; 35 const SOURCE_MODULE = 'module';
36 const SOURCE_AI_BLOG = 'ai_blog'; 36 const SOURCE_AI_BLOG = 'ai_blog';
  37 + const SOURCE_AI_VIDEO = 'ai_video';
37 const SOURCE_AI_BLOG_AUTHOR = 'ai_blog_author';//ai博客作者 38 const SOURCE_AI_BLOG_AUTHOR = 'ai_blog_author';//ai博客作者
38 const SOURCE_AI_BLOG_LIST = 'ai_blog_list'; 39 const SOURCE_AI_BLOG_LIST = 'ai_blog_list';
39 //自定义模块分类 40 //自定义模块分类
@@ -70,16 +70,17 @@ class AiBlogService @@ -70,16 +70,17 @@ class AiBlogService
70 * @time :2025/2/13 14:39 70 * @time :2025/2/13 14:39
71 * @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url 71 * @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url
72 */ 72 */
73 - public function createTask($keyword,$type = 2,$subtype = 'Blog',$template_id = 1){ 73 + public function createTask($keyword,$type = 2,$subtype = 'Blog',$anchor = []){
74 $request_url = $this->url.'api/task/create'; 74 $request_url = $this->url.'api/task/create';
75 $param = [ 75 $param = [
76 - 'mch_id'=>$this->mch_id,  
77 'keyword'=>$keyword, 76 'keyword'=>$keyword,
78 'type'=>$type, 77 'type'=>$type,
79 'subtype'=>$subtype, 78 'subtype'=>$subtype,
80 - 'url'=>$this->route,  
81 - 'template_id'=>$template_id  
82 ]; 79 ];
  80 + $param['anchor'] = json_encode($anchor,true);
  81 + $param['url'] = $this->route;
  82 + $param['mch_id'] = $this->mch_id;
  83 + $param['template_id'] = 1;
83 $this->sign = $this->generateSign($param,$this->key); 84 $this->sign = $this->generateSign($param,$this->key);
84 $param['sign'] = $this->sign; 85 $param['sign'] = $this->sign;
85 $result = http_post($request_url,json_encode($param,true)); 86 $result = http_post($request_url,json_encode($param,true));
@@ -152,6 +152,13 @@ Route::middleware(['bloginauth'])->group(function () { @@ -152,6 +152,13 @@ Route::middleware(['bloginauth'])->group(function () {
152 152
153 //ai生成相关接口 153 //ai生成相关接口
154 Route::prefix('ai')->group(function () { 154 Route::prefix('ai')->group(function () {
  155 + //ai视屏
  156 + Route::prefix('video')->group(function () {
  157 + Route::any('/', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'lists'])->name('ai_video_lists');
  158 + Route::any('/getInfo', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'getInfo'])->name('ai_video_getInfo');
  159 + Route::any('/sendTask', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'sendTask'])->name('ai_video_sendTask');
  160 + Route::any('/del', [\App\Http\Controllers\Bside\Ai\AiVideoController::class, 'delete'])->name('ai_video_delete');
  161 + });
155 //ai 162 //ai
156 Route::any('/news/', [\App\Http\Controllers\Bside\Ai\AiNewsController::class, 'save'])->name('ai_news_save'); 163 Route::any('/news/', [\App\Http\Controllers\Bside\Ai\AiNewsController::class, 'save'])->name('ai_news_save');
157 Route::any('/blog/getAiBlog', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'getAiBlog'])->name('ai_blog_getAiBlog'); 164 Route::any('/blog/getAiBlog', [\App\Http\Controllers\Bside\Ai\AiBlogController::class, 'getAiBlog'])->name('ai_blog_getAiBlog');