diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index bc31528..de53f3d 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -1568,6 +1568,23 @@ class Production extends Base return jsonError($rule->getError()); } $old_article_author_info = $this->production_article_author_obj->where('p_article_author_id', $data['p_article_author_id'])->find(); + + //判断邮箱是否重复 chengxiaoling 20250926 start + if(empty($old_article_author_info)){ + return jsonError('Author information does not exist'); + } + $iPArticleId = empty($old_article_author_info['p_article_id']) ? 0 : $old_article_author_info['p_article_id']; + $sEmail = empty($data['email']) ? '' : $data['email']; + $iAuthorId = empty($old_article_author_info['p_article_author_id']) ? 0 : $old_article_author_info['p_article_author_id']; + if(!empty($sEmail) && !empty($iPArticleId)){ + $aWhere = ['p_article_id' => $iPArticleId,'email' => $sEmail,'state' => 0,'p_article_author_id' => ['<>',$iAuthorId]]; + $aAuthor = $this->production_article_author_obj->field('p_article_author_id')->where($aWhere)->find(); + if(!empty($aAuthor)){ + return jsonError("Email has been bound by another author"); + } + } + //判断邮箱是否重复 chengxiaoling 20250926 end + $article_info = $this->article_obj->where('article_id', $old_article_author_info['article_id'])->find(); $updata['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']); $updata['first_name'] = trim($data['first_name']); @@ -1657,6 +1674,19 @@ class Production extends Base $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find(); $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find(); + + //判断邮箱是否重复 chengxiaoling 20250926 start + $iPArticleId = empty($data['p_article_id']) ? 0 : $data['p_article_id']; + $sEmail = empty($data['email']) ? '' : $data['email']; + if(!empty($sEmail) && !empty($iPArticleId)){ + $aWhere = ['p_article_id' => $iPArticleId,'email' => $sEmail,'state' => 0]; + $aAuthor = $this->production_article_author_obj->field('p_article_author_id')->where($aWhere)->find(); + if(!empty($aAuthor)){ + return jsonError("Email has been bound by another author"); + } + } + //判断邮箱是否重复 chengxiaoling 20250926 end + $insert['p_article_id'] = $data['p_article_id']; $insert['article_id'] = $p_info['article_id']; $insert['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']);