diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 5c3b60c..1a2b808 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -3428,7 +3428,8 @@ class Article extends Base $inset_data['abstrart'] = trim($data['abstrart']); $inset_data['keywords'] = isset($data['keyWords']) ? $data['keyWords'] : ''; $inset_data['fund'] = isset($data['fund']) ? trim($data['fund']) : ''; - // $inset_data['accept_sn'] = getArticleSN($journal_info['abbr'], $data['type']); + $sType = empty($data['type']) ? 'D' : $data['type']; + $inset_data['accept_sn'] = getArticleSN('Draft', $sType); $inset_data['topics'] = isset($data["topics"]) ? json_encode($data['topics']) : ""; $inset_data['type'] = $data['type']; // $inset_data['major_id'] = $data['major']; @@ -3448,15 +3449,6 @@ class Article extends Base $inset_data['state'] = -1; $article_id = $this->article_obj->insertGetId($inset_data); - if(!empty($article_id)){ - //获取accept_sn并更新 - $sAcceptSn = $this->getArticleAcceptSn(['article_id' => $article_id]); - if(!empty($sAcceptSn)){ - $aWhere = ['article_id' => $article_id]; - $aUpdate = ['accept_sn' => $sAcceptSn]; - $update_result = Db::name('article')->where($aWhere)->limit(1)->update($aUpdate); - } - } } else { // $checkArticle = $this->article_obj->where("article_id", "<>", $article_id)->where("title", trim($data['title']))->select(); // foreach ($checkArticle as $v) { @@ -3691,15 +3683,22 @@ class Article extends Base // } $article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); + if(empty($article_info)){ + return jsonError('The article does not exist.'); + } $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); + if(empty($journal_info)){ + return jsonError('The journal to which the article belongs does not exist'); + } $user_res = $this->user_obj->where('user_id', $article_info['user_id'])->find(); - + if(empty($user_res)){ + return jsonError('Author information does not exist'); + } //验证是否在黑名单 $black = $this->user_black_obj->where('user_id', $user_res['user_id'])->where('black_state', 0)->find(); if ($black) { return jsonError("Your account is currently blacklisted by TMR Publishing Group. Please contact the official email of the journal you wish to submit to for further clarification."); } - //稿件号 $sbbr = empty($journal_info['abbr']) ? '' : $journal_info['abbr']; $sArticleType = empty($article_info['type']) ? '' : $article_info['type']; @@ -3824,6 +3823,9 @@ class Article extends Base //推荐审稿人 $reviewers = isset($data['reviewers']) ? $data['reviewers'] : []; foreach ($reviewers as $v) { + if(empty($v['email'])){ + continue; + } $this->addRecommentReviewer($v, $journal_info['journal_id'], $user_res['user_id'], $data['article_id']); } $update_l['state'] = 0; @@ -4321,6 +4323,9 @@ class Article extends Base */ public function addRecommentReviewer($reivewe, $journal_id, $user_id, $article_id) { + if(empty($reivewe['email'])){ + return true; + } $journal_info = $this->journal_obj->where('journal_id', $journal_id)->find(); //判断此用户是否存在 $reviewer_info = $this->user_obj->where('email', trim($reivewe['email']))->where('state', 0)->find(); @@ -5590,6 +5595,8 @@ class Article extends Base // $aArticleInsert['is_transfer'] = 3; $aArticleInsert['is_become_reviewer'] = 3; $aArticleInsert['ctime'] = time(); + $sType = empty($aParam['type']) ? 'D' : $aParam['type']; + $aArticleInsert['accept_sn'] = getArticleSN('Draft',$sType); $iArticleId = Db::name('article')->insertGetId($aArticleInsert); $aParam['article_id'] = $iArticleId; } @@ -6036,18 +6043,4 @@ class Article extends Base $p = self::getMajorShuList($res['pid']); return $p . ',' . $res['major_id']; } - - /** - * 生成文章sn号 - */ - private function getArticleAcceptSn($aParam = [],$sFlag = 'Draft') - { - $iArticleId = empty($aParam['article_id']) ? 0 : $aParam['article_id']; - if(empty($iArticleId)){ - return ''; - } - $sDate = date('Y'); - $sType = $sDate; - return $sFlag.$sType.str_pad($iArticleId,6,'0',STR_PAD_LEFT).rand(100,999); - } }