作者 lyh

gx添加随机模块

@@ -177,6 +177,13 @@ class IndexController extends BaseController @@ -177,6 +177,13 @@ class IndexController extends BaseController
177 'text.required' => '文本text不能为空', 177 'text.required' => '文本text不能为空',
178 'lang.required' => '语种不能为空', 178 'lang.required' => '语种不能为空',
179 ]); 179 ]);
  180 + if($this->param['lang'] == 0){
  181 + $lang = Translate::translateSl($this->param['text']);
  182 + $this->param['lang'] = $lang['texts']['sl'] ?? '';
  183 + }
  184 + if(empty($this->param['lang'])){
  185 + $this->fail('未获取到语种');
  186 + }
180 $service = new HumanizeAiTextService(); 187 $service = new HumanizeAiTextService();
181 $data = $service->humanizer($this->param['text'],$this->param['lang']); 188 $data = $service->humanizer($this->param['text'],$this->param['lang']);
182 $this->response('success', Code::SUCCESS, $data); 189 $this->response('success', Code::SUCCESS, $data);
@@ -139,11 +139,14 @@ class AiBlogLogic extends BaseLogic @@ -139,11 +139,14 @@ class AiBlogLogic extends BaseLogic
139 try { 139 try {
140 $aiSettingInfo = $this->getProjectAiSetting(); 140 $aiSettingInfo = $this->getProjectAiSetting();
141 $aiBlogService = new AiBlogService(); 141 $aiBlogService = new AiBlogService();
  142 + $aiBlogTask = new AiBlogTask();
142 foreach ($this->param['ids'] as $id) { 143 foreach ($this->param['ids'] as $id) {
143 - $info = $this->model->read(['id'=>$id],['task_id','route']); 144 + $info = $this->model->read(['id'=>$id],['task_id','route','author_id']);
144 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 145 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
145 $aiBlogService->key = $aiSettingInfo['key']; 146 $aiBlogService->key = $aiSettingInfo['key'];
146 $aiBlogService->delDetail($info['task_id']); 147 $aiBlogService->delDetail($info['task_id']);
  148 + //重新生成作者页面
  149 + $aiBlogTask->addReturnId(['type'=>$aiBlogTask::TYPE_AUTHOR_ID,'task_id'=>$info['author_id'],'status'=>1,'project_id'=>$this->user['project_id']]);
147 //删除路由映射 150 //删除路由映射
148 RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); 151 RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
149 $this->model->del(['id'=>$id]); 152 $this->model->del(['id'=>$id]);