|
...
|
...
|
@@ -207,20 +207,26 @@ class ProjectLogic extends BaseLogic |
|
|
|
if($languageInfo == false){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if(($this->param['is_ai_blog'] == 1) && ($projectInfo['is_ai_blog'] == 0)){//第一次新增
|
|
|
|
$aiSettingModel = new ProjectAiSetting();
|
|
|
|
$aiSettingInfo = $aiSettingModel->read(['project_id'=>$project_id]);
|
|
|
|
if($aiSettingInfo === false){
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
|
|
$result = $aiBlogService->createProject($this->param['title'],$languageInfo['short'],$projectInfo['company']);
|
|
|
|
if($result['status'] == 200){
|
|
|
|
//查看当前项目是否已有记录
|
|
|
|
$resData = [
|
|
|
|
'project_id'=>$project_id,
|
|
|
|
'mch_id'=>$result['data']['mch_id'],
|
|
|
|
'key'=>$result['data']['key'],
|
|
|
|
];
|
|
|
|
$aiSettingModel = new ProjectAiSetting();
|
|
|
|
$aiSettingModel->add($resData);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//有信息更新
|
|
|
|
if(($projectInfo['title'] != $this->param['title']) || ($languageInfo['short'] != $this->param['short'])){
|
|
|
|
$aiBlogService = new AiBlogService();
|
|
|
|
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
|
|
|
|
$aiBlogService->key = $aiSettingInfo['key'];
|
|
|
|
$result = $aiBlogService->updatedProject($this->param['title'],$languageInfo['short']);
|
|
|
|
if($result['status'] == 200){
|
|
|
|
$resData = [
|
|
...
|
...
|
@@ -231,6 +237,7 @@ class ProjectLogic extends BaseLogic |
|
|
|
$aiSettingModel->edit($resData,['project_id'=>$project_id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|