作者 赵彬吉
@@ -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 }
1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :ForwardInquiryCount.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2023/8/18 9:41  
8 - */  
9 -  
10 -namespace App\Console\Commands\MonthlyCount;  
11 -  
12 -use App\Models\Inquiry\ForwardCount;  
13 -use Carbon\Carbon;  
14 -use Illuminate\Console\Command;  
15 -use Illuminate\Support\Facades\DB;  
16 -  
17 -/**  
18 - * @remark :转发询盘人员统计  
19 - * @name :ForwardInquiryCount  
20 - * @author :lyh  
21 - * @method :post  
22 - * @time :2023/8/18 9:42  
23 - */  
24 -class ForwardInquiryCount extends Command  
25 -{  
26 - /**  
27 - * The name and signature of the console command.  
28 - *  
29 - * @var string  
30 - */  
31 - protected $signature = 'forward_count';  
32 -  
33 - /**  
34 - * The console command description.  
35 - *  
36 - * @var string  
37 - */  
38 - protected $description = '月转发报告统计';  
39 -  
40 - /**  
41 - * @remark :统计报告  
42 - * @name :handle  
43 - * @author :lyh  
44 - * @method :post  
45 - * @time :2023/8/18 9:52  
46 - */  
47 - public function handle(){  
48 - // 获取上个月的开始时间  
49 - $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();  
50 - // 获取上个月的结束时间  
51 - $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();  
52 - $list = DB::table('gl_inquiry_info')->groupBy('user_name')  
53 - ->select("user_name",DB::raw('COUNT(*) as count'))  
54 - ->where('send_time','>=',$startTime.' 00:00:00')  
55 - ->where('send_time','<=',$endTime.' 23:59:59')  
56 - ->get();  
57 - if(!empty($list)){  
58 - $list = $list->toArray();  
59 - $forwardModel = new ForwardCount();  
60 - foreach ($list as $v){  
61 - $data = [  
62 - 'date'=>Carbon::now()->subMonth()->format('Y-m'),  
63 - 'name'=>$v['user_name'],  
64 - 'count'=>$v['count']  
65 - ];  
66 - $forwardModel->add($data);  
67 - }  
68 - }  
69 - return 1;  
70 - }  
71 -}  
@@ -26,7 +26,6 @@ class Kernel extends ConsoleKernel @@ -26,7 +26,6 @@ class Kernel extends ConsoleKernel
26 // $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 26 // $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
27 // $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 27 // $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
28 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 28 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
29 - $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录  
30 // $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 29 // $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
31 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 30 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
32 // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 31 // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次
@@ -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);