This commit is contained in:
wangjinlei
2022-04-15 15:23:57 +08:00
parent 76779b3672
commit 91600d2ed3
3 changed files with 74 additions and 5 deletions

View File

@@ -102,17 +102,17 @@ class Journal extends Controller {
public function getJournalsForReviewerInEditor(){
$data = $this->request->post();
$rule = new Validate([
'account' => 'require',
'editor_id' => 'require',
'reviewer_id' => 'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$editor_info = $this->user_obj->where('account',$data['account'])->find();
$editor_info = $this->user_obj->where('user_id',$data['editor_id'])->find();
$journalIds = [];
if($editor_info['type']==2){//责任编辑
$journalIds = $this->journal_obj->where('eidtor_id',$editor_info['user_id'])->column('journal_id');
$journalIds = $this->journal_obj->where('editor_id',$editor_info['user_id'])->column('journal_id');
}else{//客座编辑
$guests = $this->user_to_special_obj->where('user_id',$data['reviewer_id'])->where('uts_state',0)->select();
$usercontroller = new usercontroller();
@@ -121,7 +121,7 @@ class Journal extends Controller {
$journalIds[] = $this->journal_obj->where('issn',$c_res['journal_issn'])->value('journal_id');
}
}
$njournalIds = $this->reviewer_to_journal_obj->where('reviewer_id',$data['user_id'])->where('state',0)->column('journal_id');
$njournalIds = $this->reviewer_to_journal_obj->where('reviewer_id',$data['reviewer_id'])->where('state',0)->column('journal_id');
$list = $this->journal_obj->where('journal_id',"not in",$njournalIds)->where('journal_id',"in",$journalIds)->where('state',0)->select();
$re['journals'] = $list;

View File

@@ -26,6 +26,7 @@ class Special extends Controller {
protected $article_file_obj = '';
protected $user_log_obj = '';
protected $user_black_obj = '';
protected $user_to_special_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -45,6 +46,7 @@ class Special extends Controller {
$this->article_file_obj = Db::name('article_file');
$this->user_log_obj = Db::name('user_log');
$this->user_black_obj = Db::name('user_black');
$this->user_to_special_obj = Db::name('user_to_special');
}
/**
@@ -164,7 +166,51 @@ class Special extends Controller {
return jsonSuccess($re);
}
/**
* 获取客座审稿人文章列表
*/
public function getSpecialArticles(){
$data = $this->request->post();
$rule = new Validate([
'user_id' => 'require',
'pageIndex' => 'require',
'pageSize' =>'require',
'special_id' => 'require',
'state'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
//构造查询条件
$specialIds = $this->user_to_special_obj->where('user_id',$data['user_id'])->where('uts_state',0)->column('special_id');
$where['t_article.special_num'] = ['in',$specialIds];
if($data['special_id']!=0){
$where['special_num'] = $data['special_id'];
}
if($data['state']>-1){
$where['t_article.state'] = $data['state'];
}
if(isset($data['titleKey'])&&$data['titleKey']!=''){
$where['t_article.title'] = ['like','%'.trim($data['titleKey']).'%'];
}
if(isset($data['sn'])&&$data['sn']!=''){
$where['t_article.accept_sn']=$data['sn'];
}
//分页查询数据
$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();
$re['articles'] = $res;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* 添加专刊文章(作者)

View File

@@ -364,6 +364,29 @@ class User extends Controller
return jsonSuccess($re);
}
/**
* 获取用户所有客座专刊
*/
public function getUserAllSpecials(){
$data = $this->request->post();
$rule = new Validate([
'user_id' => 'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->user_to_special_obj->where('user_id',$data['user_id'])->where('uts_state',0)->select();
$specials = [];
foreach($list as $k => $v){
$cache_info = $this->getSpecialDetailById($v['special_id']);
$cache_journal = $this->journal_obj->where('issn',$cache_info['journal_issn'])->find();
$cache_info['journal_id'] = $cache_journal['journal_id'];
$specials[] = $cache_info;
}
$re['specials'] = $specials;
return jsonSuccess($re);
}
public function getSpecialDetailById($special_id){
$base_url = Env::get('journal.base_url');