This commit is contained in:
wangjinlei
2023-09-12 09:12:34 +08:00
parent b2581b5bbe
commit fc64abb1d6
5 changed files with 215 additions and 7 deletions

View File

@@ -71,6 +71,8 @@ class Base extends Controller
protected $promotion_email_obj = '';
protected $article_reviewer_repeat_obj = '';
protected $board_group_obj = "";
protected $committee_to_journal_obj = '';
protected $editor_to_journal_obj = '';
public function __construct(\think\Request $request = null)
@@ -139,6 +141,8 @@ class Base extends Controller
$this->promotion_email_obj = Db::name("promotion_email");
$this->article_reviewer_repeat_obj = Db::name("article_reviewer_repeat");
$this->board_group_obj = Db::name("board_group");
$this->committee_to_journal_obj = Db::name("committee_to_journal");
$this->editor_to_journal_obj = Db::name("editor_to_journal");
}
@@ -362,10 +366,10 @@ class Base extends Controller
return jsonSuccess([]);
}
public function getBoardsForJournal($journal_id){
public function getBoardsForJournal($journal_id,$aar=false){
$ca_board = [];
$boards = $this->board_to_journal_obj
->field("t_board_to_journal.*,t_board_group.group_name,t_user.account,t_user.email,t_user.realname,t_user.icon,t_user.google_index,t_user.google_time,t_user_reviewer_info.*")
->field("t_board_to_journal.*,t_board_group.group_name,t_user.account,t_user.email,t_user.realname,t_user.icon,t_user.google_index,t_user.google_time,t_user.wos_index,t_user.wos_time,t_user_reviewer_info.*")
->join("t_board_group","t_board_group.board_group_id = t_board_to_journal.board_group_id","left")
->join("t_user","t_user.user_id = t_board_to_journal.user_id","left")
->join("t_user_reviewer_info","t_user_reviewer_info.reviewer_id=t_board_to_journal.user_id","left")
@@ -373,6 +377,20 @@ class Base extends Controller
->where('t_board_to_journal.state',0)
->select();
foreach ($boards as $val){
if($aar){
$article1 = $this->article_obj->where('user_id',$val['user_id'])->where('journal_id',$val['journal_id'])->where('state',5)->where('ctime',">",strtotime("-1 year"))->select();
$article11 = $this->article_obj->where('user_id',$val['user_id'])->where('journal_id',$val['journal_id'])->where('ctime',">",strtotime("-1 year"))->select();
$ids = $this->article_author_obj->where('email',$val['email'])->column("article_id");
$article2 = $this->article_obj->where('state',5)->where('journal_id',$val['journal_id'])->where('article_id',"in",$ids)->select();
$article22 = $this->article_obj->where('journal_id',$val['journal_id'])->where('article_id',"in",$ids)->select();
$articles = array_merge($article1,$article2);
$articles_all = array_merge($article11,$article22);
$reviewes = $this->article_reviewer_obj->join("t_article","t_article.article_id = t_article_reviewer.article_id","left")->where('t_article_reviewer.reviewer_id',$val['user_id'])->where('t_article.journal_id',$journal_id)->where('t_article_reviewer.ctime',">",strtotime("-1 year"))->where('t_article_reviewer.state',"in",[1,2,3])->select();
$val['articles'] = $articles;
$val['articles_all'] = $articles_all;
$val['reviewes'] = $reviewes;
}
if($val['type']==0){//主编
$ca_board['main'][] = $val;
}elseif ($val['type']==1){//副主编

View File

@@ -267,7 +267,30 @@ class Board extends Base {
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$re['boards'] = $this->getBoardsForJournal($data['journal_id']);
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$boards = $this->board_to_journal_obj->field("t_board_to_journal.*,t_user.google_index,t_user.google_time,t_user.wos_index,t_user.wos_time")
->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();
$ca_board = $this->getBoardsForJournal($data['journal_id']);
$journal_info["boards"] = $ca_board;
$journal_info['boards_count'] = count($boards);
$board_index = [];
$sum = 0;
foreach ($boards as $val){
if($val['wos_index']>0){
$board_index[] = $val['wos_index']*1.5;
$sum += $val['wos_index']*1.5;
}elseif($val['google_index']>0){
$board_index[] = $val['google_index'];
$sum += $val['google_index'];
}
}
$journal_info['index_num'] = count($board_index);
$journal_info['median'] = count($board_index)==0?0:zw_array($board_index);
$journal_info['avg'] = count($board_index)==0?0:round($sum/count($board_index),2);
$re['journal'] = $journal_info;
$re['boards'] = $this->getBoardsForJournal($data['journal_id'],true);
return jsonSuccess($re);
}

View File

@@ -20,19 +20,24 @@ class Monitor extends Base
public function getJournalBoards(){
$journals = $this->journal_obj->where('state',0)->select();
foreach ($journals as $k => $v){
$boards = $this->board_to_journal_obj->field("t_board_to_journal.*,t_user.google_index,t_user.google_time")->join("t_user","t_user.user_id = t_board_to_journal.user_id","left")->where("t_board_to_journal.journal_id",$v['journal_id'])->where('t_board_to_journal.state',0)->select();
$boards = $this->board_to_journal_obj->field("t_board_to_journal.*,t_user.google_index,t_user.google_time,t_user.wos_index,t_user.wos_time")->join("t_user","t_user.user_id = t_board_to_journal.user_id","left")->where("t_board_to_journal.journal_id",$v['journal_id'])->where('t_board_to_journal.state',0)->select();
$ca_board = $this->getBoardsForJournal($v['journal_id']);
$journals[$k]["boards"] = $ca_board;
$journals[$k]['boards_count'] = count($boards);
$board_index = [];
$sum = 0;
foreach ($boards as $key => $val){
if($val['google_index']>0){
if($val['wos_index']>0){
$board_index[] = $val['wos_index']*1.5;
$sum += $val['wos_index']*1.5;
}elseif($val['google_index']>0){
$board_index[] = $val['google_index'];
$sum += $val['google_index'];
}
}
$journals[$k]['index_num'] = count($board_index);
$journals[$k]['median'] = count($board_index)==0?0:zw_array($board_index);
$journals[$k]['avg'] = count($board_index)==0?0:array_sum($board_index)/count($board_index);
$journals[$k]['avg'] = count($board_index)==0?0:round($sum/count($board_index),2);
}
$re['journals'] = $journals;
@@ -50,7 +55,7 @@ class Monitor extends Base
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$ca_board = $this->getBoardsForJournal($data['journal_id']);
$ca_board = $this->getBoardsForJournal($data['journal_id'],true);
$re['boards'] = $ca_board;
return jsonSuccess($re);

View File

@@ -1591,6 +1591,151 @@ class User extends Base
return jsonSuccess($re);
}
/**获取期刊委员会人员列表
* @return void
*/
public function getCommittee(){
$data = $this->request->post();
$rule = new Validate([
"journal_id"=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$committees = $this->committee_to_journal_obj->join("t_user","t_user.user_id = t_committee_to_journal.user_id","left")->where('t_committee_to_journal.journal_id',$data['journal_id'])->where('t_committee_to_journal.state',0)->select();
$re['committees'] = $committees;
return jsonSuccess($re);
}
/**
* @return \think\response\Json
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function delCommittee(){
$data = $this->request->post();
$rule = new Validate([
"ctj_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->committee_to_journal_obj->where('ctj_id',$data['ctj_id'])->update(["state"=>1]);
return jsonSuccess([]);
}
/**编辑期刊编委会信息
* @return void
*/
public function editCommittee(){
$data = $this->request->post();
$rule = new Validate([
"ctj_id"=>"require",
"research_areas"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$update['research_areas'] = trim($data['research_areas']);
$this->committee_to_journal_obj->where('ctj_id',$data['ctj_id'])->update($update);
return jsonSuccess([]);
}
/**添加期刊委员会人员
* @return \think\response\Json
*/
public function addCommittee(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require",
"journal_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
if(isset($data['research_areas'])&&$data['research_areas']!=''){
$insert['research_areas'] = trim($data['research_areas']);
}
$insert['ctime'] = time();
$this->committee_to_journal_obj->insert($insert);
return jsonSuccess([]);
}
/**添加期刊编辑对应信息
* @return void
*/
public function addEditorToJournal(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require",
"journal_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
if(isset($data['editor_title'])&&$data['editor_title']!=''){
$insert['editor_title'] = trim($data['editor_title']);
}
$insert['ctime'] = time();
$this->editor_to_journal_obj->insert($insert);
return jsonSuccess([]);
}
/**编辑期刊编辑对应信息
* @return \think\response\Json
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function editEditorToJournal(){
$data = $this->request->post();
$rule = new Validate([
"etj_id"=>"require",
"editor_title"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->editor_to_journal_obj->where('etj_id',$data['etj_id'])->update(['editor_title'=>$data['editor_title']]);
return jsonSuccess([]);
}
/**删除期刊编辑对应信息
* @return void
*/
public function delEditorToJournal(){
$data = $this->request->post();
$rule = new Validate([
"etj_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->editor_to_journal_obj->where('etj_id',$data['etj_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**获取期刊编辑对应信息列表
* @return void
*/
public function getEditorToJournals(){
$data = $this->request->post();
$rule = new Validate([
"journal_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$es = $this->editor_to_journal_obj->join("t_user","t_user.user_id = t_editor_to_journal.user_id","left")->where("t_editor_to_journal.journal_id",$data['journal_id'])->where('t_editor_to_journal.state',0)->select();
$re['editors'] = $es;
return jsonSuccess($re);
}
private function getUserRoles($account)
{
$user_info = $this->user_obj->where('account', $account)->find();

View File

@@ -54,6 +54,23 @@ class Web extends Base
return jsonSuccess($re);
}
/**
* @return void
*/
public function getBoardsByIssn(){
$data = $this->request->post();
$rule = new Validate([
"issn"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
$boards = $this->getBoardsForJournal($journal_info['journal_id']);
$re['boards'] = $boards;
return jsonSuccess($re);
}
public function getRefers(){
$data = $this->request->post();
$rule = new Validate([