From 77d21d852b0e44fa593a766fb380f2a43e7b3399 Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 3 Jun 2025 11:19:28 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E7=9B=B8=E5=85=B3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Aiarticle.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Aiarticle.php b/application/api/controller/Aiarticle.php index 2f5aa1e..7b0bb9a 100644 --- a/application/api/controller/Aiarticle.php +++ b/application/api/controller/Aiarticle.php @@ -65,8 +65,8 @@ class Aiarticle extends Base 'Review' => ' **核心要求** 1️ 内容涵盖哪些学科及方法请罗列 - 2 翻译好的内容将以公众号的形式推送给读者,按学术规范翻译并提炼文章概述,应包函文章背景(不少于200字)内容,其他内容提炼更强调逻辑性、科学术语准确性和表达的严谨性,注意内容不要有严重重复,不需要分点展示,大于1000字 - 3 针对结论简单总结,内容不要重复,大于300字 + 2 翻译好的内容将以公众号的形式推送给读者,按学术规范翻译并提炼文章概述,整体内容应大于1200字,其中应包函文章背景(不少于400字)内容,其他内容提炼更强调逻辑性、科学术语准确性和表达的严谨性,注意内容不要有严重重复,不需要分点展示,大于1000字 + 3 针对文章结论生成一个简单总结,内容不要重复,大于300字 4 请将标题翻译成中文【内容需自然流畅、口语化、连贯性、学术性】 {#title_chinese#} 5 请将文章内容翻译成中文【内容需自然流畅、口语化、连贯性、学术性】 From be46dbb3c0e337dfcf787abde2adf6de66dc03a6 Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 3 Jun 2025 11:54:26 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/reviewerActivityForYear.sh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 application/command/reviewerActivityForYear.sh diff --git a/application/command/reviewerActivityForYear.sh b/application/command/reviewerActivityForYear.sh new file mode 100755 index 0000000..7c1bd87 --- /dev/null +++ b/application/command/reviewerActivityForYear.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# reviewerActivity.sh +# 批量处理审稿人活跃度/疲劳度[近两年] +# 读取文章审核表【article_reviewer】状态state in [[1,2,3] 并且 ctime > strtotime('-2 year')的数据 +# 更新用户表【t_user】review_num_two_year 审核数量【近两年】 +# 此文件需要在crontab中配置每天【凌晨3点】运行一次 +# @author chengxiaoling +# @date 2025-04-17 + +# 基础配置 +DOMAIN="http://api.tmrjournals.com/public/index.php/" # 项目域名 +ROUTE="/api/Crontask/reviewerActivityForYear" # 控制器路由 +BASE_PATH=$(cd `dirname $0`; pwd) +# 如果日志目录不存在则创建 +logDir=${BASE_PATH}/log/$(date "+%Y")/$(date "+%m") +if [ ! -d $logDir ];then + mkdir -p $logDir +fi + +# 执行请求并记录日志 +curl "${DOMAIN}${ROUTE}" >> ${logDir}/reviewerActivityForYear_$(date "+%Y%m%d").log 2>&1 +# 添加时间戳 +echo "[$(date '+%Y-%m-%d %H:%M:%S')] 定时任务已执行" >> ${logDir}/reviewerActivityForYear_$(date "+%Y%m%d").log \ No newline at end of file From 89c8de2120044c10af71f2c625d35a84ed98f55b Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 3 Jun 2025 13:38:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AE=A1=E7=A8=BF=E4=BA=BA=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Reviewer.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/application/api/controller/Reviewer.php b/application/api/controller/Reviewer.php index 260f45c..5000229 100644 --- a/application/api/controller/Reviewer.php +++ b/application/api/controller/Reviewer.php @@ -1874,7 +1874,7 @@ class Reviewer extends Base //查询基本条件 - $aWhere = ['journal_id' => ['in',$jous],'state' => 0]; + $aWhere = ['t_reviewer_to_journal.journal_id' => ['in',$jous],'t_reviewer_to_journal.state' => 0]; if(!empty($data['grade'])){ $aWhere['grade'] = trim($data['grade']); } @@ -1909,7 +1909,9 @@ class Reviewer extends Base } //获取数据详情 $aResult = $this->reviewer_to_journal_obj - ->field('t_reviewer_to_journal.is_yboard,t_reviewer_to_journal.grade,t_reviewer_to_journal.journal_id,t_reviewer_to_journal.reviewer_id') + ->field('t_reviewer_to_journal.is_yboard,t_reviewer_to_journal.grade,t_reviewer_to_journal.journal_id,t_reviewer_to_journal.reviewer_id,t_user.user_id,t_user.account,t_user.email,t_user.phone,t_user.nickname,t_user.realname,t_user.localname,t_user.type,t_user.score,t_user.remark,t_user.wos_index,t_user.wos_time,t_user.g_author,t_user.g_website,t_user.google_index,t_user.google_time,t_user.google_editor,t_user.scopus_index,t_user.scopus_time,t_user.scopus_website,t_user.scopus_editor,t_user.code,t_user.orcid,t_user.orcid_code,t_user.review_num_two_year') + ->join('t_user', 't_user.user_id = t_reviewer_to_journal.reviewer_id', 'left') + ->order('t_user.review_num_two_year desc') ->where($aWhere) ->limit($iOffset, $iSize) ->select(); @@ -1923,9 +1925,9 @@ class Reviewer extends Base $aReviewer = Db::name('user_reviewer_info')->field('reviewer_id,gender,technical,country,introduction,company,website,field,qualifications')->where(['reviewer_id'=>['in',$aReviewerId]])->select(); $aReviewer = empty($aReviewer) ? [] : array_column($aReviewer, null,'reviewer_id'); - //用户基本信息 - $aUser = Db::name('user')->field('user_id,account,email,phone,nickname,realname,localname,type,score,remark,wos_index,wos_time,g_author,g_website,google_index,google_time,google_editor,scopus_index,scopus_time,scopus_website,scopus_editor,code,orcid,orcid_code')->where(['user_id'=>['in',$aReviewerId]])->select(); - $aUser = empty($aUser) ? [] : array_column($aUser, null,'user_id'); + // //用户基本信息 + // $aUser = Db::name('user')->field('user_id,account,email,phone,nickname,realname,localname,type,score,remark,wos_index,wos_time,g_author,g_website,google_index,google_time,google_editor,scopus_index,scopus_time,scopus_website,scopus_editor,code,orcid,orcid_code,review_num_two_year')->where(['user_id'=>['in',$aReviewerId]])->select(); + // $aUser = empty($aUser) ? [] : array_column($aUser, null,'user_id'); //查询CV $aUserCv = $this->user_cv_obj->where(['user_id'=>['in',$aReviewerId],'state' =>0])->select(); @@ -1954,11 +1956,11 @@ class Reviewer extends Base $aResult[$key] += $aReviewerInfo; } - //审稿人信息 - $aUserInfo = empty($aUser[$value['reviewer_id']]) ? [] : $aUser[$value['reviewer_id']]; - if(!empty($aUserInfo)){ - $aResult[$key] += $aUserInfo; - } + // //审稿人信息 + // $aUserInfo = empty($aUser[$value['reviewer_id']]) ? [] : $aUser[$value['reviewer_id']]; + // if(!empty($aUserInfo)){ + // $aResult[$key] += $aUserInfo; + // } //用户CVS信息 $aUserCvInfo = empty($aUserCvArray[$value['reviewer_id']]) ? [] : $aUserCvArray[$value['reviewer_id']]; $aResult[$key]['cvs'] = empty($aUserCvInfo) ? [] : $aUserCvInfo; From 2b3482a50196921fe1327aba9e77f0061c68034e Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 3 Jun 2025 13:38:48 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Crontask.php | 101 ++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/application/api/controller/Crontask.php b/application/api/controller/Crontask.php index ea61d38..5d640fb 100644 --- a/application/api/controller/Crontask.php +++ b/application/api/controller/Crontask.php @@ -357,6 +357,107 @@ class Crontask extends Controller $this->showMessage('批量更新超过七日未审稿的状态成功',2); } + + + /** + * 批量处理审稿人活跃度[近两年] + * + * @return void + */ + public function reviewerActivityForYear(){ + $sDate = strtotime(date('Y-m-d 00:00:00', strtotime('-2 year'))); + //获取该文章审核人的信息 + $aWhere = [ + 'ctime'=>['>',$sDate], + 'state'=>['in',[1,2,3]] + ]; + $aReviewer = Db::name('article_reviewer')->field('reviewer_id,count(article_id) as review_num_two_year ')->where($aWhere)->order('reviewer_id asc')->group('reviewer_id')->select(); + + //查询审稿人数量不为0的审稿信息 + $aUserWhere = [ + // 'is_reviewer' => 1, + 'review_num_two_year' => ['>',0] + ]; + $aUser = Db::name('user')->field('user_id,review_num_two_year')->where($aUserWhere)->select(); + if(empty($aReviewer) && empty($aUser)){ + $this->showMessage('未查询到待处理的审稿人数据【近两年】',2); + exit; + } + $aUser = empty($aUser) ? [] : array_column($aUser, null,'user_id'); + if(!empty($aReviewer)){ + $aChunk = array_chunk($aReviewer, 100); + Db::startTrans(); + foreach ($aChunk as $key => $item) { //数据分片操作 + //需要更新的用户ID + $aUpdateId = []; + //SQL拼接 + $aCase['review_num_two_year'] = 'CASE user_id '; + foreach ($item as $key => $value) { + //用户ID + $iUserId = $value['reviewer_id']; + + //拼接更新语句 + if(empty($aUser[$iUserId])){ + //更新数量 + $aCase['review_num_two_year'] .= "WHEN {$iUserId} THEN "; + $aCase['review_num_two_year'] .= "'{$value['review_num_two_year']}' "; + $aUpdateId[] = $iUserId; + continue; + } + //审核数量无变化,跳过更新 + if($aUser[$iUserId]['review_num_two_year'] == $value['review_num_two_year']){ + unset($aUser[$iUserId]); + continue; + } + //审核数量有,变化更新数量 + $aCase['review_num_two_year'] .= "WHEN {$iUserId} THEN "; + $aCase['review_num_two_year'] .= "'{$value['review_num_two_year']}' "; + $aUpdateId[] = $iUserId; + unset($aUser[$iUserId]); + } + //SQL拼接最后结尾 + $aCase['review_num_two_year'] .= 'END'; + //执行更新 + if(empty($aUpdateId)){ + continue; + } + $result = Db::name('user') + ->where(['user_id' => ['in',$aUpdateId]]) + ->update([ + 'review_num_two_year' => Db::raw($aCase['review_num_two_year']), + ]); + if ($result === false) { + $this->showMessage('更新近两年审稿人审核数量失败['.$key.']执行SQL:'.Db::getLastSql()."\n",2); + }else{ + $this->showMessage('更新近两年审稿人审核数量成功['.$key.']执行SQL条数:'.$result."\n",1); + } + } + Db::commit(); + } + if(!empty($aUser)){ + $aChunk = array_chunk($aUser, 100); + Db::startTrans(); + foreach ($aChunk as $key => $item) { //数据分片操作 + $aUserId = array_column($item, 'user_id'); + if(empty($aUserId)){ + continue; + } + $result = Db::name('user')->where(['user_id' => ['in',$aUserId]]) + ->limit(count($aUserId)) + ->update([ + 'review_num' => 0, + ]); + if ($result === false) { + $this->showMessage('清空近两年审稿人审核数量失败['.$key.']执行SQL:'.Db::getLastSql()."\n",2); + }else{ + $this->showMessage('清空近两年审稿人审核数量成功['.$key.']执行SQL条数:'.$result."\n",1); + } + + } + Db::commit(); + } + $this->showMessage('批量更新近两年审稿人审核数量成功'."\n",1); + } /** * * 格式化信息输出 From befef684cbf596de89718769e0c99cb1e63afc7e Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 3 Jun 2025 14:36:30 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Aiarticle.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/api/controller/Aiarticle.php b/application/api/controller/Aiarticle.php index 7b0bb9a..b854c33 100644 --- a/application/api/controller/Aiarticle.php +++ b/application/api/controller/Aiarticle.php @@ -66,7 +66,7 @@ class Aiarticle extends Base **核心要求** 1️ 内容涵盖哪些学科及方法请罗列 2 翻译好的内容将以公众号的形式推送给读者,按学术规范翻译并提炼文章概述,整体内容应大于1200字,其中应包函文章背景(不少于400字)内容,其他内容提炼更强调逻辑性、科学术语准确性和表达的严谨性,注意内容不要有严重重复,不需要分点展示,大于1000字 - 3 针对文章结论生成一个简单总结,内容不要重复,大于300字 + 3 针对文章结论生成一个简单总结,内容不要和文章概述重复,字数150以内 4 请将标题翻译成中文【内容需自然流畅、口语化、连贯性、学术性】 {#title_chinese#} 5 请将文章内容翻译成中文【内容需自然流畅、口语化、连贯性、学术性】 @@ -673,7 +673,7 @@ class Aiarticle extends Base * @param template_id 模版ID * @param $iIsSync 是否同步素材到微信 1是2否 */ - public function getTemplateContent($aParam = []){ + public function getTemplateContent($aParam = [],$iIsSync = 2){ //获取参数 $aParam = empty($aParam) ? $this->request->post() : $aParam; @@ -758,7 +758,7 @@ class Aiarticle extends Base //组装作者数据 if(!empty($aAuthor)){ $aAuthor = $this->_dealAuthor($aAuthor); - $aUpload['author_info'] = $aAuthor; + $aQueryParam['author_info'] = $aAuthor; } //获取素材信息 @@ -786,7 +786,7 @@ class Aiarticle extends Base $aDataInfo = array_column($aDataInfo, null,'email'); foreach ($aAuthor as $key => $value) { $aAuthorData = empty($aDataInfo[$value['email']]) ? [] : $aDataInfo[$value['email']]; - if(empty($aUser)){ + if(empty($aAuthorData)){ continue; } $aAuthor[$key]['icon'] = empty($aAuthorData['media_url']) ? $value['icon'] : $aAuthorData['media_url']; @@ -1216,7 +1216,7 @@ class Aiarticle extends Base //获取模版生成内容 $aTemplateParam = ['article_id' => $iArticleId,'template_id' => $sTemplate,'is_sync' => 1,'wechat_id' => $sWechatId]; $aTemplateParam += $aJournalInfo; - $aResult = json_decode($this->getTemplateContent($aTemplateParam),true); + $aResult = json_decode($this->getTemplateContent($aTemplateParam,1),true); $sMsg = empty($aResult['msg']) ? 'The content is empty' : $aResult['msg']; $aData = empty($aResult['data']) ? [] : $aResult['data']; if(empty($aData['template'])){ @@ -1554,7 +1554,7 @@ class Aiarticle extends Base $oMaterial = new Material; $aLog = json_decode($oMaterial->getWechatLog(['article_id' => $iArticleId,'type' => 1,'status' =>1]),true); if(!empty($aLog['data'])){ - return json_encode(['status' => -1,'msg' => 'The material has been uploaded','data' => []]); + return json_encode(['status' => 1,'msg' => 'The material has been uploaded','data' => []]); } //获取AI生成文章内容 From e396217b5f6428040127cfaba686949659541eda Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 3 Jun 2025 14:37:16 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/Material.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common/Material.php b/application/common/Material.php index d053b3e..a8a1a64 100644 --- a/application/common/Material.php +++ b/application/common/Material.php @@ -702,7 +702,7 @@ class Material if(!empty($aParam['author_info'])){ $aEmail = array_column($aParam['author_info'], 'email'); $aWhere = ['email' => ['in',$aEmail],'is_delete' => 2]; - $aData['ai_author_material'] = Db::name('ai_author_material')->field('user_id,email,media_id,media_url')->where($aWhere)->find(); + $aData['ai_author_material'] = Db::name('ai_author_material')->field('user_id,email,media_id,media_url')->where($aWhere)->select(); } return json_encode(['status' => 1,'msg' => 'Successfully obtained data','data' => $aData]); }