From 03be3f446b09e921833130f682eb602db6a4cf48 Mon Sep 17 00:00:00 2001 From: chengxl Date: Wed, 28 May 2025 14:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/job/WechatMaterial.php | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 application/api/job/WechatMaterial.php diff --git a/application/api/job/WechatMaterial.php b/application/api/job/WechatMaterial.php new file mode 100644 index 0000000..dceae42 --- /dev/null +++ b/application/api/job/WechatMaterial.php @@ -0,0 +1,40 @@ +uploadMaterial($data),true); + $iStatus = empty($aResult['status']) ? 0 : $aResult['status']; + $sMsg = empty($aResult['msg']) ? '' : $aResult['msg']; + if ($iStatus != 1) { + $iStatus = 2; + $sMsg = empty($sMsg) ? '素材上传失败' : $sMsg; + } + //插入日志记录 + $aLogInfo = ['article_id' => $data['article_id'],'type' => 1,'msg' =>$sMsg,'status' => $iStatus,'create_time' => time()]; + $result = json_decode($oAiarticle->addWechatLog($aLogInfo),true); + $iStatus = empty($result['status']) ? 0 : $result['status']; + $sMsg = empty($result['msg']) ? '插入日志记录失败' : $result['msg']; + if($iStatus != 1){ + Log::error($sMsg."\n".json_encode($aLogInfo) . $e->getMessage()); + } + } + + } catch (\Exception $e) { + Log::error("上传素材任务异常:" . $e->getMessage()); + }finally { + gc_collect_cycles(); // 强制垃圾回收 + } + } + +} \ No newline at end of file