From 0987a2ecbdc0d25f15713cb7839bc63c92379c00 Mon Sep 17 00:00:00 2001
From: wangjinlei <751475802@qq.com>
Date: Wed, 7 Aug 2024 15:02:13 +0800
Subject: [PATCH] 1
---
application/api/controller/Article.php | 45 ++++++---
application/api/controller/Journal.php | 96 ++++++++++++++++++-
application/api/controller/Main.php | 3 +-
application/common.php | 6 ++
application/super/controller/Publish.php | 29 ++++++
thinkphp/library/think/cache/driver/Redis.php | 2 +-
.../library/think/session/driver/Redis.php | 2 +-
.../think-queue/src/queue/connector/Redis.php | 2 +-
8 files changed, 164 insertions(+), 21 deletions(-)
diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php
index 206abbe..b4f769b 100644
--- a/application/api/controller/Article.php
+++ b/application/api/controller/Article.php
@@ -56,6 +56,21 @@ class Article extends Controller {
return jsonSuccess($r);
}
+
+
+ public function getRelationArticles(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "article_id" => "require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+
+
+
+ }
+
/**
* @title 获取文章详情
* @description 获取文章详情
@@ -127,21 +142,13 @@ class Article extends Controller {
$article_info['keywords'] = str_replace(',', ' ', $article_info['keywords']);
//更改适应期刊改名后的期刊名称
$journal_info['title'] = choiseti1($article_info['article_id'],$journal_info['title']);
- //获取文章引用信息
-// $get_url = "https://doi.crossref.org/servlet/getForwardLinks";
-// $get_data["usr"] = "books@tmrjournals.com/tmrp";
-// $get_data["pwd"] = "849192806pnX";
-// $get_data["doi"] = $article_info['doi'];
-// $r = xml_to_array(myGet($get_url,$get_data));
-// $re['crossref_cite'] = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
//返回数据
$re['articleInfo'] = $article_info;
$re['journalInfo'] = $journal_info;
$re['stageInfo'] = $stage_info;
$re['author'] = $author;
$re['cite'] = $cite;
-// $re['mains'] = getArticleMains($data['article_id']);
-// $re['refers'] = getArticleRefers($data['article_id']);
+ $re['html'] = hasHtml($data['article_id']);
if((($article_info['journal_id']==13||$article_info['journal_id']==19||$article_info['journal_id']==9)&&($article_info['ctime']>1688140800))||(($article_info['journal_id']!=13||$article_info['journal_id']!=19||$article_info['journal_id']!=9)&&($article_info['ctime']>1682870400))){
$stack = getArticleTracks($article_info['doi']);
//增加online
@@ -188,8 +195,20 @@ class Article extends Controller {
$get_data["pwd"] = "849192806pnX";
$get_data["doi"] = $article_info['doi'];
$r = xml_to_array(myGet($get_url,$get_data));
- $re['crossref_cite'] = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
- return jsonSuccess($re);
+ $re = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
+
+ if($re==null){
+ return jsonSuccess(null);
+ }
+ if(isset($re['journal_cite'])){
+ $rr[] = $re['journal_cite'];
+ }else{
+ foreach ($re as $k){
+ $rr[] = $k['journal_cite'];
+ }
+ }
+
+ return jsonSuccess($rr);
}
public function myttt() {
@@ -351,8 +370,8 @@ class Article extends Controller {
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
-
- $list[$k]['mains'] = getArticleMains($v['article_id']);
+ $list[$k]['html'] = hasHtml($v['article_id']);
+// $list[$k]['mains'] = getArticleMains($v['article_id']);
}
//标题斜体
foreach ($list as $k => $v) {
diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php
index d492053..fbe11e5 100644
--- a/application/api/controller/Journal.php
+++ b/application/api/controller/Journal.php
@@ -844,8 +844,9 @@ class Journal extends Controller {
->where('j_article.journal_stage_id', 'in', $stages)
->where('j_article.state', 0)
->where('j_journal_stage.stage_year', '>', '2018')
- ->where('j_article.type', ['like', 'News'], ['like', 'Comment'], 'or')
+ ->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or')
->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc')
+ ->limit(4)
->select();
//获取作者
foreach ($list as $k => $v) {
@@ -858,8 +859,9 @@ class Journal extends Controller {
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
+ $list[$k]['html'] = hasHtml($v['article_id']);
- $list[$k]['mains'] = getArticleMains($v['article_id']);
+// $list[$k]['mains'] = getArticleMains($v['article_id']);
}
//标题斜体
foreach ($list as $k => $v) {
@@ -884,6 +886,92 @@ class Journal extends Controller {
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list]]);
}
+
+ /**
+ * @title 获取news文章
+ * @description 获取news文章
+ * @author wangjinlei
+ * @url /api/Journal/getNewsArticle
+ * @method POST
+ *
+ * @param name:journal_id type:int require:1 desc:期刊id
+ *
+ * @return articlelist:文章列表array#
+ */
+ public function getNewsArticleNew() {
+ $data = $this->request->post();
+ $rule = new Validate([
+ "journal_id" => "require",
+ "limit" =>"require",
+ "page" => "require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+
+ $stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('state', 0)->column('journal_stage_id');
+ $journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
+ $list = $this->article_obj
+ ->field('j_article.*,j_journal_stage.*')
+ ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT')
+ ->where('j_article.journal_stage_id', 'in', $stages)
+ ->where('j_article.state', 0)
+ ->where('j_journal_stage.stage_year', '>', '2018')
+ ->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or')
+ ->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc')
+ ->page($data['page'],$data['limit'])
+ ->select();
+ $count= $this->article_obj
+ ->field('j_article.*,j_journal_stage.*')
+ ->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT')
+ ->where('j_article.journal_stage_id', 'in', $stages)
+ ->where('j_article.state', 0)
+ ->where('j_journal_stage.stage_year', '>', '2018')
+ ->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or')
+ ->count();
+
+ //获取作者
+ foreach ($list as $k => $v) {
+ $stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
+ //组合cite信息
+ $no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
+ $cite = $v['abbr'] . '. ' . $v['title'] . '. ' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
+ $cache_topic = $this->article_to_topic_obj->field('j_journal_topic.*')->join('j_journal_topic', 'j_journal_topic.journal_topic_id = j_article_to_topic.topic_id', 'left')->where('j_article_to_topic.article_id', $v['article_id'])->where('j_article_to_topic.state', 0)->select();
+
+ $list[$k]['topic'] = $cache_topic;
+ $list[$k]['cite'] = $cite;
+ $list[$k]['authortitle'] = $this->getAuthor($v);
+ $list[$k]['html'] = hasHtml($v['article_id']);
+// $list[$k]['mains'] = 1;
+// $list[$k]['mains'] = getArticleMains($v['article_id']);
+ }
+ //标题斜体
+ foreach ($list as $k => $v) {
+ $caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
+ $cache_title = $v['title'];
+ foreach ($caches as $val) {
+ $cache_title = str_replace($val, '' . $val . '', $cache_title);
+ }
+ $list[$k]['title'] = $cache_title;
+ }
+
+ //连续出版判断,决定是否显示出版时间
+ foreach ($list as $k => $v) {
+ $ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
+ if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) {
+ $list[$k]['isShowOtime'] = 1;
+ } else {
+ $list[$k]['isShowOtime'] = 0;
+ }
+ }
+ $re['articlelist'] = $list;
+ $re['count'] = $count;
+ return jsonSuccess($re);
+ }
+
+
+
+
/**
* @title 获取top前4条article
* @description 获取top前4条article
@@ -935,8 +1023,8 @@ class Journal extends Controller {
$list[$k]['topic'] = $cache_topic;
$list[$k]['cite'] = $cite;
$list[$k]['authortitle'] = $this->getAuthor($v);
-
- $list[$k]['mains'] = getArticleMains($v['article_id']);
+ $list[$k]['html'] = hasHtml($v['article_id']);
+// $list[$k]['mains'] = getArticleMains($v['article_id']);
}
//连续出版判断,决定是否显示出版时间
foreach ($list as $k => $v){
diff --git a/application/api/controller/Main.php b/application/api/controller/Main.php
index 44e9a92..41b609d 100644
--- a/application/api/controller/Main.php
+++ b/application/api/controller/Main.php
@@ -192,8 +192,9 @@ class Main extends Controller {
$cache_title = str_replace($val, '' . $val . '', $cache_title);
}
$list[$k]['title'] = $cache_title;
+ $list[$k]['html'] = hasHtml($v['article_id']);
- $list[$k]['mains'] = getArticleMains($v['article_id']);
+// $list[$k]['mains'] = getArticleMains($v['article_id']);
}
//连续出版判断,决定是否显示出版时间
diff --git a/application/common.php b/application/common.php
index 5a36646..3769aa6 100644
--- a/application/common.php
+++ b/application/common.php
@@ -109,6 +109,12 @@ function getArticleMains($article_id)
return $frag;
}
+function hasHtml($article_id){
+ $article_main_obj = Db::name("article_main");
+ $list = $article_main_obj->where('article_id', $article_id)->where('state', 0)->where('is_add', 0)->find();
+ return $list?1:0;
+}
+
function getArticleRefers($article_id)
{
$article_obj = Db::name("article");
diff --git a/application/super/controller/Publish.php b/application/super/controller/Publish.php
index a3ab67d..830042d 100644
--- a/application/super/controller/Publish.php
+++ b/application/super/controller/Publish.php
@@ -3,6 +3,7 @@
namespace app\super\controller;
use think\Controller;
+use think\Validate;
use think\Db;
/**
@@ -127,6 +128,14 @@ class Publish extends Controller {
*/
public function getAllDateForJournal() {
$data = $this->request->post();
+ $rule = new Validate([
+ "issn"=>"require",
+ "start"=>"require",
+ "end"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
// $data['issn'] = '2703-4631';
// $data['start'] = '2021-01-01';
@@ -558,6 +567,26 @@ class Publish extends Controller {
return $frag;
}
+
+ public function getGJHByIssn(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "issn"=>"require",
+ "year"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $journal_info = $this->journal_obj->where("issn",$data['issn'])->find();
+ $start = strtotime($data['year']."-01-01");
+ $end = strtotime($data['year']."-12-31 23:59:59");
+ $r = $this->getGJH($journal_info['journal_id'],$start,$end);
+ $re['result'] = $r['list'];
+
+
+ return jsonSuccess($re);
+ }
+
private function getGJH($journal_id, $start, $end) {
$stages = $this->journal_stage_obj
->where('journal_id', $journal_id)
diff --git a/thinkphp/library/think/cache/driver/Redis.php b/thinkphp/library/think/cache/driver/Redis.php
index 027b3ea..36b87f7 100644
--- a/thinkphp/library/think/cache/driver/Redis.php
+++ b/thinkphp/library/think/cache/driver/Redis.php
@@ -25,7 +25,7 @@ class Redis extends Driver
protected $options = [
'host' => '127.0.0.1',
'port' => 6379,
- 'password' => '',
+ 'password' => 'Jgll2015',
'select' => 0,
'timeout' => 0,
'expire' => 0,
diff --git a/thinkphp/library/think/session/driver/Redis.php b/thinkphp/library/think/session/driver/Redis.php
index 8d05126..5108b6d 100644
--- a/thinkphp/library/think/session/driver/Redis.php
+++ b/thinkphp/library/think/session/driver/Redis.php
@@ -21,7 +21,7 @@ class Redis extends SessionHandler
protected $config = [
'host' => '127.0.0.1', // redis主机
'port' => 6379, // redis端口
- 'password' => '', // 密码
+ 'password' => 'Jgll2015', // 密码
'select' => 0, // 操作库
'expire' => 3600, // 有效期(秒)
'timeout' => 0, // 超时时间(秒)
diff --git a/vendor/topthink/think-queue/src/queue/connector/Redis.php b/vendor/topthink/think-queue/src/queue/connector/Redis.php
index 9320d53..74201d9 100644
--- a/vendor/topthink/think-queue/src/queue/connector/Redis.php
+++ b/vendor/topthink/think-queue/src/queue/connector/Redis.php
@@ -26,7 +26,7 @@ class Redis extends Connector
'default' => 'default',
'host' => '127.0.0.1',
'port' => 6379,
- 'password' => '',
+ 'password' => 'Jgll2015',
'select' => 0,
'timeout' => 0,
'persistent' => false