263 lines
9.1 KiB
PHP
263 lines
9.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use think\Controller;
|
|
use think\Db;
|
|
use think\Queue;
|
|
|
|
/**
|
|
* @title 编委相关接口
|
|
* @description 编委相关接口
|
|
*/
|
|
class Board extends Controller {
|
|
|
|
protected $article_obj = '';
|
|
protected $user_obj = '';
|
|
protected $user_act_obj = '';
|
|
protected $journal_obj = '';
|
|
protected $user_log_obj = '';
|
|
protected $reviewer_major_obj = '';
|
|
protected $reviewer_to_journal_obj = '';
|
|
protected $article_msg_obj = '';
|
|
protected $article_file_obj = '';
|
|
protected $article_reviewer_obj = '';
|
|
protected $article_author_obj = '';
|
|
protected $article_transfer_obj = '';
|
|
protected $staff_obj = '';
|
|
protected $staff_level_obj = '';
|
|
protected $staff_log_obj = '';
|
|
protected $staff_to_journal_obj = '';
|
|
protected $chief_to_journal_obj = '';
|
|
protected $board_to_journal_obj = '';
|
|
protected $chief_msg_obj = '';
|
|
protected $article_to_board_obj = '';
|
|
protected $login_auto_obj = '';
|
|
|
|
public function __construct(\think\Request $request = null) {
|
|
parent::__construct($request);
|
|
$this->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/Board/getBoardPendArticle
|
|
* @method POST
|
|
*
|
|
* @param name:user_id type:int require:1 desc:编委用户id
|
|
* @param name:journal_id type:int require:1 desc:期刊id
|
|
*
|
|
* @return articles:文章列表#
|
|
*/
|
|
public function getBoardPendArticle() {
|
|
$data = $this->request->post();
|
|
$list = $this->article_obj->where('journal_id', $data['journal_id'])->where('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']);
|
|
}
|
|
}
|
|
|
|
$re['articles'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 编委主页--获取历史文章
|
|
* @description 编委主页--获取历史文章
|
|
* @author wangjinlei
|
|
* @url /api/Board/getBoardHistArticles
|
|
* @method POST
|
|
*
|
|
* @param name:user_id type:int require:1 desc:编委用户id
|
|
* @param name:journal_id type:int require:1 desc:期刊id
|
|
*
|
|
* @return articles:文章列表#
|
|
*/
|
|
public function getBoardHistArticles(){
|
|
$data = $this->request->post();
|
|
$list = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',5)->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']);
|
|
}
|
|
}
|
|
|
|
$re['articles'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 编委主页--获取编委期刊列表
|
|
* @description 编委主页--获取编委期刊列表
|
|
* @author wangjinlei
|
|
* @url /api/Board/getBoardJournals
|
|
* @method POST
|
|
*
|
|
* @param name:user_id type:int require:1 desc:编委用户id
|
|
*
|
|
* @return journals:期刊列表#
|
|
*/
|
|
public function getBoardJournals(){
|
|
$data = $this->request->post();
|
|
$list = $this->board_to_journal_obj->field('t_journal.*,t_board_to_journal.btj_id')
|
|
->join('t_journal','t_board_to_journal.journal_id = t_journal.journal_id','left')
|
|
->where('t_board_to_journal.user_id',$data['user_id'])
|
|
->where('t_board_to_journal.state',0)
|
|
->select();
|
|
$re['journals'] = $list;
|
|
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 编委导入--获取官网编委
|
|
* @description 编委导入--获取官网编委
|
|
* @author wangjinlei
|
|
* @url /api/Board/getOffwebBoard
|
|
* @method POST
|
|
*
|
|
* @param name:journal_id type:int require:1 desc:期刊id
|
|
*
|
|
* @return boards:编委list#
|
|
*/
|
|
public function getOffwebBoard(){
|
|
$data = $this->request->post();
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
$cs['issn'] = $journal_info['issn'];
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/api/Main/getBoards';
|
|
$list = object_to_array(json_decode(myPost($url, $cs)));
|
|
|
|
foreach ($list as $k => $v){
|
|
if($v['tuser_id']==0){
|
|
continue;
|
|
}
|
|
$list[$k]['user'] = $this->user_obj->where('user_id',$v['tuser_id'])->find();
|
|
}
|
|
$re['boards'] = $list;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 编委导入--关联用户
|
|
* @description 编委导入--关联用户
|
|
* @author wangjinlei
|
|
* @url /api/Board/relationUser
|
|
* @method POST
|
|
*
|
|
* @param name:user_id type:int require:1 desc:用户id
|
|
* @param name:journal_id type:int require:1 desc:期刊id
|
|
* @param name:email type:string require:1 desc:邮箱
|
|
* @param name:jboard_id type:int require:1 desc:官网boardid
|
|
*
|
|
* @return boards:编委list#
|
|
*/
|
|
public function relationUser(){
|
|
$data = $this->request->post();
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/api/Main/bindBoard';
|
|
$cs['user_id'] = $data['user_id'];
|
|
$cs['board_id'] = $data['jboard_id'];
|
|
$cs['email'] = $data['email'];
|
|
$list = myPost($url, $cs);
|
|
$insert['user_id'] = $data['user_id'];
|
|
$insert['journal_id'] = $data['journal_id'];
|
|
$this->board_to_journal_obj->insert($insert);
|
|
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* @title 编委导入--获取全部审稿人
|
|
* @description 编委导入--获取全部审稿人
|
|
* @author wangjinlei
|
|
* @url /api/Board/getAllReviewer
|
|
* @method POST
|
|
*
|
|
* @return boards:编委list#
|
|
*/
|
|
public function getAllReviewer(){
|
|
$revs = $this->user_obj->where('is_reviewer',1)->where('state',0)->select();
|
|
$re['reviewers'] = $revs;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 编委导入--通过账号搜索用户
|
|
* @description 编委导入--通过账号搜索用户
|
|
* @author wangjinlei
|
|
* @url /api/Board/searchUserByAccount
|
|
* @method POST
|
|
*
|
|
* @param name:account type:string require:1 desc:用户名
|
|
*
|
|
* @return users:用户#
|
|
*/
|
|
public function searchUserByAccount(){
|
|
$data = $this->request->post();
|
|
$users = $this->user_obj->where('state',0)->where('account','like','%'.$data['account'].'%')->select();
|
|
$re['users'] = $users;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* @title 编委导入--通过邮箱搜索用户
|
|
* @description 编委导入--通过邮箱搜索用户
|
|
* @author wangjinlei
|
|
* @url /api/Board/searchUserByEmail
|
|
* @method POST
|
|
*
|
|
* @param name:email type:string require:1 desc:邮箱
|
|
*
|
|
* @return user:用户信息#
|
|
*/
|
|
public function searchUserByEmail(){
|
|
$data = $this->request->post();
|
|
$user = $this->user_obj->where('state',0)->where('email',$data['email'])->find();
|
|
if($user == null){
|
|
return jsonError('can not find user!!');
|
|
}
|
|
$re['user'] = $user;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
}
|