981 lines
34 KiB
PHP
981 lines
34 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\api\controller\Base;
|
|
use think\Db;
|
|
use think\Queue;
|
|
use think\Validate;
|
|
|
|
/**
|
|
* @title 编委相关接口
|
|
* @description 编委相关接口
|
|
*/
|
|
class Board extends Base {
|
|
|
|
protected $staff_obj = '';
|
|
protected $staff_level_obj = '';
|
|
protected $staff_log_obj = '';
|
|
protected $staff_to_journal_obj = '';
|
|
protected $chief_msg_obj = '';
|
|
protected $article_to_board_obj = '';
|
|
|
|
public function __construct(\think\Request $request = null) {
|
|
parent::__construct($request);
|
|
$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_msg_obj = Db::name('chief_msg');
|
|
$this->article_to_board_obj = Db::name('article_to_board');
|
|
}
|
|
|
|
/**
|
|
* @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
|
|
->field('t_article.*,t_journal.title journal_title')
|
|
->join('t_journal','t_journal.journal_id = t_article.journal_id','left')
|
|
->where('t_article.journal_id', $data['journal_id'])
|
|
->where('t_article.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']);
|
|
}
|
|
}
|
|
|
|
//加上文章领域
|
|
foreach($list as $k => $v){
|
|
$major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
|
|
$cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
|
|
$list[$k]['major'] = $major['title'];
|
|
$list[$k]['cmajor'] = $cmajor['title'];
|
|
}
|
|
|
|
$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();
|
|
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
|
$list = $this->article_obj->field('t_article.*,t_journal.title journal_title')
|
|
->join('t_journal','t_journal.journal_id = t_article.journal_id','left')
|
|
->where('t_article.journal_id',$data['journal_id'])
|
|
->where('t_article.state',5)
|
|
->limit($limit_start,$data['pageSize'])
|
|
->select();
|
|
|
|
$count = $this->article_obj
|
|
->join('t_journal','t_journal.journal_id = t_article.journal_id','left')
|
|
->where('t_article.journal_id',$data['journal_id'])
|
|
->where('t_article.state',5)
|
|
->count();
|
|
|
|
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;
|
|
$re['count'] = $count;
|
|
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/getYboardJournals
|
|
* @method POST
|
|
*
|
|
* @param name:user_id type:int require:1 desc:编委用户id
|
|
*
|
|
* @return journals:期刊列表#
|
|
*/
|
|
public function getYboardJournals(){
|
|
$data = $this->request->post();
|
|
$journals = $this->reviewer_to_journal_obj
|
|
->join('t_journal','t_journal.journal_id = t_reviewer_to_journal.journal_id','left')
|
|
->where('t_reviewer_to_journal.reviewer_id',$data['user_id'])
|
|
->where('t_reviewer_to_journal.is_yboard',1)
|
|
->where('t_reviewer_to_journal.state',0)
|
|
->select();
|
|
$re['journals'] = $journals;
|
|
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);
|
|
}
|
|
|
|
|
|
|
|
|
|
public function mymmm(){
|
|
$data = $this->request->post();
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardListForSubmit';
|
|
$pra = [];
|
|
$pra['issn'] = $journal_info['issn'];
|
|
$pra['board_group_id'] = -1;
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$boards = $res['data']['boards'];
|
|
$bs = $this->board_to_journal_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
|
// $re['num'] = count($boards).'-----------'.count($bs);
|
|
// $re['y'] = $boards;
|
|
// $re['x'] = $bs;
|
|
// $frag = [];
|
|
// foreach($bs as $v){
|
|
// if(!$this->myarr($v,$boards)){
|
|
// $frag[] = $v;
|
|
// }
|
|
// }
|
|
|
|
// foreach($frag as $v ){
|
|
// $this->board_to_journal_obj->where('btj_id',$v['btj_id'])->update(['state'=>1]);
|
|
// }
|
|
|
|
|
|
|
|
|
|
$frag1 = [];
|
|
foreach($boards as $v){
|
|
if(!$this->myarr1($v,$bs)){
|
|
$frag1[] = $v;
|
|
}
|
|
}
|
|
|
|
|
|
// foreach($frag1 as $k=>$v){
|
|
// $c = $this->user_obj->where('email',$v['email'])->find();
|
|
// $frag1[$k]['ch'] = $c;
|
|
// if($c){
|
|
// $insert['user_id']=$c['user_id'];
|
|
|
|
// }
|
|
// }
|
|
|
|
|
|
// $re['del'] = $frag;
|
|
$re['add'] = $frag1;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
private function myarr($v,$boards){
|
|
foreach($boards as $val){
|
|
if($v['user_id']==$val['tuser_id']){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private function myarr1($v,$bs){
|
|
foreach($bs as $val){
|
|
if($v['tuser_id']==$val['user_id']){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
public function getBoards(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"journal_id"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$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,t_user_reviewer_info.country")
|
|
->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")
|
|
->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 = [];
|
|
$china_num = 0;
|
|
$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'];
|
|
}
|
|
if($val['country']=="China"){
|
|
$china_num++;
|
|
}
|
|
|
|
}
|
|
$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);
|
|
$re['boards_count'] = count($boards);
|
|
$re['china_count'] = $china_num;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取编委列表
|
|
*/
|
|
public function getBoards1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_id'=>'require',
|
|
'board_group_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardListForSubmit';
|
|
$pra = [];
|
|
$pra['issn'] = $journal_info['issn'];
|
|
$pra['board_group_id'] = $data['board_group_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$boards = $res['data']['boards'];
|
|
$frag = [];
|
|
foreach($boards as $k => $v){
|
|
$cache_user = $this->user_obj->where('user_id',$v['tuser_id'])->find();
|
|
// $h_index = $this->user_index_obj->where('user_id',$cache_user['user_id'])->where('year',date('Y'))->find();
|
|
// $h_index_num = 0;
|
|
// $gh_index_num = 0;
|
|
// if($h_index){
|
|
// $h_index_num = $h_index['h_index'];
|
|
// $h_index_num = $h_index['gh_index'];
|
|
// }
|
|
// $boards[$k]['phone'] = $cache_user['phone'];
|
|
$boards[$k]['wos_index'] = $cache_user['wos_index'];
|
|
$boards[$k]['wos_time'] = $cache_user['wos_time'];
|
|
$boards[$k]['google_index'] = $cache_user['google_index'];
|
|
$boards[$k]['google_time'] = $cache_user['google_time'];
|
|
$boards[$k]['score'] = $cache_user['score'];
|
|
}
|
|
|
|
foreach ($boards as $v) {
|
|
if ($v['type'] == 0) {
|
|
$frag['main'][] = $v;
|
|
} elseif ($v['type'] == 1) {
|
|
$frag['remain'][] = $v;
|
|
} else {
|
|
if ($v['board_group_id'] == 0) {
|
|
$frag['member']['none'][] = $v;
|
|
} else {
|
|
$frag['member'][$v['group_name']][] = $v;
|
|
}
|
|
}
|
|
}
|
|
$re['boards'] = $frag;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取编委信息详情
|
|
*/
|
|
public function getBoardMsgDetail(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'board_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardDetail';
|
|
$pra = [];
|
|
$pra['board_id'] = $data['board_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$board = $res['data']['board'];
|
|
$user_info = $this->user_obj->where('user_id',$board['tuser_id'])->find();
|
|
// $index_info = $this->user_index_obj->where('user_id',$user_info['user_id'])->where('year',date('Y'))->find();
|
|
// if($index_info){
|
|
// $board['h_index'] = $index_info['h_index'];
|
|
// }else{
|
|
// $board['h_index'] = 0;
|
|
// }
|
|
$re['board'] = $board;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
public function delBoard(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"btj_id"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update(['state'=>1]);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**编辑编委备注
|
|
* @return void
|
|
*/
|
|
public function editBoardRemark(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"btj_id"=>"require",
|
|
"remark"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update(['remark'=>trim($data['remark'])]);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 删除编委
|
|
*/
|
|
public function delBoard1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'board_id' => 'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/delBoard';
|
|
$pra = [];
|
|
$pra['board_id'] = $data['board_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$board = $res['data']['board'];
|
|
$journal_info = $this->journal_obj->where('issn',$board['issn'])->find();
|
|
$this->board_to_journal_obj->where('user_id',$board['tuser_id'])->where('journal_id',$journal_info['journal_id'])->update(['state'=>1]);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
public function getBoardGroupList(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"journal_id"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$groups = $this->board_group_obj->where('journal_id',$data['journal_id'])->where("state",0)->select();
|
|
$re['groups'] = $groups;
|
|
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 获取编委分组列表(原版)
|
|
*/
|
|
public function getBoardGroupList1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/getBoardGroups';
|
|
$pra = [];
|
|
$pra['issn'] = $journal_info['issn'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
$groups = $res['data']['groups'];
|
|
$re['groups'] = $groups;
|
|
return jsonSuccess($re);
|
|
}
|
|
|
|
/**
|
|
* 添加编委分组
|
|
*/
|
|
public function addBoardGroup1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_id'=>'require|number',
|
|
'group_name'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/addBoardGroup';
|
|
$pra = [];
|
|
$pra['issn'] = $journal_info['issn'];
|
|
$pra['group_name'] = trim($data['group_name']);
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
public function addBoardGroup(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'journal_id'=>'require|number',
|
|
'group_name'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$insert['journal_id'] = $data['journal_id'];
|
|
$insert['group_name'] = trim($data['group_name']);
|
|
$this->board_group_obj->insert($insert);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 删除编委分组
|
|
*/
|
|
public function delBoardGroup1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'board_group_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/delBoardGroup';
|
|
$pra = [];
|
|
$pra['board_group_id'] = $data['board_group_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
if($res['code']==0){
|
|
return jsonSuccess([]);
|
|
}else{
|
|
return jsonError($res['msg']);
|
|
}
|
|
}
|
|
|
|
public function delBoardGroup(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'board_group_id'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$check = $this->board_to_journal_obj->where('board_group_id',$data['board_group_id'])->where('state',0)->find();
|
|
if($check){
|
|
return jsonError("Please note that there are editorial committee members in the group, and you cannot delete this group.");
|
|
}
|
|
$this->board_group_obj->where('board_group_id',$data['board_group_id'])->update(['state'=>1]);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
public function addBoard(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"user_id"=>"require",
|
|
"journal_id"=>"require",
|
|
"type"=>"require",
|
|
"board_group_id"=>"require",
|
|
"research_areas"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('state',0)->find();
|
|
if($check){
|
|
return jsonError("According to TMR Publishing Group Policy, scientists are not allowed to serve on the editorial board of more than one journal at the same time.");
|
|
}
|
|
|
|
//添加对应关系
|
|
$insert['user_id'] = $data['user_id'];
|
|
$insert['journal_id'] = $data['journal_id'];
|
|
$insert['type'] = $data['type'];
|
|
$insert['board_group_id'] = $data['board_group_id'];
|
|
$insert['research_areas'] = trim($data['research_areas']);
|
|
$this->board_to_journal_obj->insert($insert);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 添加编委
|
|
*/
|
|
public function addBoard1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'user_id'=>'require',
|
|
'journal_id'=>'require',
|
|
'name'=>'require',
|
|
'board_group_id'=>'require',
|
|
'website'=>'require',
|
|
'type'=>'require',
|
|
'dr'=>'require',
|
|
'title'=>'require',
|
|
'field'=>'require',
|
|
'address'=>'require',
|
|
'country'=>'require',
|
|
'board_icon'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$user_info = $this->user_obj->where('user_id',$data['user_id'])->find();
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
$check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('state',0)->find();
|
|
if($check){
|
|
return jsonError("According to TMR Publishing Group Policy, scientists are not allowed to serve on the editorial board of more than one journal at the same time.");
|
|
}
|
|
|
|
// $url = 'http://www.journal.com/master/Board/addBoard';
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/addBoard';
|
|
$pra = [];
|
|
$pra['user_id'] = $data['user_id'];
|
|
$pra['journal_issn'] = $journal_info['issn'];
|
|
$pra['type'] = $data['type'];
|
|
$pra['name'] = $data['name'];
|
|
$pra['website'] = $data['website'];
|
|
$pra['dr'] = $data['dr'];
|
|
$pra['email'] = $user_info['email'];
|
|
$pra['title'] = $data['title'];
|
|
$pra['field'] = $data['field'];
|
|
$pra['address'] = $data['address'];
|
|
$pra['country'] = $data['country'];
|
|
$pra['board_icon'] = $data['board_icon'];
|
|
$pra['board_group_id'] = $data['board_group_id'];
|
|
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
if($res['code']==1){
|
|
return jsonError($res['msg']);
|
|
}
|
|
|
|
//添加对应关系
|
|
$insert['user_id'] = $data['user_id'];
|
|
$insert['journal_id'] = $data['journal_id'];
|
|
$this->board_to_journal_obj->insert($insert);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
public function editBoard(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"btj_id"=>"require",
|
|
"type"=>'require',
|
|
"board_group_id"=>"require",
|
|
"research_areas"=>"require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$update['type'] = $data['type'];
|
|
$update['board_group_id'] = $data['type']==2?$data['board_group_id']:0;
|
|
$update['research_areas'] = trim($data['research_areas']);
|
|
$this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update($update);
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 编辑编委信息
|
|
*/
|
|
public function editBoard1(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'board_id'=>'require',
|
|
'name'=>'require',
|
|
'board_group_id'=>'require',
|
|
'website'=>'require',
|
|
'type'=>'require',
|
|
'dr'=>'require',
|
|
'title'=>'require',
|
|
'field'=>'require',
|
|
'address'=>'require',
|
|
'country'=>'require',
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/editBoard';
|
|
$pra = [];
|
|
$pra['board_id'] = $data['board_id'];
|
|
$pra['type'] = $data['type'];
|
|
$pra['name'] = $data['name'];
|
|
$pra['website'] = $data['website'];
|
|
$pra['dr'] = $data['dr'];
|
|
$pra['title'] = $data['title'];
|
|
$pra['field'] = $data['field'];
|
|
$pra['address'] = $data['address'];
|
|
$pra['country'] = $data['country'];
|
|
$pra['board_group_id'] = $data['board_group_id'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* 编辑编委头像信息
|
|
*/
|
|
public function editIcon(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
'board_id'=>'require',
|
|
'board_icon'=>'require'
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Board/editBoardIcon';
|
|
$pra = [];
|
|
$pra['board_id'] = $data['board_id'];
|
|
$pra['board_icon'] = $data['board_icon'];
|
|
$res = object_to_array(json_decode(myPost($url, $pra)));
|
|
|
|
return jsonSuccess([]);
|
|
}
|
|
|
|
/**
|
|
* @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);
|
|
$check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('journal_id',$data['journal_id'])->where('state',0)->find();
|
|
if(!$check){
|
|
$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);
|
|
}
|
|
|
|
/**
|
|
* 编辑/添加H指数
|
|
*/
|
|
// public function editIndex(){
|
|
// $data = $this->request->post();
|
|
// $rule = new Validate([
|
|
// 'user_id'=>'require',
|
|
// 'year'=>'require',
|
|
// 'index'=>'require'
|
|
// ]);
|
|
// if(!$rule->check($data)){
|
|
// return jsonError($rule->getError());
|
|
// }
|
|
// $check = $this->user_index_obj->where('user_id',$data['user_id'])->where('year',$data['year'])->where('state',0)->find();
|
|
// if($check){
|
|
// $this->user_index_obj->where('in_id',$check['in_id'])->update(['h_index'=>$data['index']]);
|
|
// }else{
|
|
// $insert['user_id'] = $data['user_id'];
|
|
// $insert['year'] = $data['year'];
|
|
// $insert['h_index'] = $data['index'];
|
|
// $this->user_index_obj->insert($insert);
|
|
// }
|
|
// return jsonSuccess([]);
|
|
// }
|
|
|
|
|
|
|
|
/**
|
|
* @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);
|
|
}
|
|
|
|
public function up_boardIcon_file(){
|
|
$file = request()->file('boardIcon');
|
|
if ($file) {
|
|
$info = $file->move(ROOT_PATH . 'public' . DS . 'boardIcon');
|
|
if ($info) {
|
|
return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
|
} else {
|
|
return json(['code' => 1, 'msg' => $file->getError()]);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 新增编辑编委信息-新
|
|
*/
|
|
public function addBoardNew(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"user_id"=>"require",
|
|
"journal_id"=>"require",
|
|
"type"=>"require",
|
|
"board_group_id"=>"require",
|
|
"research_areas"=>"require",
|
|
"realname"=>"require",
|
|
"email"=>"require",
|
|
"website"=>"require",
|
|
"affiliation"=>"require",
|
|
"technical"=>"require",
|
|
'icon' => "require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
$check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('state',0)->find();
|
|
if($check){
|
|
return jsonError("According to TMR Publishing Group Policy, scientists are not allowed to serve on the editorial board of more than one journal at the same time.");
|
|
}
|
|
|
|
//新增必填字段 chengxiaoling 20251020 start
|
|
//必填验证
|
|
$sField = '';
|
|
$aFields = ['research_areas','realname','email','website','affiliation','technical','icon'];
|
|
foreach ($aFields as $value) {
|
|
$sInfo = empty($data[$value]) ? '' : trim($data[$value]);
|
|
if(empty($sInfo)){
|
|
$sField = $value;
|
|
break;
|
|
}
|
|
}
|
|
if(!empty($sField)){
|
|
return jsonError($sField.' cannot be empty');
|
|
}
|
|
//新增必填字段 chengxiaoling 20251020 end
|
|
|
|
//添加对应关系
|
|
$insert['user_id'] = $data['user_id'];
|
|
$insert['journal_id'] = $data['journal_id'];
|
|
$insert['type'] = $data['type'];
|
|
$insert['board_group_id'] = $data['board_group_id'];
|
|
$insert['research_areas'] = trim($data['research_areas']);
|
|
//新增必填字段 chengxiaoling 20251020 start
|
|
$insert['realname'] = trim($data['realname']);
|
|
$insert['email'] = trim($data['email']);
|
|
$insert['website'] = trim($data['website']);
|
|
$insert['affiliation'] = trim($data['affiliation']);
|
|
$insert['technical'] = trim($data['technical']);
|
|
$insert['icon'] = trim($data['icon']);
|
|
//新增必填字段 chengxiaoling 20251020 end
|
|
$this->board_to_journal_obj->insert($insert);
|
|
return jsonSuccess([]);
|
|
}
|
|
/**
|
|
* 修改编辑编委信息-新
|
|
*/
|
|
public function editBoardNew(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"btj_id"=>"require",
|
|
"type"=>'require',
|
|
"board_group_id"=>"require",
|
|
"research_areas"=>"require",
|
|
"realname"=>"require",
|
|
"email"=>"require",
|
|
"website"=>"require",
|
|
"affiliation"=>"require",
|
|
"technical"=>"require",
|
|
'icon' => "require"
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
//新增必填字段 chengxiaoling 20251020 start
|
|
//必填验证
|
|
$sField = '';
|
|
$aFields = ['research_areas','realname','email','website','affiliation','technical','icon'];
|
|
foreach ($aFields as $value) {
|
|
$sInfo = empty($data[$value]) ? '' : trim($data[$value]);
|
|
if(empty($sInfo)){
|
|
$sField = $value;
|
|
break;
|
|
}
|
|
}
|
|
if(!empty($sField)){
|
|
return jsonError($sField.' cannot be empty');
|
|
}
|
|
//新增必填字段 chengxiaoling 20251020 end
|
|
$update['type'] = $data['type'];
|
|
$update['board_group_id'] = $data['type']==2?$data['board_group_id']:0;
|
|
$update['research_areas'] = trim($data['research_areas']);
|
|
//新增必填字段 chengxiaoling 20251020 start
|
|
$update['realname'] = trim($data['realname']);
|
|
$update['email'] = trim($data['email']);
|
|
$update['website'] = trim($data['website']);
|
|
$update['affiliation'] = trim($data['affiliation']);
|
|
$update['technical'] = trim($data['technical']);
|
|
$update['icon'] = trim($data['icon']);
|
|
//新增必填字段 chengxiaoling 20251020 end
|
|
$this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update($update);
|
|
return jsonSuccess([]);
|
|
}
|
|
/**
|
|
* 编委上传头像
|
|
*/
|
|
public function uploadIcon()
|
|
{
|
|
$file = request()->file('icon');
|
|
if ($file) {
|
|
$info = $file->move(ROOT_PATH . 'public' . DS . 'boardusericon');
|
|
if ($info) {
|
|
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
|
} else {
|
|
return json(['code' => 1, 'msg' => $file->getError()]);
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* 获取编委信息-新
|
|
*/
|
|
public function getBoardInfo(){
|
|
$data = $this->request->post();
|
|
$rule = new Validate([
|
|
"btj_id"=>"require",
|
|
]);
|
|
if(!$rule->check($data)){
|
|
return jsonError($rule->getError());
|
|
}
|
|
//查询数据
|
|
$aWhere = ['btj_id' => $data['btj_id'],'state' => 0];
|
|
$board_to_journal = $this->board_to_journal_obj->where($aWhere)->find();
|
|
return jsonSuccess($board_to_journal);
|
|
}
|
|
}
|