1
This commit is contained in:
@@ -364,6 +364,134 @@ class Article extends Controller {
|
||||
return json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文章通过投稿系统
|
||||
*/
|
||||
public function addArticleForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'title' => 'require',
|
||||
'journal_stage_id' => 'require',
|
||||
'issn' => 'require',
|
||||
'type' => 'require',
|
||||
'doi' => 'require',
|
||||
'abstract' => 'require',
|
||||
'file_pdf' => 'require',
|
||||
'pub_date' => 'require',
|
||||
'keywords' => 'require',
|
||||
'npp'=>'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
||||
if(!is_dir(ROOT_PATH.'public'.DS.'articlePDF'.DS.date('Ymd'))){
|
||||
mkdir(ROOT_PATH.'public'.DS.'articlePDF'.DS.date('Ymd'));
|
||||
}
|
||||
$file_name = substr($data['file_pdf'],strripos($data['file_pdf'],'/')+1);
|
||||
$co = copy("http://api.tmrjournals.com/public/".$data['file_pdf'],ROOT_PATH.'public'.DS.'articlePDF'.DS.date('Ymd').DS.$file_name);
|
||||
if($co!=1){
|
||||
return jsonError('copy error!');
|
||||
}
|
||||
//处理基本信息
|
||||
$insert['title'] = trim($data['title']);
|
||||
$insert['journal_id'] = $journal_info['journal_id'];
|
||||
$insert['journal_stage_id'] = $data['journal_stage_id'];
|
||||
$insert['type'] = $data['type'];
|
||||
if(isset($data['icon'])&&$data['icon']!=''){
|
||||
$insert['icon'] = $data['icon'];
|
||||
}
|
||||
$insert['doi'] = $data['doi'];
|
||||
$insert['abstract'] = $data['abstract'];
|
||||
$insert['pub_date'] = $data['pub_date'];
|
||||
$insert['keywords'] = $data['keywords'];
|
||||
$insert['npp'] = $data['npp'];
|
||||
$insert['file_pdf'] = date('Ymd').DS.$file_name;
|
||||
$insert['ctime'] = time();
|
||||
|
||||
$aid = $this->article_obj->insertGetId($insert);
|
||||
|
||||
//处理作者
|
||||
|
||||
|
||||
$data['authors'] = "[{\"art_aut_id\":6474,\"article_id\":2065,\"firstname\":\"Tadele\",\"lastname\":\"Yadesa\",\"orcid\":\"https:\\/\\/orcid.org\\/ 0000-0001-5151-2610\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"maatiikoo4@gmail.com\",\"author_title\":\"Ph.D.\",\"country\":\"Uganda\",\"address\":\"Mbarara University of Science and Technology P.O.BOX 1410\",\"is_super\":1,\"is_report\":1,\"state\":0},{\"art_aut_id\":6475,\"article_id\":2065,\"firstname\":\"Oliver\",\"lastname\":\"Kushemererwa\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"Kusholiver@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6476,\"article_id\":2065,\"firstname\":\"Joshua\",\"lastname\":\"Kiptoo\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"KIPTOOKWALIA@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6477,\"article_id\":2065,\"firstname\":\"John\",\"lastname\":\"Isiiko\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"isiikojohn@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6478,\"article_id\":2065,\"firstname\":\"Bonny\",\"lastname\":\"Luzze\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"tottojrlz@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6479,\"article_id\":2065,\"firstname\":\"Jacinta\",\"lastname\":\"Ojia\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Internal medicine\",\"email\":\"ambark21@yahoo.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6480,\"article_id\":2065,\"firstname\":\"Mohamed\",\"lastname\":\"Abdirahman\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Internal medicine\",\"email\":\"dr.mma001838@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":1,\"is_report\":0,\"state\":0}]";
|
||||
|
||||
$authors = object_to_array(json_decode($data['authors']));
|
||||
|
||||
|
||||
$o = [];
|
||||
$orgs = [];
|
||||
foreach($authors as $k => $v){
|
||||
if(in_array($v['company'],$orgs)){
|
||||
continue;
|
||||
}
|
||||
$orgs[] = $v['company'];
|
||||
}
|
||||
foreach($orgs as $v){
|
||||
$insert_oo['article_id'] = $aid;
|
||||
$insert_oo['organ_name'] = $v;
|
||||
$ca_id = $this->article_organ_obj->insertGetId($insert_oo);
|
||||
$o[$v] = $ca_id;
|
||||
}
|
||||
foreach($authors as $v){
|
||||
$insert_author['article_id'] = $aid;
|
||||
$insert_author['author_name'] = $v['firstname'].' '.$v['lastname'];
|
||||
$insert_author['first_name'] = $v['firstname'];
|
||||
$insert_author['last_name'] = $v['lastname'];
|
||||
$insert_author['author_country'] = $v['country'];
|
||||
$insert_author['is_first'] = $v['is_super'];
|
||||
$insert_author['is_report'] = $v['is_report'];
|
||||
$insert_author['email'] = $v['email'];
|
||||
$ca_au_id = $this->article_author_obj->insertGetId($insert_author);
|
||||
$insert_orm['article_id'] = $aid;
|
||||
$insert_orm['article_author_id'] = $ca_au_id;
|
||||
$insert_orm['article_organ_id'] = $o[$v['company']];
|
||||
$this->author_to_organ_obj->insert($insert_orm);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function authortest(){
|
||||
$str = "[{\"art_aut_id\":6474,\"article_id\":2065,\"firstname\":\"Tadele\",\"lastname\":\"Yadesa\",\"orcid\":\"https:\\/\\/orcid.org\\/ 0000-0001-5151-2610\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"maatiikoo4@gmail.com\",\"author_title\":\"Ph.D.\",\"country\":\"Uganda\",\"address\":\"Mbarara University of Science and Technology P.O.BOX 1410\",\"is_super\":1,\"is_report\":1,\"state\":0},{\"art_aut_id\":6475,\"article_id\":2065,\"firstname\":\"Oliver\",\"lastname\":\"Kushemererwa\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"Kusholiver@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6476,\"article_id\":2065,\"firstname\":\"Joshua\",\"lastname\":\"Kiptoo\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"KIPTOOKWALIA@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6477,\"article_id\":2065,\"firstname\":\"John\",\"lastname\":\"Isiiko\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"isiikojohn@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6478,\"article_id\":2065,\"firstname\":\"Bonny\",\"lastname\":\"Luzze\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Pharmacy\",\"email\":\"tottojrlz@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6479,\"article_id\":2065,\"firstname\":\"Jacinta\",\"lastname\":\"Ojia\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Internal medicine\",\"email\":\"ambark21@yahoo.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":0,\"is_report\":0,\"state\":0},{\"art_aut_id\":6480,\"article_id\":2065,\"firstname\":\"Mohamed\",\"lastname\":\"Abdirahman\",\"orcid\":\"\",\"company\":\"Mbarara University of Science and Technology\",\"department\":\"Internal medicine\",\"email\":\"dr.mma001838@gmail.com\",\"author_title\":\"Others\",\"country\":\"Uganda\",\"address\":\"\",\"is_super\":1,\"is_report\":0,\"state\":0}]";
|
||||
$authors = object_to_array(json_decode($str));
|
||||
$o = [];
|
||||
$orgs = [];
|
||||
foreach($authors as $k => $v){
|
||||
if(in_array($v['company'],$orgs)){
|
||||
continue;
|
||||
}
|
||||
$orgs[] = $v['company'];
|
||||
}
|
||||
foreach($orgs as $v){
|
||||
$insert['article_id'] = 8888;
|
||||
$insert['organ_name'] = $v;
|
||||
$ca_id = $this->article_organ_obj->insertGetId($insert);
|
||||
$o[$v] = $ca_id;
|
||||
}
|
||||
foreach($authors as $v){
|
||||
$insert_author['article_id'] = 8888;
|
||||
$insert_author['author_name'] = $v['firstname'].' '.$v['lastname'];
|
||||
$insert_author['first_name'] = $v['firstname'];
|
||||
$insert_author['last_name'] = $v['lastname'];
|
||||
$insert_author['author_country'] = $v['country'];
|
||||
$insert_author['is_first'] = $v['is_super'];
|
||||
$insert_author['is_report'] = $v['is_report'];
|
||||
$insert_author['email'] = $v['email'];
|
||||
$ca_au_id = $this->article_author_obj->insertGetId($insert_author);
|
||||
$insert_orm['article_id'] = 8888;
|
||||
$insert_orm['article_author_id'] = $ca_au_id;
|
||||
$insert_orm['article_organ_id'] = $o[$v['company']];
|
||||
$this->author_to_organ_obj->insert($insert_orm);
|
||||
}
|
||||
echo 'ok';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @title 获取文章基本信息
|
||||
* @description 获取文章基本信息
|
||||
|
||||
@@ -769,7 +769,8 @@ class Journal extends Controller
|
||||
/**
|
||||
* 推送邮件给编委
|
||||
*/
|
||||
private function pushEmailToBoardByJournal(){
|
||||
private function pushEmailToBoardByJournal()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'journal_id' => 'require'
|
||||
@@ -816,7 +817,8 @@ class Journal extends Controller
|
||||
/**
|
||||
* 发送推广邮件到订阅者
|
||||
*/
|
||||
public function pushEmailToDY(){
|
||||
public function pushEmailToDY()
|
||||
{
|
||||
|
||||
$frag = $this->subscribe_journal_obj->where('journal_id', 1)->where('state', 0)->limit(0, 1000)->select();
|
||||
|
||||
@@ -1444,6 +1446,31 @@ class Journal extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加分期应对投稿系统
|
||||
*/
|
||||
public function addStageForTG(){
|
||||
$data = $this->request->post();
|
||||
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
||||
$insert_data['journal_id'] = $journal_info['journal_id'];
|
||||
$insert_data['stage_year'] = $data['stage_year'];
|
||||
$insert_data['stage_vol'] = $data['stage_vol'];
|
||||
$insert_data['stage_no'] = $data['stage_no'];
|
||||
$insert_data['stage_pagename'] = $data['stage_pagename'];
|
||||
$insert_data['stage_page'] = $data['stage_page'];
|
||||
$insert_data['issue_date'] = $data['issue_date'];
|
||||
if (isset($data['stage_icon']) && !empty($data['stage_icon'])) {
|
||||
$insert_data['stage_icon'] = $data['stage_icon'];
|
||||
}
|
||||
$res = $this->journal_stage_obj->insert($insert_data);
|
||||
if ($res) {
|
||||
return json(['code' => 0, 'msg' => 'success']);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => 'system error']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊分期
|
||||
* @description 获取期刊分期
|
||||
@@ -1464,6 +1491,25 @@ class Journal extends Controller
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => ['journal' => $journal_info, 'stage_list' => $stage_list]]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取stages通过issn号
|
||||
*/
|
||||
public function getStageByISSN()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'issn' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
||||
$stages = $this->journal_stage_obj->where('journal_id',$journal_info['journal_id'])->where('state',0)->order('journal_stage_id desc')->select();
|
||||
$re['stages'] = $stages;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除期刊分期
|
||||
* @description 删除期刊分期
|
||||
|
||||
Reference in New Issue
Block a user