From 91600d2ed3b97e6fa2273779d59639241a5b3623 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Fri, 15 Apr 2022 15:23:57 +0800 Subject: [PATCH] 1 --- application/api/controller/Journal.php | 8 ++--- application/api/controller/Special.php | 48 +++++++++++++++++++++++++- application/api/controller/User.php | 23 ++++++++++++ 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/application/api/controller/Journal.php b/application/api/controller/Journal.php index db257e9..f013e12 100644 --- a/application/api/controller/Journal.php +++ b/application/api/controller/Journal.php @@ -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; diff --git a/application/api/controller/Special.php b/application/api/controller/Special.php index 37e946e..1960693 100644 --- a/application/api/controller/Special.php +++ b/application/api/controller/Special.php @@ -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); + } /** * 添加专刊文章(作者) diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 5ddbf1f..735c958 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -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');