|
...
|
...
|
@@ -28,30 +28,70 @@ class AiBlogLogic extends BaseLogic |
|
|
|
* @time :2023/7/5 14:46
|
|
|
|
*/
|
|
|
|
public function blogSave(){
|
|
|
|
if(!empty($this->param['image'])){
|
|
|
|
$this->param['image'] = str_replace_url($this->param['image']);
|
|
|
|
}
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
try {
|
|
|
|
if(!empty($this->param['image'])){
|
|
|
|
$this->param['image'] = str_replace_url($this->param['image']);
|
|
|
|
}
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
$aiSettingInfo = $this->getProjectAiSetting();
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
|
|
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
$aiBlogService->key = $aiSettingInfo['key'];
|
|
|
|
$aiBlogService->route = $this->param['route'];
|
|
|
|
$aiBlogService->author_id = $this->param['author_id'];
|
|
|
|
$aiBlogService->updateDetail($this->param['title'],$this->param['image']);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('保存失败,请联系管理员');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :发布任务
|
|
|
|
* @name :sendTask
|
|
|
|
* @remark :获取配置信息
|
|
|
|
* @name :getProjectAiSetting
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/2/14 10:28
|
|
|
|
* @time :2025/2/21 14:51
|
|
|
|
*/
|
|
|
|
public function sendTask(){
|
|
|
|
public function getProjectAiSetting(){
|
|
|
|
$projectAiSettingModel = new ProjectAiSetting();
|
|
|
|
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($aiSettingInfo === false){
|
|
|
|
$this->fail('请先联系管理员开启Ai博客');
|
|
|
|
}
|
|
|
|
return $aiSettingInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :编辑作者
|
|
|
|
* @name :saveAuthor
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/2/21 14:46
|
|
|
|
*/
|
|
|
|
public function saveBlogAuthor(){
|
|
|
|
try {
|
|
|
|
if(!empty($this->param['image'])){
|
|
|
|
$this->param['image'] = str_replace_url($this->param['image']);
|
|
|
|
}
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $this->param['id'], $this->user['project_id']);
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('保存失败,请联系管理员');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :发布任务
|
|
|
|
* @name :sendTask
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/2/14 10:28
|
|
|
|
*/
|
|
|
|
public function sendTask(){
|
|
|
|
$aiSettingInfo = $this->getProjectAiSetting();
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
|
|
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
$aiBlogService->key = $aiSettingInfo['key'];
|
|
...
|
...
|
@@ -77,11 +117,7 @@ class AiBlogLogic extends BaseLogic |
|
|
|
* @time :2025/2/20 10:46
|
|
|
|
*/
|
|
|
|
public function createAuthor(){
|
|
|
|
$projectAiSettingModel = new ProjectAiSetting();
|
|
|
|
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($aiSettingInfo === false){
|
|
|
|
$this->fail('请先联系管理员开启Ai博客');
|
|
|
|
}
|
|
|
|
$aiSettingInfo = $this->getProjectAiSetting();
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
|
|
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
$aiBlogService->key = $aiSettingInfo['key'];
|
...
|
...
|
|