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]); + } +}