作者 lyh

变更数据

@@ -26,10 +26,8 @@ use App\Services\DingService; @@ -26,10 +26,8 @@ use App\Services\DingService;
26 use App\Services\ProjectServer; 26 use App\Services\ProjectServer;
27 use Illuminate\Console\Command; 27 use Illuminate\Console\Command;
28 use App\Models\Project\AiBlogTask as AiBlogTaskModel; 28 use App\Models\Project\AiBlogTask as AiBlogTaskModel;
29 -use Illuminate\Support\Facades\Cache;  
30 use Illuminate\Support\Facades\DB; 29 use Illuminate\Support\Facades\DB;
31 use Illuminate\Support\Facades\Redis; 30 use Illuminate\Support\Facades\Redis;
32 -use function Symfony\Component\String\s;  
33 31
34 class AiBlogTask extends Command 32 class AiBlogTask extends Command
35 { 33 {
@@ -257,14 +255,21 @@ class AiBlogTask extends Command @@ -257,14 +255,21 @@ class AiBlogTask extends Command
257 $saveData = []; 255 $saveData = [];
258 $result = $aiBlogService->getAiBlogList($page,15); 256 $result = $aiBlogService->getAiBlogList($page,15);
259 if(!isset($result['status']) || $result['status'] != 200){ 257 if(!isset($result['status']) || $result['status'] != 200){
260 - // 钉钉通知  
261 - $dingService = new DingService();  
262 - $body = [  
263 - 'keyword' => 'AI_BLOG列表页未生成拉取失败',  
264 - 'msg' => '项目ID:' . $project_id . PHP_EOL . '返回信息:' . json_encode($result,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),  
265 - 'isAtAll' => false, // 是否@所有人  
266 - ];  
267 - $dingService->handle($body); 258 + try {
  259 + // 钉钉通知
  260 + $dingService = new DingService();
  261 + $body = [
  262 + 'keyword' => 'AI_BLOG列表页未生成拉取失败',
  263 + 'msg' => '项目ID:' . $project_id . PHP_EOL . '返回信息:' . json_encode($result,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
  264 + 'isAtAll' => false, // 是否@所有人
  265 + ];
  266 + $dingService->handle($body);
  267 + //写一条更新记录
  268 + $aiBlogTaskModel = new AiBlogTaskModel();
  269 + $aiBlogTaskModel->addReturnId(['project_id'=>$project_id,'task_id'=>$project_id,'status'=>$aiBlogTaskModel::STATUS_RUNNING,'type'=>$aiBlogTaskModel::TYPE_LIST]);
  270 + }catch (\Exception $e){
  271 + $this->output('更新列表页失败同时通知失败--error:' . $e->getMessage());
  272 + }
268 return true; 273 return true;
269 } 274 }
270 $total_page = $result['data']['total_page']; 275 $total_page = $result['data']['total_page'];
@@ -27,4 +27,5 @@ class AiBlogTask extends Base @@ -27,4 +27,5 @@ class AiBlogTask extends Base
27 const TYPE_AUTHOR = 1; 27 const TYPE_AUTHOR = 1;
28 const TYPE_BLOG = 2; 28 const TYPE_BLOG = 2;
29 const TYPE_AUTHOR_ID = 3;//根据对应id页面 29 const TYPE_AUTHOR_ID = 3;//根据对应id页面
  30 + const TYPE_LIST = 4;//更新列表页
30 } 31 }