405 lines
13 KiB
PHP
405 lines
13 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\controller\Base;
|
|
use think\Validate;
|
|
|
|
/**
|
|
* @title 公共管理相关
|
|
* @description 公共管理相关
|
|
*/
|
|
class Publish extends Base
|
|
{
|
|
|
|
public function __construct(\think\Request $request = null)
|
|
{
|
|
parent::__construct($request);
|
|
}
|
|
|
|
/**
|
|
* 获取online文章列表
|
|
*/
|
|
public function getOnlineList(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'issn'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$t_journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
|
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getOnlineArticleForSubmit';
|
|
$pra = [];
|
|
$pra['issn'] = $t_journal_info['issn'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$re['stages'] = $res['data']['stages'];
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取publish文章
|
|
*/
|
|
public function getPublicAiticles(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'issn'=>'require',
|
|
'pageIndex'=>'require',
|
|
'pageSize'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getArticleListForSubmit';
|
|
$pra = [];
|
|
$pra['issn'] = $data['issn'];
|
|
$pra['journal_stage_id'] = isset($data['journal_stage_id'])?$data['journal_stage_id']:0;
|
|
$pra['seach'] = isset($data['seach'])?trim($data['seach']):'';
|
|
$pra['pageIndex'] = $data['pageIndex'];
|
|
$pra['pageSize'] = $data['pageSize'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
|
|
$articles = $res['data']["articleList"];
|
|
|
|
foreach ($articles as $k => $v){
|
|
$a = explode('/',$v['doi']);
|
|
if(!isset($a[1])){
|
|
$articles[$k]['refers'] = [];
|
|
continue;
|
|
}
|
|
$pro_info = $this->production_article_obj->where('doi',$a[1])->where('state',2)->find();
|
|
if (!$pro_info){
|
|
$pid = $this->createEmptyProduction($v);
|
|
$articles[$k]['refers'] = [];
|
|
$articles[$k]['p_article_id'] = $pid;
|
|
continue;
|
|
}
|
|
$articles[$k]['p_article_id'] = $pro_info['p_article_id'];
|
|
$articles[$k]['refers'] = $this->production_article_refer_obj->where("p_article_id",$pro_info['p_article_id'])->where('state',0)->order("index")->select();
|
|
}
|
|
|
|
$re['count'] = $res['data']["count"];
|
|
$re['articleList'] = $articles;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 提前出刊
|
|
*/
|
|
public function pushPublish(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_stage_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/pushJournalPublishForSubmit';
|
|
$url1 = 'http://journalapi.tmrjournals.com/public/index.php/master/Datebase/dataPush';
|
|
$pra = [];
|
|
$pra['journal_stage_id'] = $data['journal_stage_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$res1 = object_to_array(json_decode(myPost($url1, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 获取期刊文章
|
|
*/
|
|
public function getJournalArticles(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'issn'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getArticleForSubmit';
|
|
$pra = [];
|
|
$pra['issn'] = $data['issn'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$re['stages'] = $res['data']['stages'];
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取所有分期
|
|
*/
|
|
public function getAllStages(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'issn'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getAllStagesForSubmit';
|
|
$pra = [];
|
|
$pra['issn'] = $data['issn'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$re['stages'] = $res['data']['stages'];
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取客座期刊列表
|
|
*/
|
|
public function getJournalSpecials(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'issn'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Special/getSpecialByIssn';
|
|
$pra = [];
|
|
$pra['journal_issn'] = $data['issn'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$re['stages'] = $res['data']['specials'];
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**添加refer通过拷贝word的形式
|
|
* @return void
|
|
*/
|
|
public function addRefersByWord(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"p_article_id"=>"require",
|
|
"contents"=>"require|array"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
foreach ($data['contents'] as $k => $v){
|
|
//处理content
|
|
if(strlen($v)<10){
|
|
continue;
|
|
}
|
|
$content = substr($v,stripos($v,".")+1);
|
|
$insert['p_article_id'] = $data['p_article_id'];
|
|
$insert['refer_frag'] = $content;
|
|
$insert['refer_type'] = "other";
|
|
$insert['cs'] = 0;
|
|
$this->production_article_refer_obj->insert($insert);
|
|
}
|
|
$this->refuseReferIndex($data['p_article_id']);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 编辑文章的客座期刊信息
|
|
*/
|
|
public function editArticleToSpecial(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require',
|
|
'journal_special_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/changeArticleSpecialForSubmit';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$pra['journal_special_id'] = $data['journal_special_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 编辑文章权重
|
|
*/
|
|
public function editArticle(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require',
|
|
'sort'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/changeArticleForSubmit';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$pra['sort'] = $data['sort'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 获取文章的基本信息
|
|
*/
|
|
public function getArticleDetail(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getArticleBase';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess($res['data']);
|
|
}
|
|
|
|
// /**
|
|
// * 获取期刊话题
|
|
// */
|
|
// public function getJournalTopics(){
|
|
// $data = $this->request->post();
|
|
// $rule = new Validate([
|
|
// 'issn'=>'require'
|
|
// ]);
|
|
// if(!$rule->check($data)){
|
|
// return jsonError($rule->getError());
|
|
// }
|
|
// $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getTopicByArticle';
|
|
// $pra = [];
|
|
// $pra['article_id'] = $data['article_id'];
|
|
// $res = object_to_array(json_decode(myPost($url, $pra)));
|
|
// return jsonSuccess($res['data']);
|
|
// }
|
|
|
|
/**
|
|
* 获取文章的期刊话题列表
|
|
*/
|
|
public function getArticleTopics(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getTopicByArticle';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess($res['data']);
|
|
}
|
|
|
|
/**
|
|
* 添加文章话题对应关系
|
|
*/
|
|
public function addArticleToTopic(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require',
|
|
'topic_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addTopicByArticle';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$pra['topic_id'] = $data['topic_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 删除文章话题对应关系
|
|
*/
|
|
public function delArticleToTopic(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_to_topic_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/delTopic';
|
|
$pra = [];
|
|
$pra['article_to_topic_id'] = $data['article_to_topic_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 获取相关文章列表
|
|
*/
|
|
public function getArticleRelates(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getRelatedArticles';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess($res['data']);
|
|
|
|
}
|
|
|
|
/**
|
|
* 获取关键词文章
|
|
*/
|
|
public function getKeywordArticleOrderJournal(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'keyword'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getKeywordArticleOrderJournalForSubmit';
|
|
$pra = [];
|
|
$pra['keyword'] = trim($data['keyword']);
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess($res['data']);
|
|
}
|
|
|
|
/**
|
|
* 添加相关文章
|
|
*/
|
|
public function addArticleRelate(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require',
|
|
'add_article_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addRelatedArticle';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$pra['add_article_id'] = $data['add_article_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 删除相关文章
|
|
*/
|
|
public function delArticleRelate(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'article_id'=>'require',
|
|
'del_article_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/delRelatedArticle';
|
|
$pra = [];
|
|
$pra['article_id'] = $data['article_id'];
|
|
$pra['del_article_id'] = $data['del_article_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
|
|
}
|
|
|
|
|
|
}
|