Files
tougao/application/api/controller/Board.php
wangjinlei 5c5143166c 20201112
2021-08-24 14:58:13 +08:00

145 lines
5.2 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);
}
$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);
}
$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);
}
}