From 08b3c970276c9c9f1d36429baa5caf5dd7b6acbc Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 20 May 2025 11:52:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/crontab/controller/Cite.php | 70 +++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 application/crontab/controller/Cite.php diff --git a/application/crontab/controller/Cite.php b/application/crontab/controller/Cite.php new file mode 100644 index 0000000..f1f21b7 --- /dev/null +++ b/application/crontab/controller/Cite.php @@ -0,0 +1,70 @@ +request->post(); + + //开始时间 + $sDate = empty($aParam['date']) ? date('Y-m-d') : $aParam['date'];//date('Y-m-d'); + $sStartDate = strtotime(date($sDate.' 00:00:00', strtotime('-1 day'))); + //结束时间 + $sEndDate = strtotime(date($sDate.'23:59:59', strtotime('-1 day'))); + + //获取前一天被引用的文章记录 + $aWhere = ['state' => 1,'ctime' => ['between',[$sStartDate,$sEndDate]]]; + $aArticleCite = Db::name('article_cite')->field('article_id,journal_id,journal_name,article_name,factor,date,ctime,state,article_cite_id')->where($aWhere)->select(); + if(empty($aArticleCite)){ + return json_encode(['status' => 1,'msg' => 'Article citation record is empty','data' => []]); + } + + + //处理数据-获取通讯作者信息 + $aArticleId = array_column($aArticleCite, 'article_id'); + $aWhere = ['article_id' => ['in',$aArticleId],'is_report' => 1]; + $aArticleAuthor = Db::name('article_author')->field('article_id,author_name,email')->where($aWhere)->select(); + if(empty($aArticleAuthor)){ + return json_encode(['status' => 1,'msg' => 'No corresponding author information found for the article','data' => []]); + } + + //处理数据-获取文章信息 + $aArticleId = array_unique(array_column($aArticleCite, 'article_id')); + $aWhere = ['article_id' => ['in',$aArticleId]]; + $aArticle = Db::name('article')->where($aWhere)->column('article_id,title'); + + //处理数据-获取期刊信息 + $aJournalId = array_unique(array_column($aArticleCite, 'journal_id')); + $aWhere = ['journal_id' => ['in',$aJournalId]]; + $aJournal = Db::name('journal')->where($aWhere)->column('journal_id,title as journal_title,usx,email,sx,editorinchief,email,epassword,issn'); + + + $aData = ['article_cite' => $aArticleCite,'article_author' => $aArticleAuthor,'article' => $aArticle,'journal' => $aJournal]; + return json_encode(['status' => 1,'msg' => 'Successfully obtained data','data' => $aData]); + } +}