From 34364e6430c70ea2909d1eb340e7a3bf5a323a76 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 8 May 2025 18:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8Fbug=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Production.php | 177 +++++++++++++++++++++- 1 file changed, 176 insertions(+), 1 deletion(-) diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 857e4c1..9e22a22 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -688,6 +688,13 @@ class Production extends Base return jsonError($rule->getError()); } $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find(); + + if($p_info['topics']==""||$p_info['related']==""){ + return jsonError("Topic and related articles cannot be empty"); + } + + + if ($p_info['state'] != 0) { return jsonError("Non repeatable submission"); } @@ -696,7 +703,7 @@ class Production extends Base The ONLINE step will only continue if you have completed the PROOF step.'); } //参考文献重复的不能提交 - $this->production_article_refer_obj->where("p_article_id",$data['p_article_id'])->where("state",0)->group("refer_doi")-> +// $this->production_article_refer_obj->where("p_article_id",$data['p_article_id'])->where("state",0)->group("refer_doi")-> $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find(); $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); @@ -1106,6 +1113,174 @@ class Production extends Base } + public function getTopicsByIssn(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where("p_article_id",$data['p_article_id'])->find(); + $journal_info = $this->journal_obj->where("journal_id",$p_info['journal_id'])->find(); + + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getTopicByIssn'; + $pra = []; + $pra['issn'] = $journal_info['issn']; + $res = object_to_array(json_decode(myPost($url, $pra))); + + $re['now'] = $p_info['topics']==""?[]:json_decode($p_info['topics']); + $re['list'] = $res['data']['list']; + + + return jsonSuccess($re); + } + + public function getProductRelatedList(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where("p_article_id",$data['p_article_id'])->find(); + if($p_info['related']==""){ + return jsonSuccess(['list'=>null]); + } + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getArticlesForSubmission'; + $pra = []; + $pra['ids'] = $p_info['related']; + $res = object_to_array(json_decode(myPost($url, $pra))); + $re['list'] = $res['data']['list']; + return jsonSuccess($re); + } + + public function addProductRelated(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require", + "article_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where("p_article_id",$data['p_article_id'])->find(); + if ($p_info['related']==""){ + $list[] = $data['article_id']; + }else{ + if(array_search($data['article_id'], json_decode($p_info['related']))!==false){ + return jsonSuccess([]); + } + $list = json_decode($p_info['related']); + $list[] = $data['article_id']; + sort($list); + } + $this->production_article_obj->where("p_article_id",$data['p_article_id'])->update(['related'=>json_encode(self::repalecArray($list))]); + return jsonSuccess($list); + } + + private function repalecArray($list){ + $frag = []; + foreach ($list as $v){ + $frag[] = $v; + } + return $frag; + } + + public function delProductRelated(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require", + "article_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where("p_article_id",$data['p_article_id'])->find(); + + $list = json_decode($p_info['related']); + $key = array_search($data['article_id'],$list); + if($key!==false){ + unset($list[$key]); + } + $this->production_article_obj->where("p_article_id",$data['p_article_id'])->update(['related'=>json_encode(self::repalecArray($list))]); + return jsonSuccess(['list'=>$list]); + + + } + +// public function editProductTopics(){ +// $data = $this->request->post(); +// $rule = new Validate([ +// "p_article_id"=>"require", +// "list"=>"require" +// ]); +// if(!$rule->check($data)){ +// return jsonError($rule->getError()); +// } +// $this->production_article_obj->where("p_article_id",$data['p_article_id'])->update(['topics'=>json_encode($data['list'])]); +// return jsonSuccess([]); +// } + + public function addProductTopic(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require", + "journal_topic_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where("p_article_id",$data['p_article_id'])->find(); + if($p_info['topics']==""){ + $list[] = $data['journal_topic_id']; + }else{ + if(array_search($data['journal_topic_id'],json_decode($p_info['topics']))!==false){ + return jsonSuccess([]); + } + $list = json_decode($p_info['topics']); + $list[] = $data['journal_topic_id']; + sort($list); + } + $this->production_article_obj->where("p_article_id",$data['p_article_id'])->update(['topics'=>json_encode(self::repalecArray($list))]); + return jsonSuccess(['list'=>$list]); + } + + + public function delProductTopic(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require", + "journal_topic_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $p_info = $this->production_article_obj->where("p_article_id",$data['p_article_id'])->find(); + $list = json_decode($p_info['topics']); + $key = array_search($data['journal_topic_id'],$list); + if($key!==false){ + unset($list[$key]); + } + $this->production_article_obj->where("p_article_id",$data['p_article_id'])->update(['topics'=>json_encode(self::repalecArray($list))]); + return jsonSuccess(['list'=>$list]); + } + + public function editProductRelated(){ + $data = $this->request->post(); + $rule = new Validate([ + "p_article_id"=>"require", + "list"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $this->production_article_obj->where("p_article_id",$data['p_article_id'])->update(['related'=>json_encode($data['list'])]); + return jsonSuccess([]); + } + + public function doTypeSettingNew(){ $data = $this->request->post(); $rule = new Validate([