定时推送微信公众号
This commit is contained in:
@@ -48,9 +48,9 @@ class Cronwechat extends Controller
|
|||||||
}
|
}
|
||||||
//获取上传素材接口
|
//获取上传素材接口
|
||||||
$aUploadParm = ['article_id' => $value,'template_id' => $iTemplateId];
|
$aUploadParm = ['article_id' => $value,'template_id' => $iTemplateId];
|
||||||
$aResult = json_decode($oAiarticle->uploadMaterial([$aUploadParm]),true);
|
$aResult = json_decode($oAiarticle->uploadMaterial($aUploadParm),true);
|
||||||
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||||
$sMsg = empty($aResult['msg']) ? '操作异常'."\n" : '上传素材失败:'.$aResult['msg'];
|
$sMsg = empty($aResult['msg']) ? '操作异常'."\n" : $aResult['msg'];
|
||||||
$aLogInfo = ['article_id' => $value,'type' => 1,'msg' => $sMsg,'status' => 1,'create_time' => time()];
|
$aLogInfo = ['article_id' => $value,'type' => 1,'msg' => $sMsg,'status' => 1,'create_time' => time()];
|
||||||
if($iStatus != 1){
|
if($iStatus != 1){
|
||||||
$aLogInfo['status'] = 2;
|
$aLogInfo['status'] = 2;
|
||||||
@@ -61,9 +61,9 @@ class Cronwechat extends Controller
|
|||||||
$aLog[] = $aLogInfo;
|
$aLog[] = $aLogInfo;
|
||||||
|
|
||||||
//推送草稿箱
|
//推送草稿箱
|
||||||
$aResult = json_decode($oAiarticle->syncWechat([$aUploadParm]),true);
|
$aResult = json_decode($oAiarticle->syncWechat($aUploadParm),true);
|
||||||
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||||
$sMsg = empty($aResult['msg']) ? '操作异常'."\n" : '推送草稿箱失败:'.$aResult['msg'];
|
$sMsg = empty($aResult['msg']) ? '操作异常'."\n" : $aResult['msg'];
|
||||||
$aLogInfo = ['article_id' => $value,'type' => 2,'msg' => $sMsg,'status' => 1,'create_time' => time()];
|
$aLogInfo = ['article_id' => $value,'type' => 2,'msg' => $sMsg,'status' => 1,'create_time' => time()];
|
||||||
if($iStatus != 1){
|
if($iStatus != 1){
|
||||||
$aLogInfo['status'] = 2;
|
$aLogInfo['status'] = 2;
|
||||||
@@ -80,7 +80,7 @@ class Cronwechat extends Controller
|
|||||||
$this->showMessage('插入日志记录失败:'.json_encode($aLog)."\n",2);
|
$this->showMessage('插入日志记录失败:'.json_encode($aLog)."\n",2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->showMessage('AI生成的文章推送草稿箱成功:'.$sDate."\n",1);
|
$this->showMessage('AI生成的文章推送草稿箱完成:'.$sDate."\n",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,9 +124,9 @@ class Cronwechat extends Controller
|
|||||||
}
|
}
|
||||||
//发布草稿箱
|
//发布草稿箱
|
||||||
$aUploadParm = ['article_id' => $value['article_id'],'template_id' => $value['template_id']];
|
$aUploadParm = ['article_id' => $value['article_id'],'template_id' => $value['template_id']];
|
||||||
$aResult = json_decode($oAiarticle->publishDraft([$aUploadParm]),true);
|
$aResult = json_decode($oAiarticle->publishDraft($aUploadParm),true);
|
||||||
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
$iStatus = empty($aResult['status']) ? 0 : $aResult['status'];
|
||||||
$sMsg = empty($aResult['msg']) ? '操作异常'."\n" : '发布草稿箱文章失败:'.$aResult['msg'];
|
$sMsg = empty($aResult['msg']) ? '操作异常'."\n" : $aResult['msg']."\n";
|
||||||
if($iStatus != 1){
|
if($iStatus != 1){
|
||||||
$aLogInfo['msg'] = $sMsg;
|
$aLogInfo['msg'] = $sMsg;
|
||||||
$aLogInfo['status'] = 2;
|
$aLogInfo['status'] = 2;
|
||||||
@@ -134,6 +134,7 @@ class Cronwechat extends Controller
|
|||||||
$this->showMessage('文章ID:'.$value.'====='.$sMsg."\n",2);
|
$this->showMessage('文章ID:'.$value.'====='.$sMsg."\n",2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$aLogInfo['msg'] = $sMsg;
|
||||||
$aLog[] = $aLogInfo;
|
$aLog[] = $aLogInfo;
|
||||||
}
|
}
|
||||||
//插入操作日志
|
//插入操作日志
|
||||||
@@ -143,7 +144,7 @@ class Cronwechat extends Controller
|
|||||||
$this->showMessage('插入日志记录失败:'.json_encode($aLog)."\n",2);
|
$this->showMessage('插入日志记录失败:'.json_encode($aLog)."\n",2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->showMessage('AI生成的文章发布草稿箱成功:'.$sDate."\n",1);
|
$this->showMessage('AI生成的文章发布草稿箱完成:'.$sDate."\n",1);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user