From e4e4a97b126db91143aa1dbf3af0e2ed19c371ac Mon Sep 17 00:00:00 2001 From: chengxl Date: Fri, 30 May 2025 16:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=9F=E5=88=97=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/Material.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/application/common/Material.php b/application/common/Material.php index 7a8b82f..d053b3e 100644 --- a/application/common/Material.php +++ b/application/common/Material.php @@ -527,6 +527,7 @@ class Material if(empty($iArticleId)){ return json_encode(['status' => 2,'msg' => 'article_id is empty']); } + //期刊ID $iJournalId = empty($aParam['journal_id']) ? '' : $aParam['journal_id']; if(empty($iJournalId)){ @@ -705,4 +706,36 @@ class Material } return json_encode(['status' => 1,'msg' => 'Successfully obtained data','data' => $aData]); } + + + /** + * 对接微信公众号日志 + */ + public function addWechatLog($aParam = []){ + //获取参数 + $aParam = empty($aParam) ? $this->request->post() : $aParam; + //必填参数验证 + if(empty($aParam['article_id']) || empty($aParam['type'])){ + return json_encode(['status' => 2, 'msg' => '非法操作']); + } + $result = Db::name('wechat_api_log')->insertGetId($aParam); + if($result === false){ + return json_encode(['status' => 3, 'msg' => '数据插入失败'.Db::getLastSql()."\n数据内容:",'data' => $aParam]); + } + return json_encode(['status' => 1, 'msg' => '日志插入成功']); + } + + /** + * 获取公众号 + */ + public function getWechatLog($aParam = []){ + //获取参数 + $aParam = empty($aParam) ? $this->request->post() : $aParam; + //必填参数验证 + if(empty($aParam['article_id']) || empty($aParam['type'])){ + return json_encode(['status' => 2, 'msg' => '非法操作']); + } + $aLog = Db::name('wechat_api_log')->where($aParam)->find(); + return json_encode(['status' => 1, 'msg' => '获取数据成功','data' => $aLog]); + } }