作者 赵彬吉

update

  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: zhl
  5 + * Date: 2024/09/30
  6 + * Time: 14:01
  7 + */
  8 +namespace App\Console\Commands\Inquiry;
  9 +
  10 +use App\Enums\Common\Code;
  11 +use App\Helper\Arr;
  12 +use App\Models\Inquiry\ReInquiryForm;
  13 +use App\Models\Inquiry\ReInquiryText;
  14 +use App\Utils\HttpUtils;
  15 +use GuzzleHttp\Exception\GuzzleException;
  16 +use Illuminate\Console\Command;
  17 +
  18 +/**
  19 + * Class SyncInquiry
  20 + * @package App\Console\Commands\Inquiry
  21 + */
  22 +class SyncInquiryText extends Command
  23 +{
  24 + /**
  25 + * The name and signature of the console command.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $signature = 'sync_inquiry_text';
  30 +
  31 + /**
  32 + * The console command description.
  33 + *
  34 + * @var string
  35 + */
  36 + protected $description = '同步询盘文案';
  37 +
  38 + /**
  39 + * Create a new command instance.
  40 + *
  41 + * @return void
  42 + */
  43 + public function __construct()
  44 + {
  45 + parent::__construct();
  46 + }
  47 +
  48 + /**
  49 + * @return bool
  50 + */
  51 + public function handle()
  52 + {
  53 + $res = HttpUtils::get('https://fob.ai.cc/api/get_inquiry_text', ['type' => 'all']);
  54 + if($res){
  55 + $res = Arr::s2a($res);
  56 + foreach ($res as $item){
  57 + ReInquiryText::createText($item['id'], $item['title'], $item['content'], $item['status']);
  58 + }
  59 + }
  60 + }
  61 +
  62 +}
@@ -42,6 +42,8 @@ class Kernel extends ConsoleKernel @@ -42,6 +42,8 @@ class Kernel extends ConsoleKernel
42 // 每日推送已完成视频任务项目生成对应界面 42 // 每日推送已完成视频任务项目生成对应界面
43 //更新AI站点数据 43 //更新AI站点数据
44 $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); 44 $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1);
  45 + //每日同步询盘文案
  46 + $schedule->command('sync_inquiry_text')->dailyAt('09:00')->withoutOverlapping(1);
45 } 47 }
46 48
47 /** 49 /**