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->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$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->staff_obj = Db::name('staff');
$this->staff_level_obj = Db::name('staff_level');
$this->staff_log_obj = Db::name('staff_log');
$this->staff_to_journal_obj = Db::name('staff_to_journal');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->chief_msg_obj = Db::name('chief_msg');
$this->article_to_board_obj = Db::name('article_to_board');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->login_auto_obj = Db::name('login_auto');
}
/**
* @title 获取主编列表
* @description 获取主编列表
* @author wangjinlei
* @url /api/Chief/getChiefList
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id(0为全部)
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
* @return chiefs:主编列表#
* @return count:总数#
*/
public function getChiefList(){
$data = $this->request->post();
$where['t_chief_to_journal.state'] = 0;
if($data['journal_id']!=0){
$where['t_chief_to_journal.journal_id'] = $data['journal_id'];
}
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$chiefs = $this->chief_to_journal_obj
->join('t_user','t_user.user_id = t_chief_to_journal.user_id','left')
->where($where)
->limit($limit_start,$data['pageSize'])
->select();
$count = $this->chief_to_journal_obj->where($where)->count();
foreach ($chiefs as $k => $v){
$chiefs[$k]['journal'] = $this->journal_obj->where('journal_id',$v['journal_id'])->find();
}
$re['chiefs'] = $chiefs;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 获取全部期刊
* @description 获取全部期刊
* @author wangjinlei
* @url /api/Chief/getAllJournals
* @method POST
*
* @return journals:期刊列表#
*/
public function getAllJournals(){
$journals = $this->journal_obj->where('state',0)->select();
$re['journals'] = $journals;
return jsonSuccess($re);
}
/**
* @title 添加主编
* @description 添加主编
* @author wangjinlei
* @url /api/Chief/addChief
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
* @param name:account type:string require:1 desc:主编账号
* @param name:email type:string require:1 desc:邮箱
* @param name:realname type:string require:0 desc:真实姓名
* @param name:password type:string require:1 desc:密码
* @param name:phone type:string require:0 desc:电话
*/
public function addChief(){
$data = $this->request->post();
$check = $this->user_obj->where('account',trim($data['account']))->whereOr('email',trim($data['email']))->find();
if($check){
return jsonError('Account or Email occupy!');
}
//存入数据
$insert['account'] = trim($data['account']);
$insert['email'] = trim($data['email']);
$insert['realname'] = isset($data['realname'])?trim($data['realname']):'';
$insert['password'] = md5(trim($data['password']));
$insert['phone'] = isset($data['phone'])?trim($data['phone']):'';
$insert['type'] = 3;
$insert['ctime'] = time();
$uid = $this->user_obj->insertGetId($insert);
//添加对应关系
$insert1['user_id'] = $uid;
$insert1['journal_id'] = $data['journal_id'];
$this->chief_to_journal_obj->insert($insert1);
return jsonSuccess([]);
}
/**
* @title 获取文章信息
* @description 获取文章信息
* @author wangjinlei
* @url /api/Chief/getArticleDetail
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
*/
public function getArticleDetail(){
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$aus = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select();
$au = '';
foreach ($aus as $k => $v){
$au .= $v['firstname'].' '.$v['lastname'].';';
}
$article_info['type'] = translateType($article_info['type']);
$article_info['author'] = substr($au, 0,-1);
$files = $this->article_file_obj->where('article_id',$article_info['article_id'])->where('type_name','manuscirpt')->select();
$article_info['file'] = $files;
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$article_info['journal'] = $journal_info;
$re['article'] = $article_info;
return jsonSuccess($re);
}
/**
* @title 主编自适应登录
* @description 主编自适应登录
* @author wangjinlei
* @url /api/Chief/autoLoginForChief
* @method POST
*
* @param name:code type:string require:1 desc:code码
*
* @return roles:身份列表#
* @return user:用户信息#
*/
public function autoLoginForChief(){
$data = $this->request->post();
$info = $this->login_auto_obj->where('code',$data['code'])->find();
if($info == null){
return jsonError('system error!');
}
$user_info = $this->user_obj->where('user_id',$info['user_id'])->find();
$roles = $this->getUserRoles($user_info['account']);
$re['roles'] = $roles;
$re['user'] = $user_info;
return jsonSuccess($re);
}
/**
* @title 获取主编主页进行中的文章列表
* @description 获取主编主页进行中的文章列表
* @author wangjinlei
* @url /api/Chief/getPArticlesForChief
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function getPArticlesForChief() {
$data = $this->request->post();
$list = $this->article_obj
->field('t_article.*,t_journal.title journal_title')
->join('t_journal','t_journal.journal_id = t_article.journal_id','left')
->where('t_article.journal_id',$data['journal_id'])
->where('t_article.state',6)
->select();
foreach ($list as $k => $v){
$auts = $this->article_author_obj->where('article_id',$v['article_id'])->where('state',0)->select();
$au = '';
foreach ($auts as $vv){
$au .= $vv['firstname'].' '.$vv['lastname'].';';
}
$list[$k]['author'] = substr($au, 0,-1);
}
foreach ($list as $k => $v){
if($v['type']){
$list[$k]['type'] = translateType($v['type']);
}
}
//加上文章领域
foreach($list as $k => $v){
$list[$k]['major_str'] = getMajorStr($v['major_id']);
// $major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
// $cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
// $list[$k]['major'] = $major['title'];
// $list[$k]['cmajor'] = $cmajor['title'];
}
$re['articles'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取主编主页历史的文章列表
* @description 获取主编主页历史的文章列表
* @author wangjinlei
* @url /api/Chief/getHArticlesForChief
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
*/
public function getHArticlesForChief(){
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->article_obj->field('t_article.*,t_journal.title journal_title')
->join('t_journal','t_journal.journal_id = t_article.journal_id','left')
->where('t_article.journal_id',$data['journal_id'])
->where('t_article.state',5)
->order('t_article.article_id desc')
->limit($limit_start,$data['pageSize'])
->select();
foreach ($list as $k => $v){
$auts = $this->article_author_obj->where('article_id',$v['article_id'])->where('state',0)->select();
$au = '';
foreach ($auts as $vv){
$au .= $vv['firstname'].' '.$vv['lastname'].';';
}
$list[$k]['author'] = substr($au, 0,-1);
}
$count = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',5)->count();
foreach ($list as $k => $v){
if($v['type']){
$list[$k]['type'] = translateType($v['type']);
}
}
//加上文章领域
foreach($list as $k => $v){
// $major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
// $cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
$list[$k]['major_str'] = getMajorStr($v['major_id']);
// $list[$k]['major'] = $major['title'];
// $list[$k]['cmajor'] = $cmajor['title'];
}
$re['count'] = $count;
$re['articles'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取主编期刊列表
* @description 获取主编期刊列表
* @author wangjinlei
* @url /api/Chief/getJournalsFromChief
* @method POST
*
* @param name:user_id type:int require:1 desc:主编userid
*/
public function getJournalsFromChief() {
$data = $this->request->post();
$journals = $this->chief_to_journal_obj->field('t_journal.*')->join('t_journal','t_journal.journal_id = t_chief_to_journal.journal_id','left')->where('t_chief_to_journal.user_id',$data['user_id'])->where('t_chief_to_journal.state',0)->select();
$re['journals'] = $journals;
return jsonSuccess($re);
}
/**
* @title 添加主编已注册
* @description 添加主编已注册
* @author wangjinlei
* @url /api/Chief/addChiefHas
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function addChiefHas(){
$data = $this->request->post();
$check = $this->chief_to_journal_obj
->where('user_id',$data['user_id'])
->where('journal_id',$data['journal_id'])
->where('state',0)->find();
if($check!=null){
return jsonError('has register!');
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
$this->chief_to_journal_obj->insert($insert);
return jsonSuccess([]);
}
/**
* @title 编辑主编信息
* @description 编辑主编信息
* @author wangjinlei
* @url /api/Chief/editChief
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
* @param name:email type:email require:1 desc:邮箱
* @param name:realname type:string require:0 desc:真实姓名
* @param name:phone type:string require:0 desc:电话
*/
public function editChief(){
$data = $this->request->post();
//存入数据
$insert['email'] = trim($data['email']);
$insert['realname'] = isset($data['realname'])?trim($data['realname']):'';
$insert['phone'] = isset($data['phone'])?trim($data['phone']):'';
$this->user_obj->where('user_id',$data['user_id'])->update($insert);
return jsonSuccess([]);
}
/**
* @title 主编期刊对应关系添加
* @description 主编期刊对应关系添加
* @author wangjinlei
* @url /api/Chief/addChiefToJournal
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function addChiefToJournal(){
$data = $this->request->post();
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
$this->chief_to_journal_obj->insert($insert);
return jsonSuccess([]);
}
/**
* @title 获取期刊详情
* @description 获取期刊详情
* @author wangjinlei
* @url /api/Chief/getJournalDetail
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function getJournalDetail(){
$data = $this->request->post();
$journal = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$re['journal'] = $journal;
return jsonSuccess($re);
}
/**
* @title 删除主编期刊对应关系
* @description 删除主编期刊对应关系
* @author wangjinlei
* @url /api/Chief/delChiefToJournal
* @method POST
*
* @param name:ctj_id type:int require:1 desc:关系表id
*/
public function delChiefToJournal(){
$data = $this->request->post();
$this->chief_to_journal_obj->where('ctj_id',$data['ctj_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* @title 获取期刊列表for主编
* @description 获取期刊列表for主编
* @author wangjinlei
* @url /api/Chief/getJournalForChief
* @method POST
*/
public function getJournalForChief(){
$list = $this->journal_obj->where('state',0)->select();
foreach ($list as $k => $v){
//获取期刊对应主编
$ca = $this->chief_to_journal_obj->field('t_user.*,t_chief_to_journal.*')->join('t_user','t_user.user_id = t_chief_to_journal.user_id','LEFT')->where('t_chief_to_journal.journal_id',$v['journal_id'])->where('t_chief_to_journal.state',0)->select();
$list[$k]['chief'] = $ca;
}
$re['journals'] = $list;
return jsonSuccess($re);
}
/**
* @title 增加期刊编委
* @description 增加期刊编委
* @author wangjinlei
* @url /api/Chief/addJournalBoard
* @method POST
*
* @param name:account type:string require:1 desc:主编账号
* @param name:journal_id type:int require:1 desc:期刊id
* @param name:password type:string require:1 desc:密码
* @param name:email type:string require:1 desc:邮箱
* @param name:realname type:string require:0 desc:真实姓名
* @param name:phone type:string require:0 desc:电话
*/
public function addJournalBoard(){
return jsonError('Service Stop');
// $data = $this->request->post();
// $check = $this->user_obj->where('account',trim($data['account']))->where('email',trim($data['email']))->where('state',0)->find();
// if($check){
// return jsonError('Account or Email has been register!');
// }
// $insert['account'] = trim($data['account']);
// $insert['email'] = trim($data['email']);
// $insert['password'] = md5(trim($data['password']));
// $insert['realname'] = isset($data['realname'])?trim($data['realname']):'';
// $insert['phone'] = isset($data['phone'])?trim($data['phone']):'';
// $insert['type'] = 4;
// $insert['ctime'] = time();
// $uid = $this->user_obj->insertGetId($insert);
// //添加对应关系
// $to_insert['user_id'] = $uid;
// $to_insert['journal_id'] = $data['journal_id'];
// $this->board_to_journal_obj->insert($to_insert);
// return jsonSuccess([]);
}
/**
* @title 增加期刊编委对应关系
* @description 增加期刊编委对应关系
* @author wangjinlei
* @url /api/Chief/addJournalBoardHas
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function addJournalBoardHas(){
return jsonError('Service Stop');
// $data = $this->request->post();
// $check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('journal_id',$data['journal_id'])->where('state',0)->find();
// if($check!=null){
// return jsonError('has register!');
// }
// $insert['journal_id'] = $data['journal_id'];
// $insert['user_id'] = $data['user_id'];
// $this->board_to_journal_obj->insert($insert);
// return jsonSuccess([]);
}
/**
* @title 获取编辑对应的期刊列表
* @description 获取编辑对应的期刊列表
* @author wangjinlei
* @url /api/Chief/getJournalsByEditor
* @method POST
*
* @param name:user_id type:int require:1 desc:用户表id
*
* @return journals:期刊列表#
*/
public function getJournalsByEditor(){
$data = $this->request->post();
$list = $this->journal_obj->where('editor_id',$data['user_id'])->where('state',0)->select();
$re['journals'] = $list;
return jsonSuccess($re);
}
/**
* @title 验证用户邮箱是否已注册
* @description 验证用户邮箱是否已注册
* @author wangjinlei
* @url /api/Chief/checkEmailForUser
* @method POST
*
* @param name:email type:string require:1 desc:用户名或邮箱
*
* @return user_info:用户详情#
*/
public function checkEmailForUser(){
$data = $this->request->post();
$user_info = $this->user_obj->where('account|email',$data['email'])->find();
//新增查询数据 chengxiaoling 20251020 start
if(!empty($user_info)){
$aWhere = ['reviewer_id' => $user_info['user_id']];
$user_reviewer_info = Db::name('user_reviewer_info')->field('technical,company as affiliation,website,field as research_areas')->where($aWhere)->find();
$user_info = empty($user_reviewer_info) ? $user_info : array_merge($user_info,$user_reviewer_info);
}
//新增查询数据 chengxiaoling 20251020 end
$re['user_info'] = $user_info;
return jsonSuccess($re);
}
/**
* @title 删除期刊编委
* @description 删除期刊编委
* @author wangjinlei
* @url /api/Chief/delJournalBoard
* @method POST
*
* @param name:btj_id type:int require:1 desc:关系表id
*/
public function delJournalBoard(){
$data = $this->request->post();
$this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* @title 升级审稿人至青年编委
* @description 升级审稿人至青年编委
* @author wangjinlei
* @url /api/Chief/upgradeReviewer
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
*/
public function upgradeReviewer(){
$data = $this->request->post();
$has = $this->user_obj->where('user_id',$data['user_id'])->find();
if($has['is_reviewer']!=1){
return jsonError('Only reviewer can become young board!');
}
$this->user_obj->where('user_id',$data['user_id'])->update(['is_yboard'=>1]);
return jsonSuccess([]);
}
/**
* @title 获取待审文章列表
* @description 获取待审文章列表
* @author wangjinlei
* @url /api/Chief/getBerevArticle
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function getBerevArticle(){
$data = $this->request->post();
//获取送审状态的文章
$article_list = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',2)->select();
$re['article_list'] = $article_list;
return jsonSuccess($re);
}
/**
* @title 添加文章消息
* @description 添加文章消息
* @author wangjinlei
* @url /api/Chief/addMsgForArticle
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
* @param name:content type:string require:1 desc:内容
* @param name:user_id type:int require:1 desc:发送用户的id
*/
public function addMsgForArticle(){
$data = $this->request->post();
$insert['article_id'] = $data['article_id'];
$insert['user_id'] = $data['user_id'];
$insert['content'] = trim($data['content']);
$insert['ctime'] = time();
$this->chief_msg_obj->insert($insert);
return jsonSuccess([]);
}
/**
* @title 获取文章消息列表
* @description 获取文章消息列表
* @author wangjinlei
* @url /api/Chief/getMsgList
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
*/
// public function getMsgList(){
// $data = $this->request->post();
// $list = $this->chief_msg_obj->join('t_user','t_user.user_id = t_chief_msg.user_id','LEFT')
// ->where('t_chief_msg.article_id',$data['article_id'])
// ->where('t_chief_msg.state',0)
// ->order('t_chief_msg.ctime desc')
// ->select();
// $re['msgs'] = $list;
//
// return jsonSuccess($re);
// }
/**
* @title 发送文章信息
* @description 发送文章信息
* @author wangjinlei
* @url /api/Chief/pushChiefMsg
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
* @param name:user_id type:int require:1 desc:发送者用户id
* @param name:content type:string require:1 desc:发送的内容
*/
public function pushChiefMsg(){
$data = $this->request->post();
$insert['article_id'] = $data['article_id'];
$insert['user_id'] = $data['user_id'];
$insert['content'] = trim($data['content']);
$insert['ctime'] = time();
$this->chief_msg_obj->insert($insert);
return jsonSuccess([]);
}
/**
* @title 获取主编详情信息列表
* @description 获取主编详情信息列表
* @author wangjinlei
* @url /api/Chief/getAllChiefMsg
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
*
* @return msgs:消息列表#
*/
public function getAllChiefMsg(){
$data = $this->request->post();
$msg = $this->chief_msg_obj
->where('t_chief_msg.article_id',$data['article_id'])
->where('t_chief_msg.state',0)
->order('t_chief_msg.chief_msg_id desc')
->select();
foreach ($msg as $k => $v){
$uinfo = $this->user_obj->where('user_id',$v['user_id'])->find();
$msg[$k]['user'] = $uinfo;
$msg[$k]['role'] = $this->getRoleForJournal($uinfo,$data['article_id']);
}
$re['msgs'] = $msg;
return jsonSuccess($re);
}
private function getRoleForJournal($uinfo,$article_id){
$article_info = $this->article_obj->where('article_id',$article_id)->find();
if($uinfo['type']==2){
return 'editor';
}
$reviewer_res = $this->reviewer_to_journal_obj->where('journal_id',$article_info['journal_id'])->where('reviewer_id',$uinfo['user_id'])->where('state',0)->find();
if($reviewer_res!=null){
return 'yboard';
}
// $yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('is_yboard',1)->where('state',0)->find();
// if($yboard_res!=null){
// $roles[] = 'yboard';
// }
$chief_res = $this->chief_to_journal_obj->where('journal_id',$article_info['journal_id'])->where('user_id',$uinfo['user_id'])->where('state',0)->find();
if($chief_res != null){
return 'chief';
}
$board_res = $this->board_to_journal_obj->where('journal_id',$article_info['journal_id'])->where('user_id',$uinfo['user_id'])->where('state',0)->find();
if($board_res != null){
return 'board';
}
return 'author';
}
/**
* @title 增加文章编委
* @description 增加文章编委
* @author wangjinlei
* @url /api/Chief/addArticleBoard
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
* @param name:board_id type:int require:1 desc:user_id用户id
*/
public function addArticleBoard(){
$data = $this->request->post();
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$board_info = $this->user_obj->where('user_id',$data['board_id'])->find();
// $board_rev_info = $this->user_reviewer_info_obj->where("reviewer_id",$board_info['user_id'])->find();
$check = $this->article_to_board_obj->where('article_id',$data['article_id'])->where('board_id',$data['board_id'])->find();
if($check!=null){
return jsonError('Applied!');
}
$insert['article_id'] = $data['article_id'];
$insert['board_id'] = $data['board_id'];
$this->article_to_board_obj->insert($insert);
//发送邮件给编委,并创造直连链接
$tt = $article_info['accept_sn'].'
';
$tt .= 'Dear Dr. '.($board_info['realname']==''?$board_info["account"]:$board_info['realname']).',
';
$tt .= 'The manuscript entitled “'.$article_info['title'].'”is under fininal decision status of the journal '.$journal_info['title'].'.
';
$tt .= '(The manuscripit in fininal decision status has been peer-reviewed, and the authors had revised all review opinions.)
';
$tt .= '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 .= 'Any comments and decisions you make will be valued by the editorial board and the editor in chief. If you choose not to make a decision on this article, you need not to reply and log in the submission system, we will refer to the opinions of other experts.'
. '(Plese click here)
';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest.
';
$tt .= 'Thank you for your consideration.
';
$tt .= 'Look forward for your reply.
';
$tt .= 'Reviewer Center
';
$tt .= 'Your username:'.$board_info['realname'].'
';
$tt .= 'Sincerely,
';
$tt .= 'Editorial Office
';
$tt .= $journal_info['title'].'
';
$tt .= 'Email: '.$journal_info['email'].'
';
$tt .= 'Website: '.$journal_info['website'];
$maidata['email'] = $board_info['email'];
$maidata['title'] = $journal_info['title'];
$maidata['content'] = $tt;
$maidata['tmail'] = $journal_info['email'];
$maidata['tpassword'] = $journal_info['epassword'];
Queue::push( 'app\api\job\mail@fire' , $maidata , "tmail" );
$sendUser=[
'title'=>$journal_info['title'], // 邮件标题
'content'=>$tt,//邮件内容
'user_id'=>$board_info['user_id'], //收件人ID
'email'=>$board_info['email'],// 收件人邮箱
'journal_id'=>$journal_info['journal_id'], // 期刊ID
'sendEmail'=>$journal_info['email'], // 期刊邮箱
'sendPassword'=>$journal_info['epassword'], // 期刊密码
'from_name'=>'TMR'
];
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
return jsonSuccess([]);
}
private function creatLoginUrlForBoard($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/edit_text?Art_id='.$article_id.'&act='.$code;
return $url;
}
/**
* @title 删除文章编委
* @description 删除文章编委
* @author wangjinlei
* @url /api/Chief/delArticleBoard
* @method POST
*
* @param name:article_board_id type:int require:1 desc:id号
*/
public function delArticleBoard(){
$data = $this->request->post();
$this->article_to_board_obj->where('article_board_id',$data['article_board_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* @title 获取文章编委列表
* @description 获取文章编委列表
* @author wangjinlei
* @url /api/Chief/getArticleBoard
* @method POST
*
* @param name:article_id type:int require:1 desc:文章id
*
* @return boards:编委列表#
*/
public function getArticleBoard(){
$data = $this->request->post();
$list = $this->article_to_board_obj
->field('t_user.*,t_reviewer_major.ctitle major_title,t_user_reviewer_info.field field')
->join('t_user','t_user.user_id = t_article_to_board.board_id','left')
->join('t_user_reviewer_info','t_user_reviewer_info.reviewer_id = t_user.user_id','left')
->join('t_reviewer_major','t_reviewer_major.major_id = t_user_reviewer_info.major','left')
->where('t_article_to_board.article_id',$data['article_id'])
->where('t_article_to_board.state',0)->select();
$re['boards'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取文章编委池
* @description 获取文章编委池
* @author wangjinlei
* @url /api/Chief/getAllArticleBoards
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
* @param name:pageIndex type:int require:1 desc:当前页码
* @param name:pageSize type:int require:1 desc:每个页面的数据条数
*
* @return boards:编委池#
*/
public function getAllArticleBoards(){
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->board_to_journal_obj
->field('t_user.*,t_reviewer_major.ctitle major_title,t_user_reviewer_info.field field')
->join('t_user','t_user.user_id = t_board_to_journal.user_id')
->join('t_user_reviewer_info','t_user_reviewer_info.reviewer_id = t_user.user_id','left')
->join('t_reviewer_major','t_reviewer_major.major_id = t_user_reviewer_info.major','left')
->where('t_board_to_journal.journal_id',$data['journal_id'])
->where('t_board_to_journal.state',0)
->limit($limit_start,$data['pageSize'])
->select();
$count = $this->board_to_journal_obj
->where('t_board_to_journal.journal_id',$data['journal_id'])
->where('t_board_to_journal.state',0)
->count();
$re['boards'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 获取期刊编委列表
* @description 获取期刊编委列表
* @author wangjinlei
* @url /api/Chief/getJournalBoard
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*/
public function getJournalBoard(){
$data = $this->request->post();
$boards = $this->board_to_journal_obj
->join('t_user','t_user.user_id = t_board_to_journal.user_id','LEFT')
->where('t_board_to_journal.journal_id',$data['journal_id'])
->where('t_board_to_journal.state',0)
->select();
// foreach($boards as $k => $v){
// $boards[$k]['indexs'] = $this->user_index_obj
// ->where('user_id',$v['user_id'])
// ->where('state',0)
// ->order('year')->select();
// }
$re['boards']=$boards;
return jsonSuccess($re);
}
private function getUserRoles($account) {
$user_info = $this->user_obj->where('account',$account)->find();
if($user_info['type']==2){
$ros[] = 'editor';
return $ros;
}
$roles[] = 'author';
$reviewer_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
if($reviewer_res!=null){
$roles[] = 'reviewer';
}
$yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('is_yboard',1)->where('state',0)->find();
if($yboard_res!=null){
$roles[] = 'yboard';
}
$chief_res = $this->chief_to_journal_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
if($chief_res != null){
$roles[] = 'chief';
}
$board_res = $this->board_to_journal_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
if($board_res != null){
$roles[] = 'board';
}
return $roles;
}
}