作者 李宇航

合并分支 'master-server' 到 'master'

Master server



查看合并请求 !1109
@@ -61,7 +61,7 @@ class AiBlogTask extends Command @@ -61,7 +61,7 @@ class AiBlogTask extends Command
61 //保存当前项目ai_blog数据 61 //保存当前项目ai_blog数据
62 ProjectServer::useProject($info['project_id']); 62 ProjectServer::useProject($info['project_id']);
63 $aiBlogModel = new AiBlog(); 63 $aiBlogModel = new AiBlog();
64 - $aiBlogModel->edit(['new_title'=>$result['data']['title'] ?? '','text'=>$result['data']['text'] ?? '','status'=>2],['task_id'=>$info['task_id']]); 64 + $aiBlogModel->edit(['new_title'=>$result['data']['title'],'image'=>$result['data']['thumb'],'text'=>$result['data']['section'],'status'=>2],['task_id'=>$info['task_id']]);
65 DB::disconnect('custom_mysql'); 65 DB::disconnect('custom_mysql');
66 echo '结束->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s'); 66 echo '结束->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
67 } 67 }
@@ -2,11 +2,13 @@ @@ -2,11 +2,13 @@
2 2
3 namespace App\Http\Logic\Bside\Ai; 3 namespace App\Http\Logic\Bside\Ai;
4 4
  5 +use App\Helper\Translate;
5 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
6 use App\Models\Ai\AiBlog; 7 use App\Models\Ai\AiBlog;
7 use App\Models\Project\AiBlogTask; 8 use App\Models\Project\AiBlogTask;
8 use App\Models\Project\Project; 9 use App\Models\Project\Project;
9 use App\Models\Project\ProjectAiSetting; 10 use App\Models\Project\ProjectAiSetting;
  11 +use App\Models\RouteMap\RouteMap;
10 use App\Services\AiBlogService; 12 use App\Services\AiBlogService;
11 13
12 class AiBlogLogic extends BaseLogic 14 class AiBlogLogic extends BaseLogic
@@ -50,6 +52,9 @@ class AiBlogLogic extends BaseLogic @@ -50,6 +52,9 @@ class AiBlogLogic extends BaseLogic
50 $aiBlogService = new AiBlogService(); 52 $aiBlogService = new AiBlogService();
51 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 53 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
52 $aiBlogService->key = $aiSettingInfo['key']; 54 $aiBlogService->key = $aiSettingInfo['key'];
  55 + if(!empty($this->param['route'])){
  56 + $aiBlogService->route = generateRoute(Translate::tran($this->param['route'], 'en'));
  57 + }
53 $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); 58 $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']);
54 if($result['status'] == 200){ 59 if($result['status'] == 200){
55 try { 60 try {
@@ -362,6 +362,7 @@ class KeywordLogic extends BaseLogic @@ -362,6 +362,7 @@ class KeywordLogic extends BaseLogic
362 $routeMapModel->del(['source'=>'product_keyword']); 362 $routeMapModel->del(['source'=>'product_keyword']);
363 $productModel = new Product(); 363 $productModel = new Product();
364 $productModel->edit(['keyword_id'=>''],['id'=>['>',0]]); 364 $productModel->edit(['keyword_id'=>''],['id'=>['>',0]]);
  365 + $this->curlDelRoute(['old_route'=>'all_product_keyword']);
365 DB::commit(); 366 DB::commit();
366 }catch (\Exception $e){ 367 }catch (\Exception $e){
367 DB::rollBack(); 368 DB::rollBack();
@@ -17,7 +17,7 @@ class AiBlogService @@ -17,7 +17,7 @@ class AiBlogService
17 public $sign = '';//签名 17 public $sign = '';//签名
18 public $key = 'b3e4c722b821';//默认key 18 public $key = 'b3e4c722b821';//默认key
19 19
20 - public $webhook = 'https://develop.globalso.com/api/ai_webhook';//回调地址 20 + public $route = '';//回调地址
21 21
22 public $task_id = '';//任务id 22 public $task_id = '';//任务id
23 /** 23 /**
@@ -69,14 +69,14 @@ class AiBlogService @@ -69,14 +69,14 @@ class AiBlogService
69 * @time :2025/2/13 14:39 69 * @time :2025/2/13 14:39
70 * @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url 70 * @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url
71 */ 71 */
72 - public function createTask($keyword,$type = 1,$subtype = 'Blog',$template_id = 1){ 72 + public function createTask($keyword,$type = 2,$subtype = 'Blog',$template_id = 1){
73 $request_url = $this->url.'api/task/create'; 73 $request_url = $this->url.'api/task/create';
74 $param = [ 74 $param = [
75 'mch_id'=>$this->mch_id, 75 'mch_id'=>$this->mch_id,
76 'keyword'=>$keyword, 76 'keyword'=>$keyword,
77 'type'=>$type, 77 'type'=>$type,
78 'subtype'=>$subtype, 78 'subtype'=>$subtype,
79 - 'url'=>$this->webhook, 79 + 'url'=>$this->route,
80 'template_id'=>$template_id 80 'template_id'=>$template_id
81 ]; 81 ];
82 $this->sign = $this->generateSign($param,$this->key); 82 $this->sign = $this->generateSign($param,$this->key);