From 7f95e7ec989c4edddefdfca49ba7294187311bb4 Mon Sep 17 00:00:00 2001
From: wangjinlei <751475802@qq.com>
Date: Fri, 2 Jul 2021 18:04:27 +0800
Subject: [PATCH] 20201112
---
application/api/controller/Article.php | 6 +-
application/api/controller/Journal.php | 42 +-
application/api/controller/Main.php | 6 +-
application/api/controller/Special.php | 5 +
application/master/controller/Article.php | 786 +++++++++++++---------
application/master/controller/Journal.php | 12 +-
6 files changed, 539 insertions(+), 318 deletions(-)
diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php
index b079b21..1d3d13f 100644
--- a/application/api/controller/Article.php
+++ b/application/api/controller/Article.php
@@ -186,7 +186,11 @@ class Article extends Controller {
$list = $this->article_author_obj->where($where)->select();
$frag = '';
foreach ($list as $k => $v) {
- $frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name'];
+ $ca = '';
+ if($v['orcid']!=''){
+ $ca = '
';
+ }
+ $frag = $frag == '' ? '' . $v['author_name'].$ca : $frag . ', ' . $v['author_name'].$ca;
}
return $frag;
}
diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php
index 9fdb6b7..79052c8 100644
--- a/application/api/controller/Journal.php
+++ b/application/api/controller/Journal.php
@@ -306,7 +306,11 @@ class Journal extends Controller {
$list = $this->article_author_obj->where($where)->select();
$frag = '';
foreach ($list as $k => $v) {
- $frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name'];
+ $ca = '';
+ if($v['orcid']!=''){
+ $ca = '
';
+ }
+ $frag = $frag == '' ? '' . $v['author_name'].$ca : $frag . ', ' . $v['author_name'].$ca;
}
return $frag;
}
@@ -719,7 +723,14 @@ class Journal extends Controller {
*/
public function getTopicForSubscribe() {
$data = $this->request->post();
- $list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('is_final', 1)->select();
+ $list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('level', 2)->select();
+// $pids = [];
+// foreach ($list as $k => $v){
+// if(!in_array($v['parent_id'], $pids)){
+// $pids[] = $v['parent_id'];
+// }
+// }
+// $tlist = $this->journal_topic_obj->where('journal_topic_id','in',$pids)->where('state',0)->select();
$re['topics'] = $list;
return jsonSuccess($re);
@@ -766,6 +777,33 @@ class Journal extends Controller {
return jsonSuccess([]);
}
+
+ public function pushEmail(){
+ die;
+ $list = $this->subscribe_journal_obj->where('journal_id',1)->select();
+
+// $a = [];
+// $a[] = ['email'=>'751475802@qq.com'];
+// $a[] = ['email'=>'13662001490@126.com'];
+ foreach ($list as $v){
+ $tt = 'Dear Researcher,
';
+ $tt .= 'We are so kindly to bring you a notice that we are glad to invite eminent people as the Reviewer for Traditional Medicine Research (ISSN 2413-3973).
';
+ $tt .= 'Traditional Medicine Research has been included in Emerging Sources Citation Index (ESCI), Embase, DOAJ, ProQuest, J-Gate, EuroPub, WHO-COVID-19 Database, Google Scholar, EBSCO, ect.
';
+ $tt .= 'TMR is a bimonthly, peer-reviewed open access journal. It is dedicated to report the research of the progress in clinical efficacy, action mechanism and theoretical research in the traditional medicine field. Including traditional medicine, ethnomedicine, herbal medicine, acupuncture and massage, rehabilitation, diet therapy, yoga, and other integrative medicine all over the world.
';
+ $tt .= 'If you interested in our invitation, please kindly send us your Resume and Photograph a d Email address to our Editorial office.
';
+ $tt .= 'Thank you for your attention to our invitation. If you have any questions, do not hesitate to contact us at tmr@tmrjournals.com. we look forward to a favorable reply.
';
+ $tt .= 'Best wishes,
';
+ $tt .= 'Editorial Office-Traditional Medicine Research
';
+ $tt .= 'Email: tmr@tmrjournals.com
';
+ $tt .= 'Traditional Medicine Research (TMR)';
+ $maidata['email'] = $v['email'];
+ $maidata['title'] = 'Traditional Medicine Research ISSN 2413-3973';
+ $maidata['content'] = $tt;
+ $maidata['tmail'] = 'publicrelations@tmrjournals.com';
+ $maidata['tpassword'] = 'pRWU999999';
+ Queue::push('app\api\job\mail@fire', $maidata, "mail");
+ }
+ }
/**
* @title 添加期刊话题订阅(批量)
diff --git a/application/api/controller/Main.php b/application/api/controller/Main.php
index ea0ac5f..cbed256 100644
--- a/application/api/controller/Main.php
+++ b/application/api/controller/Main.php
@@ -523,7 +523,11 @@ class Main extends Controller {
$list = $this->article_author_obj->where($where)->select();
$frag = '';
foreach ($list as $k => $v) {
- $frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name'];
+ $ca = '';
+ if($v['orcid']!=''){
+ $ca = '
';
+ }
+ $frag = $frag == '' ? '' . $v['author_name'].$ca : $frag . ', ' . $v['author_name'].$ca;
}
return $frag;
}
diff --git a/application/api/controller/Special.php b/application/api/controller/Special.php
index 4b5c42e..f76ea73 100644
--- a/application/api/controller/Special.php
+++ b/application/api/controller/Special.php
@@ -288,6 +288,11 @@ class Special extends Controller {
$list = $this->article_author_obj->where($where)->select();
$frag = '';
foreach ($list as $k => $v) {
+ $ca = '';
+ if($v['orcid']!=''){
+ $ca = '
';
+ }
+ $frag = $frag == '' ? '' . $v['author_name'].$ca : $frag . ', ' . $v['author_name'].$ca;
$frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name'];
}
return $frag;
diff --git a/application/master/controller/Article.php b/application/master/controller/Article.php
index c141467..61937fb 100644
--- a/application/master/controller/Article.php
+++ b/application/master/controller/Article.php
@@ -1,4 +1,5 @@
subscribe_journal_obj = Db::name('subscribe_journal');
$this->subscribe_topic_obj = Db::name('subscribe_topic');
}
-
+
/**
* @title 获取期刊和分期
* @description 获取期刊和分期
@@ -59,26 +61,26 @@ class Article extends Controller {
* @return joutaglist:array#
*
*/
- public function getJournalAndStage(){
+ public function getJournalAndStage() {
$data = $this->request->post();
- $journal_list = $this->journal_obj->where('editor_id',$data['editor_id'])->where('state',0)->select();
+ $journal_list = $this->journal_obj->where('editor_id', $data['editor_id'])->where('state', 0)->select();
$frag = [];
- foreach ($journal_list as $v){
+ foreach ($journal_list as $v) {
$v['journal_stage_id'] = $v['journal_id'];
- $cache_list = $this->journal_stage_obj->where('journal_id',$v['journal_id'])->where('state',0)->select();
- foreach($cache_list as $k => $vv){
- $cache_list[$k]['title'] = $vv['stage_year'].' Vol.'.$vv['stage_vol'].' issue.'.$vv['stage_no'].$vv['stage_pagename'].$vv['stage_page'];
+ $cache_list = $this->journal_stage_obj->where('journal_id', $v['journal_id'])->where('state', 0)->select();
+ foreach ($cache_list as $k => $vv) {
+ $cache_list[$k]['title'] = $vv['stage_year'] . ' Vol.' . $vv['stage_vol'] . ' issue.' . $vv['stage_no'] . $vv['stage_pagename'] . $vv['stage_page'];
}
- if(count($cache_list)>0){
+ if (count($cache_list) > 0) {
$v['children'] = $cache_list;
- }else{
+ } else {
$v['children'] = [];
}
$frag[] = $v;
}
- return json(['code'=>0,'msg'=>'success','data'=>['joutaglist'=>$frag]]);
+ return json(['code' => 0, 'msg' => 'success', 'data' => ['joutaglist' => $frag]]);
}
-
+
/**
* @title 添加文章基本信息
* @description 添加文章基本信息
@@ -91,7 +93,7 @@ class Article extends Controller {
* @param name:sort type:int require:1 default:0 desc:权重
* @param name:title type:string require:1 desc:标题
*/
- public function addArticleBase(){
+ public function addArticleBase() {
$data = $this->request->post();
$insert_data['journal_id'] = $data['journal_id'];
$insert_data['journal_stage_id'] = $data['journal_stage_id'];
@@ -99,13 +101,13 @@ class Article extends Controller {
$insert_data['sort'] = $data['sort'];
$insert_data['ctime'] = time();
$res = $this->article_obj->insert($insert_data);
- if($res){
- return json(['code'=>0,'msg'=>'success']);
- }else{
- return json(['code'=>1,'msg'=>'system error']);
+ if ($res) {
+ return json(['code' => 0, 'msg' => 'success']);
+ } else {
+ return json(['code' => 1, 'msg' => 'system error']);
}
}
-
+
/**
* @title 删除文章
* @description 删除文章
@@ -115,12 +117,12 @@ class Article extends Controller {
*
* @param name:article_id type:int require:1 desc:文章id
*/
- public function delArticle(){
+ public function delArticle() {
$data = $this->request->post();
- $res = $this->article_obj->where('article_id',$data['article_id'])->update(['state'=>1]);
- return json(['code'=>0,'msg'=>'success']);
+ $res = $this->article_obj->where('article_id', $data['article_id'])->update(['state' => 1]);
+ return json(['code' => 0, 'msg' => 'success']);
}
-
+
/**
* @title 添加文章作者
* @description 添加文章作者
@@ -131,53 +133,55 @@ class Article extends Controller {
* @param name:article_id type:int require:1 desc:article_id
* @param name:author_name type:string require:1 desc:作者名字
* @param name:author_country type:string require:1 desc:国家
+ * @param name:orcid type:string require:0 desc:orcid
* @param name:is_first type:boolean require:1 default:0 desc:是否第一作者(1yes0no)
* @param name:is_report type:boolean require:1 default:0 desc:是否通讯作者(1yes0no)
* @param name:email type:string require:0 desc:邮箱
* @param name:organs type:string require:1 desc:array
*
*/
- public function addArticleAuthor(){
+ public function addArticleAuthor() {
$data = $this->request->post();
-
+
$insert_author['article_id'] = $data['article_id'];
$insert_author['author_name'] = trim($data['author_name']);
//处理名字
$ca = explode(' ', $insert_author['author_name']);
$caf = '';
$cal = '';
- if(isset($ca[0])){
+ if (isset($ca[0])) {
$caf = str_replace('-', '', $ca[0]);
}
- if(isset($ca[1])){
+ if (isset($ca[1])) {
$cal = $ca[1];
}
$insert_author['first_name'] = $caf;
$insert_author['last_name'] = $cal;
+ $insert_author['orcid'] = isset($data['orcid']) ? $data['orcid'] : '';
$insert_author['author_country'] = $data['author_country'];
$insert_author['is_first'] = $data['is_first'];
$insert_author['is_report'] = $data['is_report'];
- $insert_author['email'] = intval($data['is_report'])==1?$data['email']:'';
+ $insert_author['email'] = intval($data['is_report']) == 1 ? $data['email'] : '';
Db::startTrans();
$insert_id = $this->article_author_obj->insertGetId($insert_author);
$or_res = true;
- if(isset($data['organs'])&&is_array($data['organs'])){
- foreach ($data['organs'] as $k => $v){
+ if (isset($data['organs']) && is_array($data['organs'])) {
+ foreach ($data['organs'] as $k => $v) {
$cache_ins['article_id'] = $data['article_id'];
$cache_ins['article_author_id'] = $insert_id;
$cache_ins['article_organ_id'] = $v;
- $or_res = $this->author_to_organ_obj->insert($cache_ins)?true:false;
+ $or_res = $this->author_to_organ_obj->insert($cache_ins) ? true : false;
}
}
- if($insert_id&&$or_res){
+ if ($insert_id && $or_res) {
Db::commit();
- return json(['code'=>0,'msg'=>'success']);
- }else{
+ return json(['code' => 0, 'msg' => 'success']);
+ } else {
Db::rollback();
- return json(['code'=>1,'msg'=>'system error']);
+ return json(['code' => 1, 'msg' => 'system error']);
}
}
-
+
/**
* @title 编辑文章作者
* @description 编辑文章作者
@@ -187,6 +191,7 @@ class Article extends Controller {
*
* @param name:article_author_id type:int require:1 desc:article_id
* @param name:author_name type:string require:1 desc:作者名字
+ * @param name:orcid type:string require:0 desc:orcid
* @param name:author_country type:string require:1 desc:国家
* @param name:is_first type:boolean require:1 default:0 desc:是否第一作者(1yes0no)
* @param name:is_report type:boolean require:1 default:0 desc:是否通讯作者(1yes0no)
@@ -194,9 +199,9 @@ class Article extends Controller {
* @param name:organs type:string require:1 desc:array
*
*/
- public function editArticleAuthor(){
+ public function editArticleAuthor() {
$data = $this->request->post();
-
+
// $data['article_author_id'] = 21;
// $data['article_id'] = 38;
// $data['author_name'] = '作者3';
@@ -205,32 +210,32 @@ class Article extends Controller {
// $data['is_report'] = 1;
// $data['email'] = 'xl37@163.com';
// $data['organs'] = ['1','2','3'];
-
- $old_article_author_info = $this->article_author_obj->where('article_author_id',$data['article_author_id'])->find();
+
+ $old_article_author_info = $this->article_author_obj->where('article_author_id', $data['article_author_id'])->find();
$update_author['author_name'] = trim($data['author_name']);
//处理名字
$ca = explode(' ', $update_author['author_name']);
$caf = '';
$cal = '';
- if(isset($ca[0])){
+ if (isset($ca[0])) {
$caf = str_replace('-', '', $ca[0]);
}
- if(isset($ca[1])){
+ if (isset($ca[1])) {
$cal = $ca[1];
}
$update_author['first_name'] = $caf;
$update_author['last_name'] = $cal;
-
+ $update_author['orcid'] = isset($data['orcid']) ? $data['orcid'] : '';
$update_author['author_country'] = $data['author_country'];
$update_author['is_first'] = $data['is_first'];
$update_author['is_report'] = $data['is_report'];
- $update_author['email'] = intval($data['is_report'])==1?$data['email']:'';
- $this->article_author_obj->where('article_author_id',$data['article_author_id'])->update($update_author);
- if(is_array($data['organs'])){
+ $update_author['email'] = intval($data['is_report']) == 1 ? $data['email'] : '';
+ $this->article_author_obj->where('article_author_id', $data['article_author_id'])->update($update_author);
+ if (is_array($data['organs'])) {
$has_ids = [];
- foreach ($data['organs'] as $v){
- $cache_one = $this->author_to_organ_obj->where('article_author_id',$data['article_author_id'])->where('article_organ_id',$v)->where('state',0)->find();
- if($cache_one==null){
+ foreach ($data['organs'] as $v) {
+ $cache_one = $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->where('article_organ_id', $v)->where('state', 0)->find();
+ if ($cache_one == null) {
$insert['article_id'] = $old_article_author_info['article_id'];
$insert['article_author_id'] = $data['article_author_id'];
$insert['article_organ_id'] = $v;
@@ -238,13 +243,13 @@ class Article extends Controller {
}
$has_ids[] = intval($v);
}
- $this->author_to_organ_obj->where('article_author_id',$data['article_author_id'])->where('state',0)->where('article_organ_id','not in',$has_ids)->update(['state'=>1]);
- }else{
- $this->author_to_organ_obj->where('article_author_id',$data['article_author_id'])->where('state',0)->update(['state'=>1]);
+ $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->where('state', 0)->where('article_organ_id', 'not in', $has_ids)->update(['state' => 1]);
+ } else {
+ $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->where('state', 0)->update(['state' => 1]);
}
- return json(['code'=>0,'msg'=>'success']);
+ return json(['code' => 0, 'msg' => 'success']);
}
-
+
/**
* @title 删除文章作者
* @description 删除文章作者
@@ -255,14 +260,14 @@ class Article extends Controller {
* @param name:article_author_id type:int require:1 desc:article_id
*
*/
- public function delArticleAuthor(){
+ public function delArticleAuthor() {
$data = $this->request->post();
//删除作者和机构的关系
- $this->author_to_organ_obj->where('article_author_id',$data['article_author_id'])->update(['state'=>1]);
- $this->article_author_obj->where('article_author_id',$data['article_author_id'])->update(['state'=>1]);
- return json(['code'=>0,'msg'=>'success']);
+ $this->author_to_organ_obj->where('article_author_id', $data['article_author_id'])->update(['state' => 1]);
+ $this->article_author_obj->where('article_author_id', $data['article_author_id'])->update(['state' => 1]);
+ return json(['code' => 0, 'msg' => 'success']);
}
-
+
/**
* @title 获取文章作者和机构
* @description 获取文章作者和机构
@@ -275,26 +280,26 @@ class Article extends Controller {
* @return authorList:array#
* @return organList:array#
*/
- public function getArticleAuthor(){
+ public function getArticleAuthor() {
$data = $this->request->post();
- $author_list = $this->article_author_obj->where('article_id',$data['article_id'])->where('state',0)->select();
- foreach ($author_list as $k => $v){
+ $author_list = $this->article_author_obj->where('article_id', $data['article_id'])->where('state', 0)->select();
+ foreach ($author_list as $k => $v) {
$cache_to = $this->author_to_organ_obj
->field('j_article_author_to_organ.*,j_article_organ.organ_name')
- ->join('j_article_organ','j_article_organ.article_organ_id = j_article_author_to_organ.article_organ_id')
- ->where('j_article_author_to_organ.article_author_id',$v['article_author_id'])
- ->where('j_article_author_to_organ.state',0)
+ ->join('j_article_organ', 'j_article_organ.article_organ_id = j_article_author_to_organ.article_organ_id')
+ ->where('j_article_author_to_organ.article_author_id', $v['article_author_id'])
+ ->where('j_article_author_to_organ.state', 0)
->select();
$cache_frag = [];
- foreach($cache_to as $vv){
+ foreach ($cache_to as $vv) {
$cache_frag[] = $vv;
}
$author_list[$k]['organs'] = $cache_frag;
}
- $organ_list = $this->article_organ_obj->where('article_id',$data['article_id'])->where('state',0)->select();
- return json(['code'=>0,'msg'=>'success','data'=>['authorList'=>$author_list,'organList'=>$organ_list]]);
+ $organ_list = $this->article_organ_obj->where('article_id', $data['article_id'])->where('state', 0)->select();
+ return json(['code' => 0, 'msg' => 'success', 'data' => ['authorList' => $author_list, 'organList' => $organ_list]]);
}
-
+
/**
* @title 添加文章作者机构
* @description 添加文章作者机构
@@ -305,18 +310,18 @@ class Article extends Controller {
* @param name:article_id type:int require:1 desc:article_id
* @param name:organ_name type:string require:1 desc:机构名字
*/
- public function addArticleOrgan(){
+ public function addArticleOrgan() {
$data = $this->request->post();
$insert_data['article_id'] = $data['article_id'];
$insert_data['organ_name'] = $data['organ_name'];
$res = $this->article_organ_obj->insert($insert_data);
- if($res){
- return json(['code'=>0,'msg'=>'success']);
- }else{
- return json(['code'=>1,'msg'=>'system error']);
+ if ($res) {
+ return json(['code' => 0, 'msg' => 'success']);
+ } else {
+ return json(['code' => 1, 'msg' => 'system error']);
}
}
-
+
/**
* @title 编辑文章作者机构
* @description 编辑文章作者机构
@@ -327,12 +332,12 @@ class Article extends Controller {
* @param name:article_organ_id type:int require:1 desc:article_organ_id
* @param name:organ_name type:string require:1 desc:机构名字
*/
- public function editArticleOrgan(){
+ public function editArticleOrgan() {
$data = $this->request->post();
- $this->article_organ_obj->where('article_organ_id',$data['article_organ_id'])->update(['organ_name'=>$data['organ_name']]);
- return json(['code'=>0,'msg'=>'success']);
+ $this->article_organ_obj->where('article_organ_id', $data['article_organ_id'])->update(['organ_name' => $data['organ_name']]);
+ return json(['code' => 0, 'msg' => 'success']);
}
-
+
/**
* @title 删除文章作者机构
* @description 删除文章作者机构
@@ -342,14 +347,14 @@ class Article extends Controller {
*
* @param name:article_organ_id type:int require:1 desc:article_organ_id
*/
- public function delArticleOrgan(){
+ public function delArticleOrgan() {
$data = $this->request->post();
//删除作者和机构的关系
- $this->author_to_organ_obj->where('article_organ_id',$data['article_organ_id'])->update(['state'=>1]);
- $this->article_organ_obj->where('article_organ_id',$data['article_organ_id'])->update(['state'=>1]);
- return json(['code'=>0,'msg'=>'success']);
+ $this->author_to_organ_obj->where('article_organ_id', $data['article_organ_id'])->update(['state' => 1]);
+ $this->article_organ_obj->where('article_organ_id', $data['article_organ_id'])->update(['state' => 1]);
+ return json(['code' => 0, 'msg' => 'success']);
}
-
+
/**
* @title 获取文章基本信息
* @description 获取文章基本信息
@@ -376,36 +381,36 @@ class Article extends Controller {
* @return files:文件列表#
*
*/
- public function getArticleBase(){
+ public function getArticleBase() {
$data = $this->request->post();
- $article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
-
- $ltais = $this->article_ltai_obj->where('article_id',$article_info['article_id'])->where('state',0)->column('content');
+ $article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
+
+ $ltais = $this->article_ltai_obj->where('article_id', $article_info['article_id'])->where('state', 0)->column('content');
$article_info['ltai'] = implode(',', $ltais);
- $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
- $list = scandir(ROOT_PATH.'public/articleHTML/'.trim($journal_info['sx']));
+ $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
+ $list = scandir(ROOT_PATH . 'public/articleHTML/' . trim($journal_info['sx']));
$frag = [];
- foreach ($list as $k => $v){
- if($k>1){
- $frag[] = ['val'=>$v];
+ foreach ($list as $k => $v) {
+ if ($k > 1) {
+ $frag[] = ['val' => $v];
}
}
-
+
$re['journal'] = $journal_info;
$re['articleInfo'] = $article_info;
$re['files'] = $frag;
return jsonSuccess($re);
// return json(['code'=>0,'msg'=>'success','data'=>$article_info]);
}
-
- public function getHtmlFiles(){
+
+ public function getHtmlFiles() {
$data = $this->request->post();
- $article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
- $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
- $list = scandir(ROOT_PATH.'public/articleHTML/'.$journal_info['sx']);
+ $article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
+ $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
+ $list = scandir(ROOT_PATH . 'public/articleHTML/' . $journal_info['sx']);
$frag = [];
- foreach ($list as $k => $v){
- if($k>1){
+ foreach ($list as $k => $v) {
+ if ($k > 1) {
$frag[] = $v;
}
}
@@ -416,7 +421,7 @@ class Article extends Controller {
// echo '';
// die;
}
-
+
/**
* @title 编辑文章基本信息
* @description 编辑文章基本信息
@@ -445,10 +450,10 @@ class Article extends Controller {
* @param name:pub_date type:string require:1 desc:发表日期
*
*/
- public function editArticleBase(){
+ public function editArticleBase() {
$data = $this->request->post();
- if(isset($data['ltai'])){
- $this->editArticleLtai($data['ltai'],$data['article_id']);
+ if (isset($data['ltai'])) {
+ $this->editArticleLtai($data['ltai'], $data['article_id']);
}
$updata['icon'] = $data['icon'];
$updata['title'] = $data['title'];
@@ -470,37 +475,37 @@ class Article extends Controller {
$updata['file_html'] = $data['file_html'];
$updata['sort'] = $data['sort'];
$updata['pub_date'] = $data['pub_date'];
- $res = $this->article_obj->where('article_id',$data['article_id'])->update($updata);
+ $res = $this->article_obj->where('article_id', $data['article_id'])->update($updata);
// if($res){
- return json(['code'=>0,'msg'=>'success']);
+ return json(['code' => 0, 'msg' => 'success']);
// }else{
// return json(['code'=>1,'msg'=>'system error']);
// }
}
- private function editArticleLtai($ltai,$article_id){
+
+ private function editArticleLtai($ltai, $article_id) {
$list = explode(',', $ltai);
- $has = $this->article_ltai_obj->where('article_id',$article_id)->where('state',0)->select();
- foreach ($has as $val){
- if(in_array($val['content'], $list)){
- foreach( $list as $k=>$v) {
- if($val['content'] == $v) {
+ $has = $this->article_ltai_obj->where('article_id', $article_id)->where('state', 0)->select();
+ foreach ($has as $val) {
+ if (in_array($val['content'], $list)) {
+ foreach ($list as $k => $v) {
+ if ($val['content'] == $v) {
unset($list[$k]);
}
}
- }else{
+ } else {
//删除
- $this->article_ltai_obj->where('article_ltai_id',$val['article_ltai_id'])->update(['state'=>1]);
+ $this->article_ltai_obj->where('article_ltai_id', $val['article_ltai_id'])->update(['state' => 1]);
}
}
//增加
- foreach ($list as $value){
+ foreach ($list as $value) {
$cache['article_id'] = $article_id;
$cache['content'] = $value;
$this->article_ltai_obj->insert($cache);
}
}
-
/**
* @title 编辑文章文件信息
* @description 编辑文章文件信息
@@ -513,25 +518,25 @@ class Article extends Controller {
* @param name:fileURL type:string require:1 desc:文件地址
*
*/
- public function editArticleFile(){
+ public function editArticleFile() {
$data = $this->request->post();
- if($data['filetype']=='PDF'){
+ if ($data['filetype'] == 'PDF') {
$updata['file_pdf'] = $data['fileURL'];
- }elseif($data['filetype']=='HTML'){
+ } elseif ($data['filetype'] == 'HTML') {
$updata['file_html'] = $data['fileURL'];
- }elseif($data['filetype']=='SUB'){
+ } elseif ($data['filetype'] == 'SUB') {
$updata['file_sub'] = $data['fileURL'];
- }elseif($data['filetype']=='SUB2'){
+ } elseif ($data['filetype'] == 'SUB2') {
$updata['file_sub2'] = $data['fileURL'];
- }elseif($data['filetype']=='endNote'){
+ } elseif ($data['filetype'] == 'endNote') {
$updata['endnote'] = $data['fileURL'];
- }elseif($data['filetype']=='bibTex'){
+ } elseif ($data['filetype'] == 'bibTex') {
$updata['bibtex'] = $data['fileURL'];
}
- $this->article_obj->where('article_id',$data['article_id'])->update($updata);
- return json(['code'=>0,'msg'=>'success']);
+ $this->article_obj->where('article_id', $data['article_id'])->update($updata);
+ return json(['code' => 0, 'msg' => 'success']);
}
-
+
/**
* @title 获取文章列表
* @description 获取文章列表
@@ -549,35 +554,35 @@ class Article extends Controller {
* @return count:总数据数
* @return articleList:array#
*/
- public function getArticleList(){
+ public function getArticleList() {
$data = $this->request->post();
$where['j_article.state'] = 0;
- if(intval($data['journal_id'])!==0){
+ if (intval($data['journal_id']) !== 0) {
$where['j_article.journal_id'] = $data['journal_id'];
- }else{
- $journals = $this->journal_obj->where('editor_id',$data['editor_id'])->column('journal_id');
- $where['j_article.journal_id'] = ['in',$journals];
+ } else {
+ $journals = $this->journal_obj->where('editor_id', $data['editor_id'])->column('journal_id');
+ $where['j_article.journal_id'] = ['in', $journals];
}
- if(intval($data['journal_stage_id'])!==0){
+ if (intval($data['journal_stage_id']) !== 0) {
$where['j_article.journal_stage_id'] = $data['journal_stage_id'];
}
- if(isset($data['seach'])&&$data['seach']!=''){
- $where['j_article.title'] = ['like','%'.$data['seach'].'%'];
+ if (isset($data['seach']) && $data['seach'] != '') {
+ $where['j_article.title'] = ['like', '%' . $data['seach'] . '%'];
}
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
- $article_list = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title')->join(array(['j_journal_stage','j_article.journal_stage_id = j_journal_stage.journal_stage_id','LEFT'],['j_journal','j_journal.journal_id=j_article.journal_id','LEFT']))->where($where)->order(['j_article.sort desc','j_article.article_id'])->limit($limit_start,$data['pageSize'])->select();
- foreach ($article_list as $k => $v){
- $caches = $this->article_ltai_obj->where('article_id',$v['article_id'])->where('state',0)->column('content');
+ $article_list = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'], ['j_journal', 'j_journal.journal_id=j_article.journal_id', 'LEFT']))->where($where)->order(['j_article.sort desc', 'j_article.article_id'])->limit($limit_start, $data['pageSize'])->select();
+ foreach ($article_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);
+ foreach ($caches as $val) {
+ $cache_title = str_replace($val, '' . $val . '', $cache_title);
}
$article_list[$k]['title'] = $cache_title;
}
$count = $this->article_obj->where($where)->count();
- return json(['code'=>0,'msg'=>'success','data'=>['count'=>$count,'articleList'=>$article_list]]);
+ return json(['code' => 0, 'msg' => 'success', 'data' => ['count' => $count, 'articleList' => $article_list]]);
}
-
+
/**
* @title 获取文章对应期刊话题
* @description 获取文章对应期刊话题
@@ -590,37 +595,38 @@ class Article extends Controller {
* @return topics:array#
* @return nowtopic:array#
*/
- public function getTopicByArticle(){
+ public function getTopicByArticle() {
$data = $this->request->post();
- $article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
- $topic_res = $this->journal_topic_obj->where('journal_id',$article_info['journal_id'])->where('state',0)->select();
+ $article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
+ $topic_res = $this->journal_topic_obj->where('journal_id', $article_info['journal_id'])->where('state', 0)->select();
$frag = [];
- foreach ($topic_res as $v){
- if($v['is_final']==1){
+ foreach ($topic_res as $v) {
+ if ($v['is_final'] == 1) {
$frag[] = $v;
}
}
- foreach ($frag as $k => $val){
+ foreach ($frag as $k => $val) {
$frag[$k]['tname'] = $this->getTname($val, $topic_res);
}
//获取初始话题
- $now_list = $this->article_to_topic_obj->where('article_id',$data['article_id'])->where('state',0)->select();
- return json(['code'=>0,'msg'=>'success','data'=>['nowtopic'=>$now_list,'topics'=>$frag]]);
+ $now_list = $this->article_to_topic_obj->where('article_id', $data['article_id'])->where('state', 0)->select();
+ return json(['code' => 0, 'msg' => 'success', 'data' => ['nowtopic' => $now_list, 'topics' => $frag]]);
}
- private function getTname($now,$arr){
- if($now['parent_id']==0){
+
+ private function getTname($now, $arr) {
+ if ($now['parent_id'] == 0) {
return $now['title'];
- }else{
- $frag = '>'.$now['title'];
- foreach ($arr as $v){
- if($v['journal_topic_id']==$now['parent_id']){
- $frag = $this->getTname($v, $arr).$frag;
+ } else {
+ $frag = '>' . $now['title'];
+ foreach ($arr as $v) {
+ if ($v['journal_topic_id'] == $now['parent_id']) {
+ $frag = $this->getTname($v, $arr) . $frag;
}
}
return $frag;
}
}
-
+
/**
* @title 增加文章话题
* @description 增加文章话题
@@ -632,25 +638,31 @@ class Article extends Controller {
* @param name:topic_id type:int require:1 desc:话题id
*
*/
- public function addTopicByArticle(){
+ public function addTopicByArticle() {
$data = $this->request->post();
$insert['article_id'] = $data['article_id'];
$insert['topic_id'] = $data['topic_id'];
$res = $this->article_to_topic_obj->insert($insert);
$this->msg_subscript_topic($data['topic_id'], $data['article_id']);
- if($res){
- return json(['code'=>0,'msg'=>'success']);
- }else{
- return json(['code'=>1,'msg'=>'system error']);
+ if ($res) {
+ return json(['code' => 0, 'msg' => 'success']);
+ } else {
+ return json(['code' => 1, 'msg' => 'system error']);
}
}
-
- private function msg_subscript_topic($topic_id,$article_id){
- $article_info = $this->article_obj->where('article_id',$article_id)->find();
+
+ private function msg_subscript_topic($topic_id, $article_id) {
+ $article_info = $this->article_obj->where('article_id', $article_id)->find();
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $article_info['journal_stage_id'])->find();
- $topic_info = $this->journal_topic_obj->where('journal_topic_id',$topic_id)->find();
- $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
- $list = $this->subscribe_topic_obj->where('topic_id',$topic_id)->where('state',0)->select();
+ $topic_info = $this->journal_topic_obj->where('journal_topic_id', $topic_id)->find();
+ $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
+ $list = [];
+ if ($topic_info['level'] == 2) {
+ $list = $this->subscribe_topic_obj->where('topic_id', $topic_id)->where('state', 0)->select();
+ } else {
+ $list = $this->subscribe_topic_obj->where('topic_id', $topic_info['parent_id'])->where('state', 0)->select();
+ }
+
//组成文章信息
$tt1 = '
'; +// var_dump($rst); +// echo ''; +// echo '
'; +// var_dump($err); +// echo ''; +// die; +// die; + } + public function met(){ + $s = '11'; + $arr = explode('-', $s); + echo $arr[0]; + } + + + + public function crossRef($data) { + $xml = ''; + //create xml 头 + $xml .= '' . PHP_EOL; + $xml .= '
';
var_dump($result);
echo '';
die;
}
+
}
diff --git a/application/master/controller/Journal.php b/application/master/controller/Journal.php
index f14dabd..cebd565 100644
--- a/application/master/controller/Journal.php
+++ b/application/master/controller/Journal.php
@@ -663,7 +663,13 @@ class Journal extends Controller {
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $article_info['journal_stage_id'])->find();
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$topic_id)->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
- $list = $this->subscribe_topic_obj->where('topic_id',$topic_id)->where('state',0)->select();
+ $list = [];
+ if($topic_info['level']==2){
+ $list = $this->subscribe_topic_obj->where('topic_id',$topic_id)->where('state',0)->select();
+ }else{
+ $list = $this->subscribe_topic_obj->where('topic_id',$topic_info['parent_id'])->where('state',0)->select();
+ }
+// $list = $this->subscribe_topic_obj->where('topic_id',$topic_info['parent_id'])->where('state',0)->select();
//组成文章信息
$tt1 = '