This commit is contained in:
wangjinlei
2022-02-28 10:00:50 +08:00
parent 4c6f6d97c1
commit 7b0edf5da5
6 changed files with 289 additions and 68 deletions

View File

@@ -26,6 +26,8 @@ class User extends Controller {
protected $user_msg_obj = '';
protected $chief_to_journal_obj = '';
protected $board_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_author_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -41,6 +43,8 @@ class User extends Controller {
$this->user_msg_obj = Db::name('user_msg');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->reviewer_from_author_obj = Db::name('reviewer_from_author');
$this->article_author_obj = Db::name('article_author');
}
/**
@@ -336,7 +340,7 @@ class User extends Controller {
$tt .= "Username:$account<br>";
$tt .= "Password:" . $data['password'] . '<br><br>';
$tt .= "Many thanks<br>TMR Publishing Group";
sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt,);
sendEmail($email, 'Dear ' . $data['name'], 'TMR', $tt);
return json($inser_data);
}
@@ -556,15 +560,155 @@ class User extends Controller {
* 获取申请详情
*/
public function getApplyDetail() {
$reviewerId = $this->request->post('reviewerId');
$where['t_user_reviewer_apply.reviewer_id'] = $reviewerId;
$res = $this->user_reviewer_obj->field('t_user_reviewer_apply.*,t_journal.title journal,t_reviewer_major.title major_title')->join('t_journal', 't_journal.journal_id = t_user_reviewer_apply.journal_id', 'left')->join('t_reviewer_major', 't_user_reviewer_apply.major = t_reviewer_major.major_id', 'LEFT')->where($where)->find();
$reviewerId = $this->request->post('reviewerApplyId');
$where['t_user_reviewer_apply.reviewer_apply_id'] = $reviewerId;
$res = $this->user_reviewer_obj
->field('t_user_reviewer_apply.*,t_journal.title journal,t_reviewer_major.title major_title')
->join('t_journal', 't_journal.journal_id = t_user_reviewer_apply.journal_id', 'left')
->join('t_reviewer_major', 't_user_reviewer_apply.major = t_reviewer_major.major_id', 'LEFT')
->where($where)
->find();
if ($res) {
return json(['code' => 0, 'data' => $res]);
} else {
return json(['code' => 1]);
}
}
/**
* @title 获取作者转审稿人列表
* @description 获取作者转审稿人列表
* @author wangjinlei
* @url /api/User/getAuthorToReviewerList
* @method POST
*
* @param name:username type:string require:1 desc:用户名
* @param name:journal_id type:int require:1 desc:期刊id0是全部
*
* @return reviewerTrans:列表#
*/
public function getAuthorToReviewerList(){
$data = $this->request->post();
$user_info = $this->user_obj->where('account',$data['username'])->find();
$journals = $this->journal_obj->where("editor_id",$user_info['user_id'])->where('state',0)->column("journal_id");
$where['t_reviewer_from_author.rfa_state'] = 0;
if($data['journal_id']==0){
$where['t_reviewer_from_author.journal_id'] = ["in",$journals];
}else{
$where['t_reviewer_from_author.journal_id'] = $data['journal_id'];
}
$list = $this->reviewer_from_author_obj
->field("t_reviewer_from_author.rfa_id,t_article_author.*,t_journal.title journal_title")
->join("t_article_author","t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id","left")
->join("t_journal","t_journal.journal_id = t_reviewer_from_author.journal_id","left")
->where($where)
->select();
$re['reviewerTrans'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取作者转审稿人详情
* @description 获取作者转审稿人详情
* @author wangjinlei
* @url /api/User/getAuthorToReviewerDetail
* @method POST
*
* @param name:rfa_id type:int require:1 desc:实例id
*
* @return reviewerTrans:列表#
*/
public function getAuthorToReviewerDetail(){
$data = $this->request->post();
$detail = $this->reviewer_from_author_obj
->field("t_reviewer_from_author.rfa_id,t_article_author.*,t_journal.title journal_title")
->join("t_article_author","t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id","left")
->join("t_journal","t_journal.journal_id = t_reviewer_from_author.journal_id","left")
->where("rfa_id",$data['rfa_id'])
->find();
$re['reviewerTran'] = $detail;
return jsonSuccess($re);
}
/**
* @title 作者转审稿人提交信息并通过
* @description 作者转审稿人提交信息并通过
* @author wangjinlei
* @url /api/User/ReviewerFromAuthorAdopt
* @method POST
*
* @param name:rfa_id type:int require:1 desc:实例id
* @param name:company type:String require:1 desc:单位
* @param name:country type:String require:1 desc:国家
* @param name:email type:String require:1 desc:邮箱
* @param name:field type:String require:1 desc:领域描述
* @param name:gender type:String require:1 desc:1男2女
* @param name:introduction type:String require:1 desc:简介
* @param name:major type:int require:1 desc:major_id
* @param name:qualifications type:String require:1 desc:cv地址
* @param name:author_title type:String require:1 desc:职称
*
*
*/
public function ReviewerFromAuthorAdopt(){
$data = $this->request->post();
$rfa_info = $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$rfa_info['journal_id'])->find();
$art_aut_info = $this->article_author_obj->where('art_aut_id',$rfa_info['art_aut_id'])->find();
$user_info = $this->user_obj->where('email',$art_aut_info['email'])->where('state',0)->find();
if(!$user_info){
return jsonError("user no find!");
}
Db::startTrans();
$insert_info['reviewer_id'] = $user_info['user_id'];
$insert_info['gender'] = $data['gender'];
$insert_info['technical'] = $data['author_title'];
$insert_info['country'] = $data['country'];
$insert_info['introduction'] = $data['introduction'];
$insert_info['company'] = $data['company'];
$insert_info['major'] = $data['major'];
$insert_info['field'] = $data['field'];
$insert_info['qualifications'] = $data['qualifications'];
$res = $this->user_reviewer_info_obj->insertGetId($insert_info);
$insert_to['reviewer_id'] = $user_info['user_id'];
$insert_to['journal_id'] = $rfa_info['journal_id'];
$insert_to['account'] = $user_info['account'];
$insert_to['journal_title'] = $journal_info['title'];
$insert_to['ctime'] = time();
$res1 = $this->reviewer_to_journal_obj->insertGetId($insert_to);
$res2 = $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->update(['rfa_state'=>1]);
if($res && $res1 && $res2){
Db::commit();
return jsonSuccess([]);
} else {
Db::rollback();
return jsonError("system error!");
}
}
/**
* @title 作者转审稿人拒绝
* @description 作者转审稿人拒绝
* @author wangjinlei
* @url /api/User/ReviewerFromAuthorReject
* @method POST
*
* @param name:rfa_id type:int require:1 desc:实例id
*
*
*/
public function ReviewerFromAuthorReject(){
$data = $this->request->post();
$this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->update(['rfa_state'=>2]);
return jsonSuccess([]);
}
/**
* 通过审核人