user_obj = Db::name('user');
$this->user_act_obj = Db::name('user_act');
$this->article_obj = Db::name('article');
$this->journal_obj = Db::name('journal');
$this->user_log_obj = Db::name('user_log');
$this->user_reviewer_info_obj = Db::name("user_reviewer_info");
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_reviewer_question_obj = Db::name('article_reviewer_question');
$this->article_msg_obj = Db::name('article_msg');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_author_obj = Db::name('article_author');
$this->article_transfer_obj = Db::name('article_transfer');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->login_auto_obj = Db::name('login_auto');
}
/**
* 获取文章列表(作者)
*/
public function getArticle() {
//接收参数
$data = $this->request->post();
//构造查询条件
$userres = $this->user_obj->where(['account' => $data['username']])->column('user_id');
$where['user_id'] = $userres[0];
if ($data['journal'] != 0) {
$where['t_article.journal_id'] = $data['journal'];
}
if($data['state'] != 0){
$where['t_article.state'] = $data['state'];
}
if ($data['name'] != '') {
$where['t_article.title'] = array('like', "%" . $data['name'] . "%");
}
//分页查询数据
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->article_obj->field('t_article.*,t_journal.title journalname')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->where($where)
->order('article_id desc')
->limit($limit_start, $data['pageSize'])->select();
$count = $this->article_obj->where($where)->count();
//返回数据
return json(['total' => $count, 'data' => $res]);
}
/**
* @title 获取文章列表(编辑)
* @description 获取文章列表(编辑)
* @author wangjinlei
* @url /api/Article/getArticleForEditor
* @method POST
*
* @param name:username type:string require:1 desc:编辑用户名
* @param name:journal type:int require:1 desc:期刊id
* @param name:state type:int require:1 desc:状态
* @param name:act type:int require:1 desc:1进行中2已完成
* @param name:sn type:string require:0 desc:流水号
* @param name:pageIndex type:int require:1 desc:当前页码
* @param name:pageSize type:int require:1 desc:每个页面的数据条数
*
* @return articles:文章列表#
* @return count:总数#
*/
public function getArticleForEditor() {
//接受参数
$data = $this->request->post();
//构造查询条件
if ($data['journal'] == 0) {//全部期刊
$userres = $this->user_obj->where(['account' => $data['username']])->column('user_id');
$journal_list = $this->journal_obj->where(['editor_id' => $userres[0]])->column('journal_id');
$where['t_article.journal_id'] = ['in', $journal_list];
} else {
$where['t_article.journal_id'] = $data['journal'];
}
if($data['state'] >= 0){
$where['t_article.state'] = $data['state'];
}else{
if($data['act']==1){
$where['t_article.state'] = array('in',[0,1,2,4,6]);
}else if($data['act']==2){
$where['t_article.state'] = array('in',[3,5]);
}
}
if(isset($data['sn'])&& trim($data['sn'])!=""){
$where["t_article.accept_sn"] = trim($data['sn']);
}
if ($data['name'] != '') {
$where['t_article.title'] = array('like', "%" . $data['name'] . "%");
}
//分页查询数据
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$res = $this->article_obj->field('t_article.*,t_journal.title journalname')
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
->where($where)
->order('t_article.article_id desc')
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->article_obj->where($where)->count();
return json(['total' => $count, 'data' => $res]);
}
/**
* 获取文章详情(作者,编辑)
*/
public function getArticleDetail() {
//接受参数
$data = $this->request->post();
//查询文章基础数据
$where['t_article.article_id'] = $data['articleId'];
$article_res = $this->article_obj->field('t_article.*,t_journal.title journalname,t_user.account')->join(array(['t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT'], ['t_user', 't_user.user_id = t_article.user_id', 'LEFT']))->where($where)->find();
//查询文章状态跟踪信息
$article_msg = $this->article_msg_obj->where(['article_id' => $data['articleId']])->where('state',0)->select();
$suggest = '';
//如果是退修状态,显示退休信息
// if($article_res['state']==4){
// $lastbean = end($article_msg);
// $suggest = $lastbean['content'];
// }
//查询审稿人审稿建议
if($article_res['state']==4){
$suggest = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article_reviewer_question.comments comments')
->join('t_article_reviewer_question','t_article_reviewer.art_rev_id=t_article_reviewer_question.art_rev_id','left')
->where('t_article_reviewer.state','<',4)
->where('t_article_reviewer.article_id',$article_res['article_id'])
->select();
}
//查询major信息
$major_data = [];
if($article_res['major_id']!=0){
$major_data['major'] = $this->reviewer_major_obj->where('major_id',$article_res['major_id'])->find();
}else{
$major_data['major'] = null;
}
if($article_res['cmajor_id']!=0){
$major_data['cmajor'] = $this->reviewer_major_obj->where('major_id',$article_res['cmajor_id'])->find();
}else{
$major_data['cmajor'] = null;
}
//查询文章作者信息
$author_res = $this->article_author_obj->where('article_id', $data['articleId'])->where('state', 0)->select();
//查询转投信息
$transfer_res = $this->article_transfer_obj->where('article_id',$data['articleId'])->select();
//查询建议转投详情
$transfer_info = $this->article_transfer_obj
->field('t_article_transfer.*,t_journal.title jourtitle')
->join('t_journal','t_journal.journal_id = t_article_transfer.journal_id','LEFT')
->where('t_article_transfer.article_id',$data['articleId'])
->where('t_article_transfer.state',2)
->find();
//更新文章操作记录状态
if ($data['human'] == 'editor') {
$up_data['author_act'] = 0;
} else {
$up_data['editor_act'] = 0;
}
$this->article_obj->where('article_id', $data['articleId'])->update($up_data);
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res,'suggest'=>$suggest,'transfer'=>$transfer_res,'transinfo'=>$transfer_info,'major'=>$major_data]);
}
/**
* 作者同意转投
*/
public function trans_manu(){
//接受参数
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
//更新文章状态
$this->article_obj->where('article_id',$data['article_id'])->update(['journal_id'=>$data['journal_id'],'editor_id'=>$journal_info['editor_id'],'author_act'=>1,'state'=>1]);
//跟新转投表状态
$this->article_transfer_obj->where('transfer_id',$data['transfer_id'])->update(['state'=>1]);
//添加文章状态信息
$insert_data['article_id'] = $data['article_id'];
$insert_data['content'] = 'manuscript transfer to :'.$journal_info['title'];
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = 1;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
//发送邮件提醒编辑有新的转投稿件
$tt1 = 'Dear editor';
$tt1 .= 'Please check the new transfer manuscript in the submission system.';
sendEmail($editor_info['email'],$journal_info['title'], $journal_info['title'], $tt1, $journal_info['email'], $journal_info['epassword']);
//发送消息给编辑
add_usermsg($journal_info['editor_id'], 'New transfer manuscript ', '/articleDetailEditor?id=' . $article_info['article_id']);
return json(['code'=>0]);
}
/**
* 修改文章详情(作者)
*/
public function editArticle() {
//接受参数查询信息
$data = $this->request->post();
$username = $data['username'];
$user_res = $this->user_obj->where(['account' => $username])->find();
$article_old_info = $this->article_obj->where('article_id',$data['articleId'])->find();
Db::startTrans();
//更新文章信息
$inset_data['keywords'] = $data['keyWords'];
$inset_data['fund'] = $data['fund'];
$inset_data['abstrart'] = $data['abstrart'];
$inset_data['author_act'] = 1;
$inset_data['state'] = $article_old_info['accept_sn']==''?0:1;
$where['article_id'] = $data['articleId'];
$up_res = $this->article_obj->where($where)->update($inset_data);
$article_info = $this->article_obj->where($where)->find();
$journal_info = $this->journal_obj->where("journal_id",$article_info["journal_id"])->find();
//更新作者信息
$aids = [];
foreach ($data['authorList'] as $v) {
if (isset($v['art_aut_id'])) {//改
$up['art_aut_id'] = $aids[] = $v['art_aut_id'];
$up['firstname'] = $v['firstname'];
$up['lastname'] = $v['lastname'];
$up['company'] = $v['company'];
$up['department'] = $v['department'];
$up['author_title'] = $v['title'];
$up['country'] = $v['country'];
$up['email'] = $v['email'];
$up['address'] = $v['address'];
$up['is_super'] = $v['isSuper'] == 'true'?1:0;
$up['is_report'] = $v['isReport'] == 'true'?1:0;
$this->article_author_obj->update($up);
} else {//增
if ($v['firstname'] == '') {
continue;
}
$ins['article_id'] = $data['articleId'];
$ins['firstname'] = $v['firstname'];
$ins['lastname'] = $v['lastname'];
$ins['company'] = $v['company'];
$ins['department'] = $v['department'];
$ins['author_title'] = $v['title'];
$ins['country'] = $v['country'];
$ins['email'] = $v['email'];
$ins['address'] = $v['address'];
$ins['is_super'] = $v['isSuper'] == 'true'?1:0;
$ins['is_report'] = $v['isReport'] == 'true'?1:0;
$aids[] = $this->article_author_obj->insertGetId($ins);
}
}
//删
$this->article_author_obj->where('article_id', $data['articleId'])->where('art_aut_id', 'not in', $aids)->update(['state' => 1]);
//增加article_msg
$insmsg_data['article_id'] = $data['articleId'];
$insmsg_data['content'] = '';
$insmsg_data['state_from'] = $article_old_info['state'];
$insmsg_data['state_to'] = $article_old_info['accept_sn']==''?0:1;
$insmsg_data['ctime'] = time();
$msg_res = $this->article_msg_obj->insert($insmsg_data);
//发送邮件
$journal_info = $this->journal_obj->where('journal_id',$article_old_info['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
$tt = 'Dear editor,
';
$tt .= 'The author changed the manuscript’s status, please check.
';
$tt .= 'TMR Publishing Group';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//记录历史file信息
$res1 = self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter');
$res2 = true;
if(isset($data['picturesAndTables'])){
foreach ($data['picturesAndTables'] as $v){
$res2=$res2?self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $v, 'picturesAndTables'):false;
}
}
// self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['picturesAndTables'], 'picturesAndTables');
$res3=self::save_article_file($data['articleId'], $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt');
$res4=self::save_article_file($data['articleId'],$user_res['user_id'],$user_res['account'],$data['totalpage'],'totalpage');
//增加用户操作log
$log_data['user_id'] = $article_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $data['username'] . "(" . $user_res['realname'] . "),修改了一篇文章:" . $article_info['title'] . ",时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$log_res=$this->user_log_obj->insert($log_data);
//增加usermsg
$umsg_res=add_usermsg($journal_info['editor_id'], 'The manuscript has new process: ' . $article_info['title'], '/articleDetailEditor?id=' . $article_info['article_id']);
if($up_res&&$msg_res&&$res1&&$res2&&$res3&&$res4&&$log_res&&$umsg_res){
Db::commit();
return json(['code' => 0]);
}else{
Db::rollback();
return json(['code' => 1]);
}
}
/**
* 修改文章的作者(作者)
*/
public function saveAuthor() {
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id',$data['articleId'])->find();
//更新作者(增删改)
$aids = [];
foreach ($data['authorList'] as $v) {
if (isset($v['art_aut_id'])) {//改
$up['art_aut_id'] = $aids[] = $v['art_aut_id'];
$up['author'] = $v['author'];
$up['company'] = $v['company'];
$up['email'] = $v['email'];
$up['address'] = $v['address'];
$up['is_super'] = $v['is_super'] == 'true' ? 1 : 0;
$up['is_report'] = $v['is_report'] == 'true'?1:0;
$this->article_author_obj->update($up);
} else {//增
if ($v['author'] == '') {
continue;
}
$ins['author'] = $v['author'];
$ins['article_id'] = $data['articleId'];
$ins['company'] = $v['company'];
$ins['email'] = $v['email'];
$ins['address'] = $v['address'];
$ins['is_super'] = $v['is_super'] == 'true' ? 1 : 0;
$ins['is_report'] = $v['is_report'] == 'true'?1:0;
$aids[] = $this->article_author_obj->insertGetId($ins);
}
}
//删
$this->article_author_obj->where('article_id', $data['articleId'])->where('art_aut_id', 'not in', $aids)->update(['state' => 1]);
//更新文章操作状态
$this->article_obj->where('article_id',$data['articleId'])->update(['author_act'=>1]);
//发送邮件通知编辑
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
// $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$tt = 'Dear editor,
';
$tt .= 'The author changed the manuscript’s information, please check.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
//添加usermsg
add_usermsg($journal_info['editor_id'], 'Manuscript authors be changed,please contact the author to confirm.', 'articleDetailEditor?id='.$data['articleId']);
return json(['code' => 0]);
}
/**
* 修改文章状态(编辑)
*/
public function editArticleEditor() {
//接受参数,查询信息
$data = $this->request->post();
$where_editor['account'] = $data['editname'];
$editor_info = $this->user_obj->where($where_editor)->find();
$where_article['article_id'] = $data['articleId'];
$article_info = $this->article_obj->where($where_article)->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$transfer_list = $this->article_transfer_obj->where('article_id',$data['articleId'])->where('state',0)->select();
$user_info = $this->user_obj->where(['user_id' => $article_info['user_id']])->find();
$user_rev_info = $this->user_reviewer_info_obj->where("reviewer_id",$user_info['user_id'])->find();
// $sn_content = '';//显示接收sn信息
//
// //接受文章时,生成流水号
// if ($article_info['state'] == 0 && $data['state'] == 1) {
// $update_data['accept_sn'] = getArticleSN($journal_info['abbr'],$article_info['type']);
// $sn_content .= 'your Manuscript ID: '.$update_data['accept_sn'].' ';
// }
if($data['state']==3 && count($transfer_list)>0){
//查询转投期刊信息
$transfer_journal = $this->journal_obj->where('journal_id',$transfer_list[0]['journal_id'])->find();
//转投
$this->article_obj->where('article_id',$data['articleId'])->update(['state'=>1,'journal_id'=>$transfer_list[0]['journal_id'],'author_act'=>1,'editor_id'=>$transfer_journal['editor_id']]);
//转投信息表信息状态改变
$this->article_transfer_obj->where('transfer_id',$transfer_list[0]['transfer_id'])->update(['state'=>1]);
//查找转投journal信息
$tran_journal = $this->journal_obj->where('journal_id',$transfer_list[0]['journal_id'])->find();
//转投后的作者信息
$trans_editor_info = $this->user_obj->where('user_id',$transfer_journal['editor_id'])->find();
//添加文章状态信息
$insert_data['article_id'] = $data['articleId'];
$insert_data['content'] = 'manuscript transfer to :'.$tran_journal['title'];
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = 1;
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
$user_rev_info = $this->user_reviewer_info_obj->where("reviewer_id",$user_info['user_id'])->find();
//发送邮件提醒转投给作者
$tt = '"'.$article_info['title'].'"
';
$tt .= $article_info['accept_sn'].'
';
$tt .= 'journal:'.$journal_info['title'].'
';
$tt .= 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_info['realname']==''?$user_info['account']:$user_info['realname']).',
';
$tt .= 'Thank you for submitting your paper to '.$journal_info['title'].'. Your manuscript has undergone review.
';
$tt .= 'Unfortunately the editors feel that '.$journal_info['title'].' is not the appropriate venue for your manuscript. You munuscript will transfer to journal - '.$tran_journal['title'].' as you co-submitting chose order.If you have questions about the Co-submission process, please contact publisher@tmrjournals.com within 48 hours.
Yours sincerely,
';
$tt .= 'Sincerely,
Editorial Office
';
$tt .= $journal_info['title'].'
';
$tt .= 'Subscribe to this journal
';
$tt .= 'Email: '.$journal_info['email'].'
';
$tt .= 'Website: '.$tran_journal['website'];
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送邮件提醒编辑有新的转投稿件
$tt1 = 'Dear editor';
$tt1 .= 'Please check the new transfer manuscript in the submission system.';
sendEmail($trans_editor_info['email'],$journal_info['title'], $journal_info['title'], $tt1, $journal_info['email'], $journal_info['epassword']);
//增加usermsg
add_usermsg($tran_journal['editor_id'], 'New transfer manuscript ', '/articleDetailEditor?id=' . $article_info['article_id']);
return json(['code'=>0]);
}else{
//添加文章状态信息(如果状态未更新可做通话用,并结束操作)
$insert_data['article_id'] = $data['articleId'];
$insert_data['content'] = $data['editormsg'];
$insert_data['state_from'] = $article_info['state'];
$insert_data['state_to'] = $data['state'];
$insert_data['ctime'] = time();
$this->article_msg_obj->insert($insert_data);
if ($article_info['state'] == $data['state']) {
$this->article_obj->where($where_article)->update(['editor_act'=>1]);
return json(['code' => 0]);
}
$update_data['state'] = $data['state'];
$update_data['editor_act'] = 1;
//更新文章状态
if($data['state']==4){
$update_data['ttime'] = time();
}
if($data['state']==3){
$update_data['rstime'] = time();
}
$this->article_obj->where($where_article)->update($update_data);
}
//发送文章状态更改邮件
if($data['state']==3){//拒稿
if($data['trsjournal']==0){
$tt = '"'.$article_info['title'].'"
';
$tt .= $article_info['accept_sn'].'
';
$tt .= 'journal:'.$journal_info['title'].'
';
$tt .= 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_info['realname']==''?$user_info['account']:$user_info['realname']).',
';
$tt .= 'Thank you for submitting your paper to '.$journal_info['title'].'. Your manuscript has undergone review.
';
$tt .= 'Unfortunately the editors feel that '.$journal_info['title'].' is not the appropriate venue for your manuscript,'
. ' and we are returning your manuscript to you so that you can submit it to another journal without delay. '
. '
Yours sincerely,
';
$tt .= 'Sincerely,
Editorial Office
';
}else{//转投
//查找转投journal信息
$trans_journal = $this->journal_obj->where('journal_id',$data['trsjournal'])->find();
// $tt = '"'.$article_info['title'].'"
';
// $tt .= $article_info['accept_sn'].'
';
// $tt .= 'journal:'.$journal_info['title'].'
';
// $tt .= 'Dear '.($user_info['realname']==''?'Authors':$user_info['realname']).',
';
// $tt .= 'Thank you for submitting your paper to '.$journal_info['title'].'. Your manuscript has undergone review.
';
// $tt .= 'Unfortunately the editors feel that '.$journal_info['title'].' is not the appropriate venue for your manuscript. I am writing just to follow up on the suggestion from the editor of Traditional Medicine Research that you might be interested in submitting your paper to '.$trans_journal['title'].' instead.
';
// $tt .= 'If you choose to pursue publication in '.$trans_journal['title'].', please click the folowing link to comfirm ('.$trans_journal['website'].').';
// $tt .= '
Yours sincerely,
';
// $tt .= 'Sincerely,
Editorial Office
';
$tt = 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_info['realname']==""?$user_info['account']:$user_info['realname']).'
';
$tt .= 'Thank you very much for submitting your manuscript "'.$article_info['title'].'" ('.$article_info['accept_sn'].'). We had read your paper discussed it with our editorial team. Unfortunately, our opinion is that the paper would not be a strong candidate for '.$journal_info['title'].'. When a paper is turned down on editorial grounds, we aim to return it to the authors as quickly as possible, avoiding a time-consuming peer-review process.
';
$tt .= 'Nevertheless, thank you for giving us the opportunity to consider your work. I am sorry that we cannot be more positive on this occasion and hope you are soon able to find an alternative journal. Although we cannot offer to publish your paper in '.$journal_info['title'].', the work may be appropriate for another journal in the TMR Publishing Group.
';
$tt .= 'I have asked the editor of '.$trans_journal['title'].' ('.$trans_journal['website'].'), and there is a good chance that your manuscript will be published there. If you wish to transfer your manuscript to a journal of your choice, please click on the agree button in the Submission System, you will not have to re-supply manuscript metadata and files.
';
$tt .= 'Yours Sincerely,
';
$tt .= $journal_info['title'].' | Editorial Office
';
$tt .= 'Email: '.$journal_info['email'].'
';
$tt .= 'Website:'.$journal_info['website'].'';
}
}else if($data['state']==5){//录用
//录用后更新录用时间
$this->article_obj->where('article_id',$article_info['article_id'])->update(['rtime'=> time()]);
$tt = 'Manuscript ID: '.$article_info['accept_sn'].'
';
$tt .= 'Manuscript Title: '.$article_info['title'].'
';
$tt .= 'Authors’ Name: '.self::getArticleAuthors($article_info['article_id']).'
';
$tt .= 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_info['realname']==''?$user_info['account']:$user_info['realname']).',
It is a distinct pleasure to inform you that your manuscript has been accepted for publication in '.$journal_info['title'].' (ISSN '.$journal_info['issn'].').
The editor will contact you further by email soon.
';
$tt .= 'Sincerely,
Editorial Office
';
}else if($data['state']==4){//退修
$tt = $article_info['accept_sn'].'
';
$tt .= 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_info['realname']==''?$user_info['account']:$user_info['realname']).',
';
$tt .= 'Thank you for submitting the manuscript to '.$journal_info['title'].'.
';
$tt .= 'Please find the new comments in the "Author Center", Please submit your revised manuscript within two weeks.
';
$tt .= 'If you need more time to revise, you can send E-mial to tell us.
';
$tt .= 'Sincerely,
Editorial Office
';
}else if($data['state']==6){//终审
$tt = 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_info['realname']==''?$user_info['account']:$user_info['realname']).',
';
$tt .= 'Manuscript status: Your manuscript "'.$article_info['title'].'" is under reviewing by editorial member team of '.$journal_info['title'].'.';
}else{
$tt = '"'.$article_info['title'].'"
';
$tt .= $article_info['accept_sn'].'
';
$tt .= 'journal:'.$journal_info['title'].'
';
$tt .= 'Dear '.($user_info['realname']==''?$user_info['account']:$user_info['realname']).',
Please check the new status of your manuscript online.
';
}
$tt .= $journal_info['title'].'
';
$tt .= 'Subscribe to this journal
';
$tt .= 'Email: '.$journal_info['email'].'
';
$tt .= 'Website: '.$journal_info['website'];
if($data['state']!=5||$journal_info['journal_id']!=9){
sendEmail($user_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
}
if($data['state']==6){//进入终审,通知主编邮件
$chiefs = $this->chief_to_journal_obj->join('t_user','t_user.user_id = t_chief_to_journal.user_id','left')->where('t_chief_to_journal.journal_id',$journal_info['journal_id'])->where('t_chief_to_journal.state',0)->select();
foreach ($chiefs as $v){
$tts = 'Dear Dr. '.($v['realname']==''?$v['account']:$v['realname']).',
';
$tts .= 'The manuscript entitled “'.$article_info['title'].'” has been peer-reviewed, revised and about to be published in '.$journal_info['title'].'.
';
$tts .= 'If you want to review this article, you could use it Submission System (Plese click here).
';
$tts .= 'Your username: '.$v['account'].'
';
$tts .= 'Password: 123456qwe (Original password)
';
$tts .= 'If you are unable to review it now, you may provide your comments at a later time at your convenience. Then ,there is no need to reply to this email.
';
$tts .= 'Any comments you make will be valued by the editorial board. Please bring into our knowledge if there is any potential Conflict of Interest.
';
$tts .= 'Sincerely,
Editorial Office
'.$journal_info['title'].'
';
$tts .= 'Email: '.$journal_info['email'].'
';
$tts .= 'Website:'.$journal_info['website'].'';
sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tts, $journal_info['email'], $journal_info['epassword']);
}
}
//转投操作
if($data['trsjournal']!=0){
$tran_data['article_id'] = $data['articleId'];
$tran_data['journal_id'] = $data['trsjournal'];
$tran_data['ctime'] = time();
$tran_data['state'] = 2;
$this->article_transfer_obj->insert($tran_data);
}
//增加用户操作log
$log_data['user_id'] = $editor_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),更改了一篇文章:(" . $article_info['title'] . ")的状态,更改时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//增加usermsg
add_usermsg($article_info['user_id'], 'Your manuscript has new process: ' . $article_info['title'] , '/articleDetail?id=' . $article_info['article_id']);
return json(['code' => 0]);
}
public function emailtest(){
$v = $this->user_obj->where('user_id',54)->find();
$journal_info = $this->journal_obj->where('journal_id',9)->find();
$trans_journal = $this->journal_obj->where('journal_id',5)->find();
$article_info = $this->article_obj->where('article_id',1058)->find();
$tts = 'Dear Dr. '.($v['realname']==''?$v['account']:$v['realname']).',
';
$tts .= 'The manuscript entitled “'.$article_info['title'].'” has been peer-reviewed, revised and about to be published in '.$journal_info['title'].'.
';
$tts .= 'If you want to review this article, you could use it Submission System (Plese click here).
';
$tts .= 'Your username: '.$v['account'].'
';
$tts .= 'Password: 123456qwe (Original password)
';
$tts .= 'If you are unable to review it now, you may provide your comments at a later time at your convenience. Then ,there is no need to reply to this email.
';
$tts .= 'Any comments you make will be valued by the editorial board. Please bring into our knowledge if there is any potential Conflict of Interest.
';
$tts .= 'Sincerely,
Editorial Office
'.$journal_info['title'].'
';
$tts .= 'Email: '.$journal_info['email'].'
';
$tts .= 'Website:'.$journal_info['website'].'';
sendEmail($v['email'], $journal_info['title'], $journal_info['title'], $tts, $journal_info['email'], $journal_info['epassword']);
}
private function creatLoginUrlForChief($user,$article_id){
$code = md5(time().rand(1000,9999).'thinkphp');
$insert['user_id'] = $user['user_id'];
$insert['code'] = $code;
$insert['ctime'] = time();
$this->login_auto_obj->insert($insert);
$url = 'https://submission.tmrjournals.com/man_text?Art_id='.$article_id.'&act='.$code;
return $url;
}
private function creatLoginUrlForreviewer($user,$article_id){
$code = md5(time().rand(1000,9999).'thinkphp');
$insert['user_id'] = $user['user_id'];
$insert['code'] = $code;
$insert['ctime'] = time();
$this->login_auto_obj->insert($insert);
$url = 'https://submission.tmrjournals.com/per_text?Art_id='.$article_id.'&act='.$code;
return $url;
}
/**
* 编辑文章备注
*/
public function editArticleRemark(){
//接受参数
$data = $this->request->post();
$this->article_obj->where('article_id',$data['articleId'])->update(['remarks'=>$data['content']]);
return json(['code'=>0]);
}
/**
* 更改重复率(编辑)
*/
public function changeRepetition(){
//接受参数
$data = $this->request->post();
$this->article_obj->where('article_id',$data['articleId'])->update(['repetition'=>$data['repefen'],'repeurl'=>$data['zipurl']]);
return json(['code'=>0]);
}
/**
* 更改文章详情(编辑)
*/
public function changeArticleFileEditor() {
//接受参数查询信息
$data = $this->request->post();
$article_info = $this->article_obj->where(['article_id' => $data['articleId']])->find();
// $author_info = $this->user_obj->where('user_id',$article_info['user_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$editor_info = $this->user_obj->where(['user_id' => $journal_info['editor_id']])->find();
// $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
//存储文件入文件表
// self::save_article_file($data['articleId'], $editor_info['user_id'], $editor_info['account'], $data['coverLetter'], 'coverLetter');
// self::save_article_file($data['articleId'], $editor_info['user_id'], $editor_info['account'], $data['picturesAndTables'], 'picturesAndTables');
self::save_article_file($data['articleId'], $editor_info['user_id'], $editor_info['account'], $data['manuscirpt'], 'manuscirpt');
//更新文章状态(提醒用户)
$this->article_obj->where('article_id', $data['articleId'])->update(['editor_act' => 1]);
//添加article_msg信息
// $insmsg_data['article_id'] = $data['articleId'];
// $insmsg_data['content'] = '';
// $insmsg_data['state_from'] = $article_info['state'];
// $insmsg_data['state_to'] = 4;
// $insmsg_data['ctime'] = time();
// $this->article_msg_obj->insert($insmsg_data);
//发送email提醒用户
// $tt = $article_info['accept_sn'].'
';
// $tt .= 'Dear author,
';
// $tt .= 'Thanks for submitting the manuscript to '.$journal_info['title'].'.
';
// $tt .= 'Here are the comments in the "Author Center", Please submit your revised manuscript within two weeks.
';
// $tt .= 'Sincerely,
Editorial Office
';
// $tt .= $journal_info['title'].'
';
// $tt .= 'Email:'.$journal_info['email'].'
';
// $tt .= 'Website: '.$journal_info['website'];
// sendEmail($author_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//增加用户操作log
$log_data['user_id'] = $editor_info['user_id'];
$log_data['type'] = 1;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),更改了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//增加usermsg
add_usermsg($article_info['user_id'], 'Your manuscript has new process: ' . $article_info['title'], '/articleDetail?id=' . $article_info['article_id']);
return json(['code' => 0]);
}
/**
* 添加文章审稿实例(编辑)
*/
public function addArticleReviewer() {
//接收参数,查询数据
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id', $data['articleId'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
$reviewer_info = $this->user_obj->where('user_id', $data['uid'])->find();
$reviewer_move = $this->user_reviewer_info_obj->where("reviewer_info_id",$reviewer_info['user_id'])->find();
// $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
//增加信息到文章审稿表
$insert_data['reviewer_id'] = $data['uid'];
$insert_data['article_id'] = $data['articleId'];
$insert_data['editor_act'] = 1;
$insert_data['ctime'] = time();
$insert_data['state'] = 5;
$res = $this->article_reviewer_obj->insertGetId($insert_data);
//修改文章状态->审稿中
$this->article_obj->where('article_id',$data['articleId'])->update(['state'=>2]);
//添加article_msg信息
$insmsg_data['article_id'] = $data['articleId'];
$insmsg_data['content'] = '';
$insmsg_data['state_from'] = $article_info['state'];
$insmsg_data['state_to'] = 2;
$insmsg_data['ctime'] = time();
$this->article_msg_obj->insert($insmsg_data);
//发送email提醒审稿员
$tt = $article_info['accept_sn'] . '
';
$tt .= 'Dear '.($reviewer_move==null||$reviewer_move['technical']=="Others"||$reviewer_move['technical']==""?"Dr.":$reviewer_move['technical'])." ".($reviewer_info['realname']==""?$reviewer_info['account']:$reviewer_info['realname']).'
';
$tt .= 'The manuscript entitled “'.$article_info['title'].'” has'
. ' been submitted to the journal '.$journal_info['title'].'. The Editor-in-Chief would'
. ' be most grateful if you could offer an opinion regarding its suitability for publication'
. ' in the journal '.$journal_info['title'].'.
';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 10 days of receipt of the manuscript.
';
$tt .= 'Thank you for your consideration.
Look forward for your reply.
';
// $tt .= 'Click here to review the article
';
$tt .= 'Click here to review the article
';
// $tt .= 'Click on the link to reject the review of this manuscript
';
$tt .= 'Your username:'.$reviewer_info['account'].'
';
$tt .= 'Your original password:123456qwe, if you have reset the password, please login with the new one or click the "forgot password".
';
$tt .= 'Sincerely,
Editorial Office
';
$tt .= 'Subscribe to this journal
';
$tt .= $journal_info['title'].'
';
$tt .= 'Email:'.$journal_info['email'].'
';
$tt .= 'Website:'.$journal_info['website'];
sendEmail($reviewer_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//记录userlog
$log_data['user_id'] = $article_info['editor_id'];
$log_data['type'] = 2;
$log_data['content'] = $editor_info['account'] . "(" . $editor_info['realname'] . "),添加了一个文章审稿实例:(" . $article_info['title'] . "-----" . $reviewer_info['account'] . "),添加时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$this->user_log_obj->insert($log_data);
//添加usermsg
add_usermsg($data['uid'], 'You have new manuscript to be approved', '/reviewerArticleDetail?id=' . $res);
return json(['code' => 0]);
}
/**
* 编辑添加审稿实例(临时开启,为了补充审稿实例不够)
*/
public function addArtRev(){
$data = $this->request->post();
//增加信息到文章审稿表
$insert['reviewer_id'] = $data['uid'];
$insert['article_id'] = $data['articleId'];
$insert['ctime'] = time();
$insert['state'] = 3;
$art_rev_id = $this->article_reviewer_obj->insertGetId($insert);
//添加问卷信息
$insert_data['art_rev_id'] = $art_rev_id;
$insert_data['qu1'] = $data['qu1'];
$insert_data['qu2'] = $data['qu2'];
$insert_data['qu3'] = $data['qu3'];
$insert_data['qu4'] = $data['qu4'];
$insert_data['qu5'] = $data['qu5'];
$insert_data['qu6'] = $data['qu6'];
$insert_data['qu7'] = $data['qu7'];
$insert_data['qu8'] = $data['qu8'];
$insert_data['qu9'] = $data['qu9']?1:0;
$insert_data['qu9_contents'] = $data['qu9contents'];
$insert_data['qu10'] = $data['qu10']?1:0;
$insert_data['qu10_contents'] = $data['qu10contents'];
$insert_data['qu11'] = $data['qu11']?1:0;
$insert_data['qu11_contents'] = $data['qu11contents'];
$insert_data['qu12'] = $data['qu12']?1:0;
$insert_data['qu12_contents'] = $data['qu12contents'];
$insert_data['qu13'] = $data['qu13']?1:0;
$insert_data['qu13_contents'] = $data['qu13contents'];
$insert_data['qu14'] = $data['qu14']?1:0;
$insert_data['qu14_contents'] = $data['qu14contents'];
$insert_data['qu15'] = $data['qu15']?1:0;
$insert_data['qu15_contents'] = $data['qu15contents'];
$insert_data['rated'] = $data['rated'];
$insert_data['recommend'] = $data['recommend'];
$insert_data['other'] = $data['other'];
$insert_data['confidential'] = $data['confident'];
$insert_data['comments'] = $data['comment'];
$insert_data['ctime'] = time();
$res = $this->article_reviewer_question_obj->insert($insert_data);
$re['code'] = 0;
return json($re);
}
/**
* 添加文章(作者)
*/
public function addArticle() {
//接受参数,查询信息
$data = $this->request->post();
$user_res = $this->user_obj->where('account', $data['username'])->find();
if($user_res['account']=='fariba'||$user_res['account']=='Mohammad Hossein'||$user_res['account']=='xiaoyueyue'||$user_res['account']=='sethlee000'||$user_res['account']=='yuanying9908'){
return json(['code'=>1,'msg'=>'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']);
}
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
//首先查重是否重复投稿
$checkArticle = $this->article_obj->where("title",trim($data['title']))->find();
if($checkArticle!=null){
return json(['code'=>1,'msg'=>'Warning: you re-submitting the article!']);
}
Db::startTrans();
//添加文章基础信息
$inset_data['user_id'] = $user_res['user_id'];
$inset_data['journal_id'] = $data['journal'];
$inset_data['editor_id'] = $journal_info['editor_id'];
$inset_data['title'] = trim($data['title']);
$inset_data['keywords'] = $data['keyWords'];
$inset_data['fund'] = trim($data['fund']);
$inset_data['accept_sn'] = getArticleSN($journal_info['abbr'],$data['type']);
$inset_data['type'] = $data['type'];
$inset_data['major_id'] = $data['major'];
$inset_data['cmajor_id'] = $data['cmajor'];
$inset_data['approval'] = $data['approval']=='true'?1:0;
$inset_data['abstrart'] = $data['abstrart'];
$inset_data['author_act'] = 1;
$inset_data['ctime'] = time();
$res = $this->article_obj->insertGetId($inset_data);
//上传文章作者信息
$authors = [];
foreach ($data['authorList'] as $v) {
if ($v['firstname'] == '') {
continue;
}
$i['article_id'] = $res;
$i['firstname'] = trim($v['firstname']);
$i['lastname'] = trim($v['lastname']);
$i['orcid'] = trim($v['orcid']);
$i['company'] = trim($v['company']);
$i['department'] = trim($v['department']);
$i['author_title'] = $v['title'];
$i['country'] = $v['country'];
$i['email'] = trim($v['email']);
$i['address'] = trim($v['address']);
$i['is_super'] = $v['isSuper'] == 'true' ? 1 : 0;
$i['is_report'] = $v['isReport'] == 'true'?1:0;
$authors[] = $i;
}
$res_author = $this->article_author_obj->insertAll($authors);
//增加转投信息
$transr = true;
if($data['istransfer']=='true'){
foreach ($data['checkedjours'] as $val){
$trans_insert['article_id'] = $res;
$trans_insert['journal_id'] = $val;
$trans_insert['ctime'] = time();
$transr = $transr?$this->article_transfer_obj->insert($trans_insert):false;
}
}
//增加articlefile表的信息
$res_file1 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['coverLetter'], 'coverLetter');
$res_file2 = true;
if(isset($data['picturesAndTables'])){
foreach ($data['picturesAndTables'] as $v){
$res_file2 = $res_file2?self::save_article_file($res, $user_res['user_id'], $user_res['account'], $v, 'picturesAndTables'):false;
}
}
$res_file4 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['totalpage'], 'totalpage');
$res_file3 = self::save_article_file($res, $user_res['user_id'], $user_res['account'], $data['manuscirpt'], 'manuscirpt');
//发送邮件到编辑,提醒有待审文章
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
$tt = 'Dear editor,
';
$tt .= 'Please check the new manuscript in the submission system.';
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt,$journal_info['email'],$journal_info['epassword']);
$user_rev_info = $this->user_reviewer_info_obj->where("reviewer_id",$user_res['user_id'])->find();
//发送邮件给作者,表示感谢
$tt1 = 'Dear '.($user_rev_info==null||$user_rev_info['technical']=="Others"||$user_rev_info['technical']==""?"Dr.":$user_rev_info['technical']).($user_res['realname']==''?$user_res['account']:$user_res['realname']).',
';
$tt1 .= 'Thank you for submitting your manuscript entitled "'.$data['title'].'". Your submission has been assigned the following tracking number:'.$inset_data['accept_sn'].'. We will be in touch again as soon as we have reached a decision. Please quote the tracking number in any communication. This e-mail simply acknowledges receipt of your submission. If the editors decide for editorial reasons that the paper is unsuitable for publication in '.$journal_info['title'].', you will be informed as soon as possible.
';
if($journal_info['journal_id']==9){//life research 期刊发送收到文章邮件
$tt1 .= 'Life Research applies the CC BY-NC 4.0 license. Full details of the policy can be found at https://www.tmrjournals.com/notice.html?J_num=14&footer_id=123. Authors should read Guide to Authors carefully before submitting.
';
$tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact liferes@tmrjournals.com.
';
$tt1 .= 'Thank you for choosing to submit your manuscript to Life Research.
';
$tt1 .= 'Yours sincerely,
Haoran Zhang
';
$tt1 .= 'Manuscript Administration, Life Research
https://www.tmrjournals.com/lr/';
}else{//其他期刊发送邮件
$tt1 .= 'You may check on the status of this manuscript in the Submission System. If you encounter any problems, please contact '.$journal_info['email'].'.
';
$tt1 .= 'Thank you for choosing to submit your manuscript to '.$journal_info['title'].'.
';
$tt1 .= 'Sincerely,
Editorial Office
';
$tt1 .= 'Subscribe to this journal
';
$tt1 .= $journal_info['title'].'
';
$tt1 .= 'Email: '.$journal_info['email'].'
';
$tt1 .= 'Website: '.$journal_info['website'];
}
sendEmail($user_res['email'],$journal_info['title'], $journal_info['title'], $tt1,$journal_info['email'],$journal_info['epassword']);
//增加用户操作log
$log_data['user_id'] = $user_res['user_id'];
$log_data['type'] = 0;
$log_data['content'] = $user_res['account'] . "(" . $user_res['realname'] . "),上传了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time());
$log_data['ctime'] = time();
$res_log = $this->user_log_obj->insert($log_data);
//增加usermsg
$res_msg = add_usermsg($journal_info['editor_id'], 'New manuscript', '/articleDetailEditor?id=' . $res);
if ($res && $res_author && $transr && $res_file1 && $res_file2 && $res_file3 && $res_file4 && $res_log && $res_msg) {
Db::commit();
return json(['code' => 0]);
} else {
Db::rollback();
return json(['code' => 1]);
}
}
/**
* 作者发送消息
*/
public function authorMessage(){
$data = $this->request->post();
$insert['article_id'] = $data['articleId'];
$insert['content'] = $data['content'];
$insert['ftype'] = 1;
$insert['ctime'] = time();
$this->article_msg_obj->insert($insert);
return json(['code'=>0]);
}
/**
* 获取期刊列表
*/
public function getJournal() {
$username = $this->request->post('username');
$where = [];
if ($username) {
$uidres = $this->user_obj->where(['account' => $username])->column('user_id');
$where['editor_id'] = $uidres[0];
}
$list = $this->journal_obj->where($where)->select();
return json($list);
}
/**
* 获取文章历史上传file列表
*/
public function getFilelistByArticleID() {
$article_id = $this->request->post('articleId');
$where['article_id'] = $article_id;
$res = $this->article_file_obj->where($where)->select();
$frag = [];
foreach ($res as $v) {
$frag[$v['type_name']][] = $v;
}
return json($frag);
}
/**
* 上传文章的文件
*/
public function up_file($type) {
$file = request()->file($type);
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
if ($info) {
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
/**
* 获取文章审稿实例列表
*/
public function getReviewerList() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$where['t_article_reviewer.article_id'] = $data['articleId'];
$res = $this->article_reviewer_obj->field('t_article_reviewer.*,t_user.email,t_user.account reviewer,t_user_reviewer_info.country country,t_user_reviewer_info.field,t_user_reviewer_info.company,t_reviewer_major.title major_title,t_reviewer_major.ctitle major_ctitle')
->join('t_user', 't_article_reviewer.reviewer_id = t_user.user_id', 'LEFT')
->join('t_user_reviewer_info', 't_article_reviewer.reviewer_id = t_user_reviewer_info.reviewer_id', 'LEFT')
->join('t_reviewer_major', 't_reviewer_major.major_id = t_user_reviewer_info.major', 'LEFT')
->where($where)->limit($limit_start, $data['pageSize'])->select();
$count = $this->article_reviewer_obj->where($where)->count();
if ($res) {
return json(['code' => 0, 'data' => $res, 'totle' => $count]);
} else {
return json(['code' => 1]);
}
}
/**
* 根据期刊别名获取期刊信息
*/
public function getJournalByAlias(){
//接收参数
$data = $this->request->post();
$res = $this->journal_obj->where('alias',$data['alias'])->find();
return json($res);
}
/**
* 获取审核人详情
*/
public function getReviewerdetail() {
$uid = $this->request->post('uid');
$res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*,t_reviewer_major.title major_title')
->join('t_user_reviewer_info', 't_user.user_id = t_user_reviewer_info.reviewer_id', 'LEFT')
->join('t_reviewer_major', 't_reviewer_major.major_id = t_user_reviewer_info.major', 'LEFT')
->where('t_user.user_id', $uid)->find();
return json(['code' => 0, 'data' => $res]);
}
/**
* 获取文章审核员list
*/
public function getArticleReviewerList() {
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id', $data['articleId'])->find();
// $revids = $this->reviewer_to_journal_obj->where('journal_id', $article_info['journal_id'])->where('state',0)->column('reviewer_id');
$noids = $this->article_reviewer_obj->where('article_id', $data['articleId'])->column('reviewer_id');
$res = $this->reviewer_to_journal_obj
->field('t_user.user_id,t_user.account')
->join('t_user','t_user.user_id = t_reviewer_to_journal.reviewer_id','left')
->join('t_user_reviewer_info', 't_user.user_id = t_user_reviewer_info.reviewer_id', 'LEFT')
->where('t_reviewer_to_journal.journal_id',$article_info['journal_id'])
->where('t_user.user_id','not in',$noids)
->where('t_user.state',0)
->select();
// if ($noids != null) {
// $where['t_user.user_id'] = [['in', $revids], ['not in', $noids]];
// } else {
// $where['t_user.user_id'] = ['in', $revids];
// }
// $where['t_user.state'] = 0;
// $res = $this->user_obj->field('t_user.*,t_user_reviewer_info.*')
// ->join('t_user_reviewer_info', 't_user.user_id = t_user_reviewer_info.reviewer_id', 'LEFT')
// ->where($where)
// ->select();
//
// echo $this->user_obj->getLastSql();
// die;
if ($res) {
return json(['code' => 0, 'data' => $res]);
} else {
return json(['code' => 1]);
}
}
/**
* 获取文章数通过期刊issn号
*/
public function getArticleForJournal(){
$data = $this->request->post();
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
$list = $this->article_obj
->where('journal_id',$journal_info['journal_id'])
->where('state','in','0,1,2,4')
// ->where('ctime','>',$data['ctime'])
->select();
$re['articles'] = $list;
return jsonSuccess($re);
}
/**
* 存储article文件历史信息
*/
private function save_article_file($article_id, $user_id, $username, $url, $type_name) {
//首先确定数据库里面是否存在此数据
$res = $this->article_file_obj->where(['file_url' => $url])->find();
if ($res) {//编辑的时候不能重复存储
return true;
}else if($type_name=='picturesAndTables' && $url == ''){
return true;
}else if($type_name=='coverLetter' && $url == ''){
return true;
}else if($type_name=='totalpage' && $url == ''){
return true;
}
$insert_data['article_id'] = $article_id;
$insert_data['user_id'] = $user_id;
$insert_data['username'] = $username;
$insert_data['file_url'] = $url;
$insert_data['type_name'] = $type_name;
$insert_data['ctime'] = time();
return $this->article_file_obj->insert($insert_data);
}
/**
* 获取文章作者字符串
* @param type $article_id
*/
private function getArticleAuthors($article_id){
$res = $this->article_author_obj->where('article_id',$article_id)->where('state',0)->select();
$frag = '';
foreach ($res as $v){
$frag .= $v['firstname'].$v['lastname'].',';
}
return substr($frag, 0,-1);
}
}