From 45532ef702372ad6c3e2de84c6f79802df831746 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Fri, 4 Nov 2022 13:30:16 +0800 Subject: [PATCH] 1 --- application/api/controller/Board.php | 68 +++++++++--------- application/api/controller/Chief.php | 16 ++--- application/api/controller/Major.php | 12 ++-- application/api/controller/Production.php | 5 +- application/api/controller/Publish.php | 20 ++++++ application/api/controller/Typeset.php | 6 +- application/api/controller/User.php | 87 +++++++++-------------- 7 files changed, 102 insertions(+), 112 deletions(-) diff --git a/application/api/controller/Board.php b/application/api/controller/Board.php index d0bb427..157938f 100644 --- a/application/api/controller/Board.php +++ b/application/api/controller/Board.php @@ -34,8 +34,6 @@ class Board extends Controller { protected $chief_msg_obj = ''; protected $article_to_board_obj = ''; protected $login_auto_obj = ''; - protected $user_index_obj = ''; - protected $user_email_index_obj = ''; public function __construct(\think\Request $request = null) { parent::__construct($request); @@ -61,8 +59,6 @@ class Board extends Controller { $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'); - $this->user_index_obj = Db::name('user_index'); - $this->user_email_index_obj = Db::name('user_email_index'); } /** @@ -245,16 +241,18 @@ class Board extends Controller { $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]['hindex'] = $h_index_num; - $boards[$k]['ghindex'] = $gh_index_num; + // $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']; } foreach ($boards as $v) { @@ -553,27 +551,27 @@ class Board extends Controller { /** * 编辑/添加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([]); - } + // 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([]); + // } diff --git a/application/api/controller/Chief.php b/application/api/controller/Chief.php index d5de48f..c4540b8 100644 --- a/application/api/controller/Chief.php +++ b/application/api/controller/Chief.php @@ -34,8 +34,6 @@ class Chief extends Controller { protected $chief_msg_obj = ''; protected $article_to_board_obj = ''; protected $login_auto_obj = ''; - protected $user_index_obj = ''; - protected $user_email_index_obj = ''; public function __construct(\think\Request $request = null) { parent::__construct($request); @@ -61,8 +59,6 @@ class Chief extends Controller { $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'); - $this->user_index_obj = Db::name('user_index'); - $this->user_email_index_obj = Db::name('user_email_index'); } /** @@ -862,12 +858,12 @@ class Chief extends Controller { ->where('t_board_to_journal.state',0) ->select(); - foreach($boards as $k => $v){ - $boards[$k]['indexs'] = $this->user_index_obj - ->where('user_id',$v['user_id']) - ->where('state',0) - ->order('year')->select(); - } + // foreach($boards as $k => $v){ + // $boards[$k]['indexs'] = $this->user_index_obj + // ->where('user_id',$v['user_id']) + // ->where('state',0) + // ->order('year')->select(); + // } $re['boards']=$boards; return jsonSuccess($re); diff --git a/application/api/controller/Major.php b/application/api/controller/Major.php index 6a44967..51533ce 100644 --- a/application/api/controller/Major.php +++ b/application/api/controller/Major.php @@ -136,12 +136,12 @@ class Major extends Controller { //判断是否有子集 $check_child = $this->major_obj->where('pid', $data['major_id'])->where('major_state', 0)->select(); if ($check_child) { - return jsonError("存在子集不能删除"); + return jsonError("Subsets exist and cannot be deleted"); } //判断是否存在引用 $check_journal = $this->major_to_journal_obj->where('major_id', $data['major_id'])->where("mtj_state", 0)->select(); if ($check_journal) { - return jsonError("期刊存在引用,不能删除"); + return jsonError("The journal has references and cannot be deleted"); } $this->major_obj->where("major_id", $data['major_id'])->update(['major_state' => 1]); return jsonSuccess([]); @@ -215,12 +215,12 @@ class Major extends Controller { $major_info = $this->major_obj->where('major_id', $data['major_id'])->where("major_state", 0)->find(); $check_major = $this->major_to_journal_obj->where('major_id', $major_info['pid'])->where('journal_issn', trim($data['journal_issn']))->where('mtj_state', 0)->find(); if ($major_info['pid'] != 0 && $check_major == null) { - return jsonError("父级必须存在"); + return jsonError("Parent must exist"); } //判断是否重复添加 $check = $this->major_to_journal_obj->where('major_id', $data['major_id'])->where('journal_issn', trim($data['journal_issn']))->where('mtj_state', 0)->find(); if ($check) { - return jsonError("重复添加"); + return jsonError("Add repeatedly"); } $has = $this->major_to_journal_obj->where('major_id', $data['major_id'])->where('journal_issn', trim($data['journal_issn']))->where('mtj_state', 1)->find(); @@ -385,7 +385,7 @@ class Major extends Controller { ->where("t_major.pid", $data['major_id']) ->select(); if ($check) { - return jsonError("存在子集不能删除"); + return jsonError("Subsets exist and cannot be deleted"); } $this->major_to_journal_obj->where('major_id', $data['major_id'])->where('journal_issn', $data['journal_issn'])->update(['mtj_state' => 1]); @@ -406,7 +406,7 @@ class Major extends Controller { public function getJournalMajorList() { $data = $this->request->post(); if (!isset($data['journal_issn'])) { - return jsonError("参数异常"); + return jsonError("Parameter exception"); } // $data['journal_issn'] = '2815-7125'; //获取主节点 diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 9667eed..4eddb37 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -101,7 +101,7 @@ class Production extends Controller // $data['article_id'] = 1144; $check = $this->production_article_obj->where('article_id', $data['article_id'])->where('state', 0)->find(); if ($check) { - return jsonError('实例已存在!'); + return jsonError('Instance already exists'); } $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); @@ -191,7 +191,6 @@ class Production extends Controller 'journal_stage_id' => 'require', 'title' => 'require', 'type' => 'require', - 'icon' => 'require', 'acknowledgment' => 'require', 'keywords' => 'require', 'author_contribution'=>'require', @@ -207,7 +206,7 @@ class Production extends Controller $update['title'] = trim($data['title']); $update['journal_stage_id'] = $data['journal_stage_id']; $update['type'] = trim($data['type']); - $update['icon'] = trim($data['icon']); + $update['icon'] = isset($data['icon'])?trim($data['icon']):''; $update['tradition_tag'] = isset($data['tradition_tag'])?trim($data['tradition_tag']):''; $update['tradition'] = isset($data['tradition'])?trim($data['tradition']):''; $update['author_contribution'] = trim($data['author_contribution']); diff --git a/application/api/controller/Publish.php b/application/api/controller/Publish.php index 8697cd0..7b54f56 100644 --- a/application/api/controller/Publish.php +++ b/application/api/controller/Publish.php @@ -216,6 +216,26 @@ class Publish extends Controller return jsonSuccess([]); } + /** + * 编辑文章权重 + */ + public function editArticle(){ + $data = $this->request->post(); + $rule = new Validate([ + 'article_id'=>'require', + 'sort'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/changeArticleForSubmit'; + $pra = []; + $pra['article_id'] = $data['article_id']; + $pra['sort'] = $data['sort']; + $res = object_to_array(json_decode(myPost($url, $pra))); + return jsonSuccess([]); + } + /** * 获取文章的基本信息 */ diff --git a/application/api/controller/Typeset.php b/application/api/controller/Typeset.php index eb1ed1f..25d6c23 100644 --- a/application/api/controller/Typeset.php +++ b/application/api/controller/Typeset.php @@ -109,7 +109,7 @@ class Typeset extends Controller $check = $this->online_obj->where('article_id',$data['article_id'])->where('on_state',0)->find(); if($check){ - return jsonError('不能重复生成'); + return jsonError('Cannot generate repeatedly'); } $article_info = $this->article_obj->where('article_id',$data['article_id'])->find(); @@ -147,7 +147,7 @@ class Typeset extends Controller $check = $this->online_obj->where('article_id',$data['article_id'])->where('on_state',0)->find(); if($check){ - return jsonError('不能重复生成'); + return jsonError('Cannot generate repeatedly'); } $article_info = $this->article_obj->where('article_id',$data['article_id'])->find(); @@ -170,7 +170,7 @@ class Typeset extends Controller $authors = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select(); //check信息是否完整 if($on_info['journal_stage_id']==''||$on_info['on_doi']==''||$on_info['abstract']==''||$on_info['npp']==''){ - return jsonError('信息不全!'); + return jsonError('Incomplete information'); } //发送推送请求 // $url = "http://www.journal.com/master/Article/addArticleForSubmission"; diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 0765d1a..b865793 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -33,8 +33,6 @@ class User extends Controller protected $article_author_obj = ''; protected $user_black_obj = ''; protected $user_to_special_obj = ''; - protected $user_index_obj = ''; - protected $user_email_index_obj = ''; protected $user_register_check_obj = ''; public function __construct(\think\Request $request = null) @@ -56,8 +54,6 @@ class User extends Controller $this->article_author_obj = Db::name('article_author'); $this->user_black_obj = Db::name('user_black'); $this->user_to_special_obj = Db::name('user_to_special'); - $this->user_index_obj = Db::name('user_index'); - $this->user_email_index_obj = Db::name('user_email_index'); $this->user_register_check_obj = Db::name('user_register_check'); } @@ -153,6 +149,35 @@ class User extends Controller } } + /** + * 编辑用户指数信息 + */ + public function editUserMsg(){ + $data = $this->request->post(); + $rule = new Validate([ + 'user_id'=>'require', + 'wos_index'=>'require', + 'google_index'=>'require' + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $user_info = $this->user_obj->where('user_id',$data['user_id'])->find(); + $updata = []; + if($data['wos_index']!=$user_info['wos_index']){ + $updata['wos_index'] = $data['wos_index']; + $updata['wos_time'] = time(); + } + if($data['google_index']!=$user_info['google_index']){ + $updata['google_index'] = $data['google_index']; + $updata['google_time'] = time(); + } + if(count($updata)>0){ + $this->user_obj->where('user_id',$data['user_id'])->update($updata); + } + return jsonSuccess([]); + } + /** * @title 获取所有用户 * @description 获取所有用户 @@ -256,14 +281,12 @@ class User extends Controller if (!$rules->check($data)) { return jsonError($rules->getError()); } - - $check = $this->user_obj ->where('state', 0) ->where('account = "' . trim($data['account']) . '" or email = "' . trim($data['email']) . '"') ->find(); if ($check) { - return jsonError('用户已经存在'); + return jsonError('The user already exists'); } $inser_data['account'] = $data['account']; $inser_data['password'] = md5($data['password']); @@ -476,12 +499,12 @@ class User extends Controller } if ($data['role_type'] == 'special') { if (!isset($data['special_id'])) { - return jsonError("添加客座编辑身份时,客座id是必传项"); + return jsonError("When adding a passenger editing identity, the passenger ID is required"); } $check = $this->user_to_special_obj->where("user_id", $data['user_id'])->where('special_id', $data['special_id'])->where('uts_state', 0)->find(); if ($check) { - return jsonError("不可重复添加"); + return jsonError("Cannot be added repeatedly"); } $insert_uts['user_id'] = $data['user_id']; $insert_uts['special_id'] = $data['special_id']; @@ -591,52 +614,6 @@ class User extends Controller return jsonSuccess([]); } - /** - * 编辑/添加指数by邮箱 - */ - public function editIndexByEmail(){ - $data = $this->request->post(); - $rule = new Validate([ - 'email'=>'require', - 'year'=>'require', - 'index'=>'require' - ]); - if(!$rule->check($data)){ - return jsonError($rule->getError()); - } - $check = $this->user_email_index_obj->where('email',$data['email'])->where('year',$data['year'])->where('state',0)->find(); - if($check){ - $this->user_email_index_obj->where('ein_id',$check['ein_id'])->update(['h_index'=>$data['index']]); - }else{ - $insert['email'] = $data['email']; - $insert['year'] = $data['year']; - $insert['h_index'] = $data['index']; - $this->user_email_index_obj->insert($insert); - } - return jsonSuccess([]); - - } - - /** - * 获取指数通过邮箱 - */ - public function getIndexByEmail(){ - $data = $this->request->post(); - $rule = new Validate([ - 'email'=>'require' - ]); - if(!$rule->check($data)){ - return jsonError($rule->getError()); - } - $list = $this->user_email_index_obj - ->where('email',$data['email']) - ->where('state',0) - ->order('year') - ->select(); - $re['indexs'] = $list; - return jsonSuccess($re); - } - /** * @title 降级青年编委至审稿人 * @description 降级青年编委至审稿人