正在显示
1 个修改的文件
包含
23 行增加
和
15 行删除
| @@ -54,22 +54,30 @@ class GeoWritingsTask extends Command | @@ -54,22 +54,30 @@ class GeoWritingsTask extends Command | ||
| 54 | //生成内容 | 54 | //生成内容 |
| 55 | $aiCommand2 = "请根据这个文章标题:{$info['title']},并同时参考公司的介绍{$info['description']},以及公司参与的事件内容{$info['event_content']},给我写一篇英文Press Release内容正文(已经有前言内容了),内容请参考并引用“{$info['prefix']}{$info['keyword']}{$info['suffix']}”行业的一些专业数据报告,新闻内容需要 5-6 个大纲,每个大纲需要标题和 1-2 段内容,最后1-2个大纲主要介绍企业的核心优势、主营产品应用场景、主要客户案例,并最后附带内容{$info['footer']},最后只需要回复我新闻稿内容,整个新闻稿内容字数1000字左右,不需要别的内容(比如序号、你的提示、寒暄、解释、注释之类的)。"; | 55 | $aiCommand2 = "请根据这个文章标题:{$info['title']},并同时参考公司的介绍{$info['description']},以及公司参与的事件内容{$info['event_content']},给我写一篇英文Press Release内容正文(已经有前言内容了),内容请参考并引用“{$info['prefix']}{$info['keyword']}{$info['suffix']}”行业的一些专业数据报告,新闻内容需要 5-6 个大纲,每个大纲需要标题和 1-2 段内容,最后1-2个大纲主要介绍企业的核心优势、主营产品应用场景、主要客户案例,并最后附带内容{$info['footer']},最后只需要回复我新闻稿内容,整个新闻稿内容字数1000字左右,不需要别的内容(比如序号、你的提示、寒暄、解释、注释之类的)。"; |
| 56 | $main = $gptHelper->openai_chat_qqs($aiCommand2); | 56 | $main = $gptHelper->openai_chat_qqs($aiCommand2); |
| 57 | - $data = [ | ||
| 58 | - 'introduction'=>$introduction, | ||
| 59 | - 'main'=>$main, | ||
| 60 | - 'status'=>2 | ||
| 61 | - ]; | ||
| 62 | - $geoWritingsTaskModel->edit($data,['task_id'=>$task_id]); | 57 | + $images = explode(',',$info['img']); |
| 63 | //组装一条数据 | 58 | //组装一条数据 |
| 64 | - $geoWritingsModel = new GeoWritings(); | ||
| 65 | - $saveData = [ | ||
| 66 | - 'project_id'=>$info['project_id'], | ||
| 67 | - 'type'=>$geoWritingsModel::TYPE_AI_CREATE, | ||
| 68 | - 'title'=>$info['title'], | ||
| 69 | - 'content'=>$introduction.PHP_EOL.$main, | ||
| 70 | - 'content_length'=>strlen($introduction.PHP_EOL.$main), | ||
| 71 | - 'uniqid'=>md5(uniqid().$task_id.$info['project_id']), | ||
| 72 | - ]; | 59 | + try { |
| 60 | + $geoWritingsModel = new GeoWritings(); | ||
| 61 | + $saveData = [ | ||
| 62 | + 'project_id'=>$info['project_id'], | ||
| 63 | + 'type'=>$geoWritingsModel::TYPE_AI_CREATE, | ||
| 64 | + 'title'=>$info['title'], | ||
| 65 | + 'content'=>$introduction.($images[0] ?? '').PHP_EOL.$main.($images[1] ?? ''), | ||
| 66 | + 'content_length'=>strlen($introduction.PHP_EOL.$main), | ||
| 67 | + 'uniqid'=>md5(uniqid().$task_id.$info['project_id']), | ||
| 68 | + ]; | ||
| 69 | + $id = $geoWritingsModel->addReturnId($saveData); | ||
| 70 | + $data = [ | ||
| 71 | + 'introduction'=>$introduction, | ||
| 72 | + 'main'=>$main, | ||
| 73 | + 'status'=>2, | ||
| 74 | + 'writings_id'=>$id, | ||
| 75 | + ]; | ||
| 76 | + $geoWritingsTaskModel->edit($data,['task_id'=>$task_id]); | ||
| 77 | + }catch (\Exception $e){ | ||
| 78 | + echo date('Y-m-d H:i:s').'保存失败:'.$task_id.$e->getMessage().PHP_EOL; | ||
| 79 | + continue; | ||
| 80 | + } | ||
| 73 | } | 81 | } |
| 74 | } | 82 | } |
| 75 | 83 |
-
请 注册 或 登录 后发表评论