From 1f7220f36e66f33fb9d3867ecb1856a4d2fb0ae5 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 7 Aug 2024 15:02:14 +0800 Subject: [PATCH] 1 --- application/api/controller/Article.php | 53 ++++++++++ application/api/controller/EmailService.php | 46 +++++++++ application/api/controller/Monitor.php | 1 + application/api/controller/Super.php | 97 +++++++++++++++---- application/api/controller/Web.php | 3 +- thinkphp/library/think/cache/driver/Redis.php | 2 +- 6 files changed, 179 insertions(+), 23 deletions(-) create mode 100644 application/api/controller/EmailService.php diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index d9386f1..5b3bc82 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -20,6 +20,37 @@ class Article extends Base parent::__construct($request); } + + + + public function refusePassword() + { + $data = $this->request->post(); + $rule = new Validate([ + "password" => "require" + ]); + if (!$rule->check($data)) { + return jsonError($rule->getError()); + } + $password = $data['password']; + if (function_exists('openssl_random_pseudo_bytes')) { + $salt = substr(str_replace('+', '.', base64_encode(openssl_random_pseudo_bytes(6))), 0, 8); + } else { + // 使用 mt_rand 作为后备方法 + $salt = ''; + for ($i = 0; $i < 8; $i++) { + $salt .= chr(mt_rand(33, 126)); // 生成随机字符 + } + } + $hashed_password = crypt($password, '$1$' . $salt . '$'); + + return jsonSuccess(["result"=>$hashed_password]); + +// return $hashed_password; + + + } + /** * 获取文章列表(作者) */ @@ -1097,6 +1128,24 @@ class Article extends Base } + public function checkArticleStart(){ + $data = $this->request->post(); + $rule = new Validate([ + "article_id" => "require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $article_info = $this->article_obj->where("article_id",$data['article_id'])->find(); + $journal_info = $this->journal_obj->where("journal_id",$article_info['journal_id'])->find(); + if($article_info['scoring'] < $journal_info['kfen']){ + return jsonError("The initial review score for ".$journal_info['title']." is ".$journal_info['kfen'].". The current article's initial review score is ".$article_info['scoring'].", and the manuscript will be automatically rejected while it is in the with editor status."); + }else{ + return jsonSuccess([]); + } + } + + /** * @title 修改文章状态(编辑) * @description 修改文章状态(编辑) @@ -1768,6 +1817,10 @@ class Article extends Base return jsonError("Invitation record already exists!"); } + if($article_info['state']==0){ + return jsonError("The article can only be added in state with editor at least"); + } + //增加信息到文章审稿表 $insert_data['reviewer_id'] = $data['uid']; $insert_data['article_id'] = $data['articleId']; diff --git a/application/api/controller/EmailService.php b/application/api/controller/EmailService.php new file mode 100644 index 0000000..cbad674 --- /dev/null +++ b/application/api/controller/EmailService.php @@ -0,0 +1,46 @@ +request->post(); + $rule = new Validate([ + "password" => "require" + ]); + if (!$rule->check($data)) { + return jsonError($rule->getError()); + } + $password = $data['password']; + if (function_exists('openssl_random_pseudo_bytes')) { + $salt = substr(str_replace('+', '.', base64_encode(openssl_random_pseudo_bytes(6))), 0, 8); + } else { + // 使用 mt_rand 作为后备方法 + $salt = ''; + for ($i = 0; $i < 8; $i++) { + $salt .= chr(mt_rand(33, 126)); // 生成随机字符 + } + } + $hashed_password = crypt($password, '$1$' . $salt . '$'); + + return jsonSuccess(["result"=>$hashed_password]); + +// return $hashed_password; + + + } +} \ No newline at end of file diff --git a/application/api/controller/Monitor.php b/application/api/controller/Monitor.php index ecea85b..7dfa9f9 100644 --- a/application/api/controller/Monitor.php +++ b/application/api/controller/Monitor.php @@ -155,6 +155,7 @@ class Monitor extends Base $s_time = strtotime($year."-".$month."-1"); $e_time = strtotime("+1 month", $s_time) - 1; $n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->count(); + $frag[$year."-".$month."sql"] = $this->article_obj->getLastSql(); $frag[$year."-".$month] = $n; if($month==12){ $year++; diff --git a/application/api/controller/Super.php b/application/api/controller/Super.php index 02295a8..c81fcc7 100644 --- a/application/api/controller/Super.php +++ b/application/api/controller/Super.php @@ -1,9 +1,10 @@ article_file_obj = Db::name('article_file'); $this->article_reviewer_obj = Db::name('article_reviewer'); $this->article_author_obj = Db::name('article_author'); + $this->board_to_journal = Db::name("board_to_journal"); $this->article_transfer_obj = Db::name('article_transfer'); $this->staff_obj = Db::name('staff'); $this->staff_level_obj = Db::name('staff_level'); @@ -57,6 +60,52 @@ class Super extends Controller{ } return json($list); } + + /**编辑的期刊情况表 + * @return void + */ + public function editorJournal(){ + $data = $this->request->post(); + $rule = new Validate([ + "editor_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $start_time = strtotime(date("Y")."-01-01"); + $end_time = strtotime(date("Y")."-12-31 23:59:59"); + $q_start_time = strtotime((date("Y")-1)."-01-01"); + $q_end_time = strtotime((date("Y")-1)."-12-31 23:59:59"); + $journal_list = $this->journal_obj->field("journal_id,title,issn,abbr")->where("editor_id",$data['editor_id'])->select(); + $gjh_url = "http://journalapi.tmrjournals.com/public/index.php/super/Publish/getGJHByIssn"; + + foreach ($journal_list as $k => $v){ + $journal_list[$k]["board"] = $this->getBoardData($v['journal_id']); + $sj_r = $this->getSJ($v['journal_id'],$start_time,$end_time); + $lyl_r = $this->getLYL($v['journal_id'],$start_time,$end_time); + $year["mq"] = $sj_r['mq']; + $year["zc"] = $sj_r['zc']; + $year["zr"] = $sj_r['zr']; + $year['lyl'] = $lyl_r; + $gjh = object_to_array(json_decode(myPost($gjh_url,["year"=>date("Y"),"issn"=>$v['issn']]))); + $year['gjh'] = $gjh['data']['result']; + $journal_list[$k]["year"] = $year; + + $sj_rq = $this->getSJ($v['journal_id'],$q_start_time,$q_end_time); + $lyl_rq = $this->getLYL($v['journal_id'],$q_start_time,$q_end_time); + $yearq["mq"] = $sj_rq['mq']; + $yearq["zc"] = $sj_rq['zc']; + $yearq["zr"] = $sj_rq['zr']; + $yearq['lyl'] = $lyl_rq; + $gjhq = object_to_array(json_decode(myPost($gjh_url,["year"=>date("Y")-1,"issn"=>$v['issn']]))); + $yearq['gjh'] = $gjhq['data']['result']; + $journal_list[$k]['p_year'] = $yearq; + } + + $re['list'] = $journal_list; + + return jsonSuccess($re); + } public function getAllArticle(){ $data = $this->request->post(); @@ -93,6 +142,28 @@ class Super extends Controller{ $re['articles'] = $list; return jsonSuccess($re); } + + + private function getBoardData($journal_id){ + $list = $this->board_to_journal->field("t_board_to_journal.*,t_user_reviewer_info.country") + ->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",$journal_id) + ->where("t_board_to_journal.state",0) + ->select(); + $flag = []; + $flag['all'] = count($list); + $f = []; + foreach ($list as $v){ + if(isset($f[$v['country']])){ + $f[$v['country']]++; + }else{ + $f[$v['country']] = 1; + } + } + $flag['country'] = $f; + + return $flag; + } /** * 获取审稿人数量 @@ -251,26 +322,6 @@ class Super extends Controller{ return $frag; } - public function mutest(){ - $start_time = strtotime('2021-01-01'); - $end_time = strtotime('2021-04-15 23:59:59'); - $res = $this->getSJ(1, $start_time, $end_time); - echo '
';
-        var_dump($res);
-        echo '
'; - die; - } - - public function mmmyyy(){ - $start = strtotime('2021-01-01'); - $end = strtotime('2021-04-22 11:30:12'); - $res = $this->getSJ(8, $start, $end); - echo '
';
-        var_dump($res);
-        echo '
'; - die; - } - /** * 获取时间异常 */ @@ -304,6 +355,9 @@ class Super extends Controller{ $journal_info = $this->journal_obj->where('journal_id',$journalId)->find(); $zc_num = $this->article_obj->where('accept_sn','like',$journal_info['abbr'].'%')->where('journal_id','<>',$journalId)->where('ctime','>',$start_time)->where('ctime','<',$end_time)->count(); + +// echo $this->article_obj->getLastSql();die; + $zr_num = $this->article_obj->where('accept_sn','not like',$journal_info['abbr'].'%')->where('journal_id',$journalId)->where('ctime','>',$start_time)->where('ctime','<',$end_time)->count(); //获取全部总数 $mq_num = $this->article_obj @@ -311,6 +365,7 @@ class Super extends Controller{ ->where('ctime','>',$start_time) ->where('ctime','<',$end_time) ->count(); + echo $this->article_obj->getLastSql();die; $res['mq'] = $mq_num;//文章总数 $res['zc'] = $zc_num;//转出文章数 $res['zr'] = $zr_num;//转入文章数 diff --git a/application/api/controller/Web.php b/application/api/controller/Web.php index f0a4d9c..fddcd2e 100644 --- a/application/api/controller/Web.php +++ b/application/api/controller/Web.php @@ -201,8 +201,9 @@ class Web extends Base ||($article_info['journal_id']==6&&$p_info['journal_stage_id']>=515) ||($article_info['journal_id']==15&&($article_info['article_id']>=4465||$article_info['article_id']==4349)) ||($article_info['journal_id']==10&&$p_info['journal_stage_id']>=534) - ||($article_info['journal_id']==3&&($article_info['article_id']>=4523||$article_info['article_id']==4094)) + ||($article_info['journal_id']==3&&($article_info['article_id']>=4523||$article_info['article_id']==4094||$article_info['article_id']==4369)) ||($article_info['journal_id']==2&&$article_info['article_id']>=4361) + ||($article_info['journal_id']==9&&$p_info['journal_stage_id']>=545) ||$article_info['journal_id']==23){ //添加初审问卷 $reviewers[$k]['question'] = $this->article_reviewer_question_obj->where('art_rev_id',$v['art_rev_id'])->find(); diff --git a/thinkphp/library/think/cache/driver/Redis.php b/thinkphp/library/think/cache/driver/Redis.php index 8956e77..7ab7b9f 100644 --- a/thinkphp/library/think/cache/driver/Redis.php +++ b/thinkphp/library/think/cache/driver/Redis.php @@ -25,7 +25,7 @@ class Redis extends Driver protected $options = [ 'host' => '127.0.0.1', 'port' => 6379, - 'password' => '', + 'password' => 'Jgll2015', 'select' => 0, 'timeout' => 0, 'expire' => 0,