This commit is contained in:
chengxl
2025-08-28 09:18:19 +08:00
parent 2be631255c
commit 4d0634fab1

View File

@@ -414,7 +414,7 @@ class Finalreview extends Base
return json_encode(['status' => 3,'msg' => 'Review record does not exist or review has been completed']);
}
//查询文章相关信息
$aWhere = ['article_id' => $aReviewerFinal['article_id'],'journal_id' => $aBoard];
$aWhere = ['article_id' => $aReviewerFinal['article_id'],'journal_id' => $aBoard,'query' => ['review','repeat','final','response']];
return $this->getReviewRecord($aWhere);
}
/**
@@ -432,13 +432,19 @@ class Finalreview extends Base
}
//查询审稿记录
$aWhere = ['id' => $iId];
$aReviewerFinal = Db::name('article_reviewer_final')->field('article_id,state,suggest_for_editor,suggest_for_author,update_time')->where($aWhere)->find();
$aReviewerFinal = Db::name('article_reviewer_final')->field('article_id,state,suggest_for_editor,suggest_for_author,update_time,reviewer_id')->where($aWhere)->find();
if(empty($aReviewerFinal)){
return json_encode(['status' => 3,'msg' => 'No review records found']);
}
$aReviewerFinal['update_time'] = date('Y-m-d H:i:s',$aReviewerFinal['update_time']);
//查询审稿人信息
$aWhere = ['user_id' => $aReviewerFinal['reviewer_id']];
$aUser = Db::name('user')->field('email,realname,localname')->where($aWhere)->find();
if(!empty($aUser)){
$aReviewerFinal += $aUser;
}
//查询文章相关信息
$aWhere = ['article_id' => $aReviewerFinal['article_id'],'record_id' => $iId];
$aWhere = ['article_id' => $aReviewerFinal['article_id'],'query' => ['review','repeat','response']];
$aResult = json_decode($this->getReviewRecord($aWhere),true);
$aArticle = empty($aResult['data']) ? [] : $aResult['data'];
if(empty($aArticle)){
@@ -463,13 +469,27 @@ class Finalreview extends Base
if(empty($iArticleId)){
return json_encode(['status' => 2,'msg' => 'Please select a article']);
}
//查询内容
$sQuery = empty($aParam['query']) ? ['review'] : $aParam['query'];
//查询文章
$aWhere = ['article_id' => $iArticleId];
$aArticle = Db::name('article')->field('journal_id,state,accept_sn,title,abstrart,keywords')->where($aWhere)->find();
$aArticle = Db::name('article')->field('article_id,journal_id,state,accept_sn,title,abstrart,keywords,type,ctime')->where($aWhere)->find();
if(empty($aArticle)){
return json_encode(['status' => 3,'msg' => 'The query article does not exist']);
}
//文章类型
$aArticle['atype'] = empty($aArticle['type']) ? '' : translateType($aArticle['type']);
$aArticle['ctime'] = empty($aArticle['ctime']) ? '' : date('Y-m-d H:i:s',$aArticle['ctime']);
//获取文章领域
$oArticle = new \app\common\Article;
$aMajor = $oArticle->getArticleField($aParam);
$aMajor = empty($aMajor['data']) ? [] : array_unique(array_column($aMajor['data'], 'major_id'));
if(!empty($aMajor)){
foreach ($aMajor as $key => $value) {
$aMajorData[] = getMajorStr($value);
}
}
$aArticle['major'] = empty($aMajorData) ? [] : $aMajorData;
//判断期刊ID是否符合
if(!empty($aParam['journal_id']) && !in_array($aArticle['journal_id'], $aParam['journal_id'])){
return json_encode(['status' => 4,'msg' => 'The journal to which the reviewer belongs does not match the article. Please confirm']);
@@ -493,9 +513,11 @@ class Finalreview extends Base
$aQuestion = empty($aQuestion) ? [] : array_column($aQuestion, null,'art_rev_id');
//查询复审
$aWhere = ['art_rev_id' => ['in',$aArtRevId],'recommend' => ['between',[1,3]]];
$aReviewerRepeat = Db::name('article_reviewer_repeat')->field('art_rev_id,recommend,content,ctime,stime')->where($aWhere)->select();
$aReviewerRepeat = empty($aReviewerRepeat) ? [] : array_column($aReviewerRepeat, null,'art_rev_id');
if(in_array('repeat', $sQuery)){
$aWhere = ['art_rev_id' => ['in',$aArtRevId],'recommend' => ['between',[1,3]]];
$aReviewerRepeat = Db::name('article_reviewer_repeat')->field('art_rev_id,recommend,content,ctime,stime')->where($aWhere)->select();
$aReviewerRepeat = empty($aReviewerRepeat) ? [] : array_column($aReviewerRepeat, null,'art_rev_id');
}
//查询用户信息
$aUserId = array_column($aArticleReviewer, 'reviewer_id');
@@ -534,25 +556,25 @@ class Finalreview extends Base
}
//查询作者回复
$aWhere = ['article_id' => $iArticleId,'artr_state' => 0];
$aResponse = Db::name('article_response_to_reviewer')->field('file_url,artr_ctime')->where($aWhere)->select();
if(!empty($aResponse)){
foreach ($aResponse as $key => $value) {
$sFileUrl = empty($value['file_url']) ? '' : $value['file_url'];
if(empty($sFileUrl)){
continue;
if(in_array('response', $sQuery)){
$aWhere = ['article_id' => $iArticleId,'artr_state' => 0];
$aResponse = Db::name('article_response_to_reviewer')->field('file_url,artr_ctime')->where($aWhere)->select();
if(!empty($aResponse)){
foreach ($aResponse as $key => $value) {
$sFileUrl = empty($value['file_url']) ? '' : $value['file_url'];
if(empty($sFileUrl)){
continue;
}
$value['file_url'] = trim($this->sTouGaoUrl,'/').'/public/'.$sFileUrl;
$value['artr_ctime'] = empty($value['artr_ctime']) ? '' : date('Y-m-d',$value['artr_ctime']);
$aResponse[$key] = $value;
}
$value['file_url'] = trim($this->sTouGaoUrl,'/').'/public/'.$sFileUrl;
$value['artr_ctime'] = empty($value['artr_ctime']) ? '' : date('Y-m-d',$value['artr_ctime']);
$aResponse[$key] = $value;
}
}
//查询终审记录
$iId = empty($aParam['record_id']) ? 0 : $aParam['record_id'];
$aWhere = ['article_id' => $iArticleId];
if(empty($iId)){
$aWhere['state'] = ['between',[1,3]];
if(in_array('final', $sQuery)){
$aWhere = ['article_id' => $iArticleId,'state' => ['between',[1,3]]];
$aFinal = Db::name('article_reviewer_final')->field('reviewer_id,state,suggest_for_editor,suggest_for_author,review_time')->where($aWhere)->select();
if(!empty($aFinal)){
//查询用户信息
@@ -567,7 +589,7 @@ class Finalreview extends Base
}
}
}
return json_encode(['status' => 1,'msg' => 'success','data' => ['article_review' => $aReviewerData,'article_review_repeat' => empty($aReviewerRepeat) ? [] : $aReviewerRepeat,'article_response' => $aResponse,'article_final' => empty($aFinal) ? [] : $aFinal,'article' => $aArticle]]);
return json_encode(['status' => 1,'msg' => 'success','data' => ['article_review' => $aReviewerData,'article_review_repeat' => empty($aReviewerRepeat) ? [] : $aReviewerRepeat,'article_response' => empty($aResponse) ? [] : $aResponse,'article_final' => empty($aFinal) ? [] : $aFinal,'article' => $aArticle]]);
}
/**
* @title 获取终审文章列表
@@ -661,7 +683,7 @@ class Finalreview extends Base
$aAiReview = Db::name('article_ai_review')->field('article_id,content')->where($aWhere)->column('article_id,content');
//查询终审信息
$aFinal = Db::name('article_reviewer_final')->field('id,article_id,reviewer_id,state')->where($aWhere)->select();
$aFinal = Db::name('article_reviewer_final')->field('id,article_id,reviewer_id,state,reviewer_type')->where($aWhere)->select();
$aUserId = empty($aFinal) ? [] : array_unique(array_column($aFinal, 'reviewer_id'));
//查询作者信息
@@ -705,10 +727,11 @@ class Finalreview extends Base
//查询文件
$aWhere = ['article_id' => ['in',$aArticleId],'state' => 0];
$aFile = Db::name('article_file')->field('file_id,article_id,file_url,type_name')->where($aWhere)->select();
$aFile = Db::name('article_file')->field('file_id,article_id,file_url,type_name,ctime')->where($aWhere)->select();
$aFileData = [];
if(!empty($aFile)){
foreach ($aFile as $key => $value) {
$value['ctime'] = date('Y-m-d');
$aFileData[$value['article_id']][$value['type_name']][] = $value;
}
}
@@ -776,6 +799,145 @@ class Finalreview extends Base
}
return json_encode(['status' => 1,'msg' => 'success','data' => ['total' => $iCount,'lists' => $aArticleLists,'count_num' => $aCountNumData]]);
}
/**
* @title 获取已邀请的审稿人
* @param article_id 文章ID
*/
public function inviteBoardLists(){
//获取参数
$aParam = $this->request->post();
//参数验证-文章ID
$iArticleId = empty($aParam['article_id']) ? 0 : $aParam['article_id'];
if(empty($iArticleId)){
return json_encode(['status' => 2,'msg' => 'Please select a article']);
}
//获取分页相关参数
$iSize = empty($aParam['size']) ? 15 : $aParam['size'];//每页显示条数
$iPage = empty($aParam['page']) ? 1 : $aParam['page'];// 当前页码
//查询文章
$aWhere = ['article_id' => $iArticleId];
$aArticle = Db::name('article')->field('journal_id,state')->where($aWhere)->find();
if(empty($aArticle)){
return json_encode(['status' => 3,'msg' => 'The query article does not exist']);
}
//获取期刊ID
$iJournalId = empty($aArticle['journal_id']) ? '' : $aArticle['journal_id'];
if(empty($iJournalId)){
return json_encode(['status' => 3,'msg' => 'The article did not select a journal']);
}
//判断文章状态是否进入终审
$iArticleState = !isset($aArticle['state']) ? '' : $aArticle['state'];
if($iArticleState != 7){
return json_encode(['status' => 4,'msg' => 'The article has not entered the final review stage']);
}
//编委类型0主编1副主编2编委成员
if(isset($aParam['reviewer_type'])){
$aWhere['sQuery.reviewer_type'] = $aParam['reviewer_type'];
}
//组装sql
$sQuery = Db::name('article_reviewer_final')->where($aWhere)->buildSql();
//email
$aWhere = [];
if(!empty($aParam['email'])){
$aWhere['t_user.email'] = ['like', "%".$aParam["email"] . "%"];
}
//统计数量
$iCount = Db::table("({$sQuery}) sQuery")
->join('t_user', 'sQuery.reviewer_id = t_user.user_id')->where($aWhere)->count();
if(empty($iCount)){
return json_encode(['status' => 1,'msg' => 'Reviewer not found','data' => ['total' => 0,'lists' => []]]);
}
//判断页数是否超过最大分页限制
$iPageNum = ceil($iCount/$iSize);
if($iPage > $iPageNum){
return json_encode(['status' => 1,'msg' => 'The number of pages has exceeded the limit, maximum page number:'.$iPageNum,'data' => ['total' => $iCount,'lists' => []]]);
}
//查询记录
$sOrder = empty($aParam['order']) ? 'type desc,user_id desc' : $aParam['order'];//排序
$aLists = Db::table("({$sQuery}) sQuery")
->join('t_user', 'sQuery.reviewer_id = t_user.user_id')
->field('sQuery.reviewer_id,sQuery.reviewer_type,sQuery.state,sQuery.suggest_for_author,sQuery.suggest_for_editor,sQuery.update_time,t_user.account,t_user.email,t_user.realname,t_user.localname')
->where($aWhere)
->order($sOrder)
->page($iPage, $iSize)
->select();
return json_encode(['status' => 1,'msg' => 'success','data' => ['total' => $iCount,'lists' => $aLists]]);
}
/**
* @title 获取文章文件
* @param article_id 文章ID
*/
public function getArticleFile(){
//获取参数
$aParam = $this->request->post();
//主键ID
$iId = empty($aParam['record_id']) ? 0 : $aParam['record_id'];
if(empty($iId)){
return json_encode(['status' => 2,'msg' => 'Please select the review record']);
}
//查询审稿记录
$aWhere = ['id' => $iId];
$aReviewerFinal = Db::name('article_reviewer_final')->field('article_id,state')->where($aWhere)->find();
if(empty($aReviewerFinal)){
return json_encode(['status' => 3,'msg' => 'No review records found']);
}
//文章已审核
if($aReviewerFinal['state'] != 0){
return json_encode(['status' => 4,'msg' => 'The article has been reviewed']);
}
//查询文章信息
$iArticleId = empty($aReviewerFinal['article_id']) ? 0 : $aReviewerFinal['article_id'];
$aWhere = ['article_id' => $iArticleId];
$aArticle = Db::name('article')->field('article_id')->where($aWhere)->find();
if(empty($aArticle)){
return json_encode(['status' => 3,'msg' => 'The query article does not exist']);
}
// 定义需要查询的文件类型
$aType = ['manuscirpt', 'picturesAndTables', 'supplementary'];
// 初始化结果数组,确保每个类型都有默认空数组
$aData = array_fill_keys($aType, []);
// 获取每个类型的最大file_id最新记录)
$aWhere = ['state' => 0,'type_name' => ['in',$aType],'article_id' => $iArticleId];
$sQuery = Db::name('article_file')
->field('type_name, MAX(file_id) AS max_file_id')
->where($aWhere)
->group('type_name')
->buildSql();
//关联查询获取完整信息
$aFileList = Db::name('article_file')
->alias('article_file')
->join([$sQuery => 'sQuery'], 'article_file.file_id = sQuery.max_file_id', 'INNER')
->field('article_file.type_name, article_file.file_id, article_file.file_url, article_file.ctime')
->select();
// 数据处理
if (!empty($aFileList)) {
foreach ($aFileList as $value) {
$type = empty($value['type_name']) ? '' : $value['type_name'];
$aData[$type] = [
'file_id' => $value['file_id'],
'file_url' => $value['file_url'],
'ctime' => empty($value['ctime']) ? '' : date('Y-m-d',$value['ctime'])
];
}
}
return json_encode(['status' => 1,'msg' => 'success','data' => $aData]);
}
/**
* @title 审稿链接创建
* @param reviewer_id 审稿人ID