Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -972,8 +972,22 @@ class Article extends Base
|
|||||||
$inset_data['author_act'] = 1;
|
$inset_data['author_act'] = 1;
|
||||||
$inset_data['state'] = 1;
|
$inset_data['state'] = 1;
|
||||||
$where['article_id'] = $data['articleId'];
|
$where['article_id'] = $data['articleId'];
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$inset_data['is_user_act'] = 1;
|
||||||
|
$inset_data['user_update_time'] = time();
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
$up_res = $this->article_obj->where($where)->update($inset_data);
|
$up_res = $this->article_obj->where($where)->update($inset_data);
|
||||||
|
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$iArticleId = empty($data['articleId']) ? 0 : $data['articleId'];
|
||||||
|
if(!empty($iArticleId)){
|
||||||
|
//用户操作日志
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$aUserLog = ['article_id' => $iArticleId,'type' => 4,'act_id' => $iArticleId,'user_id' => empty($user_res['user_id'] )? 0 : $user_res['user_id'],'content' => 'Retired author resubmits manuscript'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
|
|
||||||
$article_info = $this->article_obj->where($where)->find();
|
$article_info = $this->article_obj->where($where)->find();
|
||||||
$journal_info = $this->journal_obj->where("journal_id", $article_info["journal_id"])->find();
|
$journal_info = $this->journal_obj->where("journal_id", $article_info["journal_id"])->find();
|
||||||
|
|
||||||
@@ -1045,9 +1059,9 @@ class Article extends Base
|
|||||||
$insert['user_id'] = $user_info['user_id'];
|
$insert['user_id'] = $user_info['user_id'];
|
||||||
$insert['ad_content'] = trim($data['ad_content']);
|
$insert['ad_content'] = trim($data['ad_content']);
|
||||||
$insert['ad_ctime'] = time();
|
$insert['ad_ctime'] = time();
|
||||||
$this->article_dialog_obj->insert($insert);
|
$iId = $this->article_dialog_obj->insertGetId($insert);
|
||||||
//留言红点提示并邮件
|
//留言红点提示并邮件
|
||||||
$this->messageTips($data['article_id'], $user_info['user_id']);
|
$this->messageTips($data['article_id'], $user_info['user_id'],$iId);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3818,7 +3832,7 @@ class Article extends Base
|
|||||||
//增加用户操作log
|
//增加用户操作log
|
||||||
$log_data['user_id'] = $user_res['user_id'];
|
$log_data['user_id'] = $user_res['user_id'];
|
||||||
$log_data['type'] = 0;
|
$log_data['type'] = 0;
|
||||||
$log_data['content'] = $user_res['account'] . "(" . $user_res['realname'] . "),上传了一篇文章:" . $data['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time());
|
$log_data['content'] = $user_res['account'] . "(" . $user_res['realname'] . "),上传了一篇文章:" . $article_info['title'] . ",上传时间是:" . date('Y-m-d H:i:s', time());
|
||||||
$log_data['ctime'] = time();
|
$log_data['ctime'] = time();
|
||||||
$res_log = $this->user_log_obj->insert($log_data);
|
$res_log = $this->user_log_obj->insert($log_data);
|
||||||
|
|
||||||
@@ -3860,7 +3874,18 @@ class Article extends Base
|
|||||||
$update_l['accept_sn'] = $sArticleSn;
|
$update_l['accept_sn'] = $sArticleSn;
|
||||||
}
|
}
|
||||||
//新增保存字段 chengxiaoling 20251031 end
|
//新增保存字段 chengxiaoling 20251031 end
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$update_l['is_user_act'] = 1;
|
||||||
|
$update_l['user_update_time'] = time();
|
||||||
|
$update_l['received_time'] = time();
|
||||||
|
$iArticleId = empty($data['article_id']) ? 0 : $data['article_id'];
|
||||||
|
if(!empty($iArticleId)){
|
||||||
|
//用户操作日志
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$aUserLog = ['article_id' => $iArticleId,'type' => 5,'act_id' => $iArticleId,'user_id' => empty($user_res['user_id']) ? 0 : $user_res['user_id'],'content' => 'Author submits new manuscript'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
$this->article_obj->where('article_id', $data['article_id'])->update($update_l);
|
$this->article_obj->where('article_id', $data['article_id'])->update($update_l);
|
||||||
$this->ai_scor($data['article_id']);
|
$this->ai_scor($data['article_id']);
|
||||||
|
|
||||||
@@ -4575,18 +4600,18 @@ class Article extends Base
|
|||||||
$where['state'] = 0;
|
$where['state'] = 0;
|
||||||
$list = $this->journal_obj->where($where)->select();
|
$list = $this->journal_obj->where($where)->select();
|
||||||
|
|
||||||
//获取期刊封面 chengxiaoling 20251027 start
|
// //获取期刊封面 chengxiaoling 20251027 start
|
||||||
if(!empty($list)){
|
// if(!empty($list)){
|
||||||
$aParam = ['issn' => array_column($list, 'issn')];
|
// $aParam = ['issn' => array_column($list, 'issn')];
|
||||||
$sUrl = 'http://journalapi.tmrjournals.com/public/index.php/';
|
// $sUrl = 'http://journalapi.tmrjournals.com/public/index.php/';
|
||||||
$sUrl = $sUrl."api/Supplementary/getJournal";
|
// $sUrl = $sUrl."api/Supplementary/getJournal";
|
||||||
$aResult = object_to_array(json_decode(myPost1($sUrl,$aParam),true));
|
// $aResult = object_to_array(json_decode(myPost1($sUrl,$aParam),true));
|
||||||
$aResult = empty($aResult['data']) ? [] : array_column($aResult['data'], 'icon','issn');
|
// $aResult = empty($aResult['data']) ? [] : array_column($aResult['data'], 'icon','issn');
|
||||||
foreach ($list as $key => $value) {
|
// foreach ($list as $key => $value) {
|
||||||
$list[$key]['journal_icon'] = empty($aResult[$value['issn']]) ? '' : $aResult[$value['issn']];
|
// $list[$key]['journal_icon'] = empty($aResult[$value['issn']]) ? '' : $aResult[$value['issn']];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//获取期刊封面 chengxiaoling 20251027 end
|
// //获取期刊封面 chengxiaoling 20251027 end
|
||||||
return json($list);
|
return json($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4907,7 +4932,7 @@ class Article extends Base
|
|||||||
* @param $article_id
|
* @param $article_id
|
||||||
* @param $user_id
|
* @param $user_id
|
||||||
*/
|
*/
|
||||||
private function messageTips($article_id, $user_id)
|
private function messageTips($article_id, $user_id,$iId = 0)
|
||||||
{
|
{
|
||||||
$article = $this->article_obj->field('t_article.user_id,t_article.editor_id,t_article.accept_sn,t_journal.journal_id,t_journal.title,t_journal.email,t_journal.epassword,t_journal.issn as journal_issn,t_journal.website as journal_website')
|
$article = $this->article_obj->field('t_article.user_id,t_article.editor_id,t_article.accept_sn,t_journal.journal_id,t_journal.title,t_journal.email,t_journal.epassword,t_journal.issn as journal_issn,t_journal.website as journal_website')
|
||||||
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
|
->join('t_journal', 't_journal.journal_id = t_article.journal_id', 'LEFT')
|
||||||
@@ -4916,7 +4941,17 @@ class Article extends Base
|
|||||||
// 判断提交留言人的身份
|
// 判断提交留言人的身份
|
||||||
$res = $this->user_obj->where('user_id', $user_id)->find();
|
$res = $this->user_obj->where('user_id', $user_id)->find();
|
||||||
if ($res['type'] == 1) { // 作者 - 修改author_act,并发送给编辑发邮件
|
if ($res['type'] == 1) { // 作者 - 修改author_act,并发送给编辑发邮件
|
||||||
$this->article_obj->where('article_id', $article_id)->update(['author_act' => 1]);
|
|
||||||
|
// $this->article_obj->where('article_id', $article_id)->update(['author_act' => 1]);
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$aUpdate = ['is_user_act' => 1,'user_update_time' => time(),'author_act' => 1];
|
||||||
|
$this->article_obj->where('article_id', $article_id)->limit(1)->update($aUpdate);
|
||||||
|
if(!empty($article_id) && !empty($iId)){
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$aUserLog = ['article_id' => $article_id,'type' => 6,'act_id' => $iId,'user_id' => $user_id,'content' => 'Author\'s new message submission'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
$journal_info = $this->journal_obj->where("journal_id", $article['journal_id'])->find();
|
$journal_info = $this->journal_obj->where("journal_id", $article['journal_id'])->find();
|
||||||
$editor = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
$editor = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
||||||
// 发邮件
|
// 发邮件
|
||||||
|
|||||||
@@ -73,7 +73,13 @@ class Finalreview extends Base
|
|||||||
//参数组装
|
//参数组装
|
||||||
$aWhere = ['reviewer_id' => $iReviewerId];
|
$aWhere = ['reviewer_id' => $iReviewerId];
|
||||||
if(isset($aParam['state'])){
|
if(isset($aParam['state'])){
|
||||||
$aWhere['state'] = $aParam['state'];
|
$iState = $aParam['state'];
|
||||||
|
if($iState != ''){
|
||||||
|
$aState = is_string($iState) ? explode(',', $iState) : $iState;
|
||||||
|
$aWhere['state'] = ['in',$aState];
|
||||||
|
}else{
|
||||||
|
$aWhere['state'] = $iState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//组装sql
|
//组装sql
|
||||||
@@ -105,7 +111,7 @@ class Finalreview extends Base
|
|||||||
$sOrder = empty($aParam['order']) ? 'id desc' : $aParam['order'];//排序
|
$sOrder = empty($aParam['order']) ? 'id desc' : $aParam['order'];//排序
|
||||||
$aLists = Db::table("({$sFinalQuery}) finalquery")
|
$aLists = Db::table("({$sFinalQuery}) finalquery")
|
||||||
->join('t_article', 'finalquery.article_id = t_article.article_id')
|
->join('t_article', 'finalquery.article_id = t_article.article_id')
|
||||||
->field('finalquery.*,t_article.accept_sn,t_article.title,t_article.type as article_type,t_article.keywords,t_article.scoring,t_article.manuscirpt_url,t_article.state as article_state,t_article.journal_id')
|
->field('finalquery.*,t_article.accept_sn,t_article.title,t_article.type as article_type,t_article.keywords,t_article.scoring,t_article.manuscirpt_url,t_article.state as article_state,t_article.journal_id,finalquery.invited_time,t_article.abstrart')
|
||||||
->where($aWhere)
|
->where($aWhere)
|
||||||
->order($sOrder)
|
->order($sOrder)
|
||||||
->page($iPage, $iSize)
|
->page($iPage, $iSize)
|
||||||
@@ -405,12 +411,24 @@ class Finalreview extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
//数据库更新
|
//数据库更新
|
||||||
|
Db::startTrans();
|
||||||
$aWhere = ['id' => $iId];
|
$aWhere = ['id' => $iId];
|
||||||
$result = Db::name('article_reviewer_final')->where($aWhere)->limit(1)->update($aUpdate);
|
$result = Db::name('article_reviewer_final')->where($aWhere)->limit(1)->update($aUpdate);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
return json_encode(['status' => 8,'msg' => "Review failed"]);
|
return json_encode(['status' => 8,'msg' => "Review failed"]);
|
||||||
}
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$aUpdate = ['is_user_act' => 1,'user_update_time' => time()];
|
||||||
|
$aArticleWhere = ['article_id' => $iArticleId];
|
||||||
|
$article_result = Db::name('article')->where($aArticleWhere)->limit(1)->update($aUpdate);
|
||||||
|
if($article_result === false){
|
||||||
|
return json_encode(['status' => 8,'msg' => "User operation status update failed"]);
|
||||||
|
}
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$aUserLog = ['article_id' => $iArticleId,'type' => 3,'act_id' => $iId,'user_id' => $iReviewerId,'content' => 'Final review completed'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
Db::commit();
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
//发送邮件
|
//发送邮件
|
||||||
if(in_array($iState, [1,2,3])){//有审核结果发送邮件提醒编辑
|
if(in_array($iState, [1,2,3])){//有审核结果发送邮件提醒编辑
|
||||||
//查询文章所属期刊
|
//查询文章所属期刊
|
||||||
@@ -1053,7 +1071,7 @@ class Finalreview extends Base
|
|||||||
return json_encode(['status' => 2,'msg' => 'Please select a article']);
|
return json_encode(['status' => 2,'msg' => 'Please select a article']);
|
||||||
}
|
}
|
||||||
//查询文章审稿记录
|
//查询文章审稿记录
|
||||||
$aWhere = ['article_id' => $iArticleId,'state' => ['between',[1,3]]];
|
$aWhere = ['article_id' => $iArticleId,'state' => ['in',[0,1,2,3]]];
|
||||||
$aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,state,ctime,reviewer_id')->where($aWhere)->select();
|
$aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,state,ctime,reviewer_id')->where($aWhere)->select();
|
||||||
if(!empty($aArticleReviewer)){
|
if(!empty($aArticleReviewer)){
|
||||||
$aArtRevId = array_column($aArticleReviewer, 'art_rev_id');
|
$aArtRevId = array_column($aArticleReviewer, 'art_rev_id');
|
||||||
@@ -1089,7 +1107,7 @@ class Finalreview extends Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//查询终审-审稿记录
|
//查询终审-审稿记录
|
||||||
$aWhere = ['article_id' => $iArticleId,'state' => ['in',[1,2,3]]];
|
$aWhere = ['article_id' => $iArticleId,'state' => ['in',[0,1,2,3,4,5]]];
|
||||||
$aReviewerFinal = Db::name('article_reviewer_final')->field('id,state,suggest_for_editor,suggest_for_author,update_time,reviewer_id,is_anonymous')->where($aWhere)->select();
|
$aReviewerFinal = Db::name('article_reviewer_final')->field('id,state,suggest_for_editor,suggest_for_author,update_time,reviewer_id,is_anonymous')->where($aWhere)->select();
|
||||||
if(!empty($aReviewerFinal)){
|
if(!empty($aReviewerFinal)){
|
||||||
//查询作者信息
|
//查询作者信息
|
||||||
@@ -1131,10 +1149,13 @@ class Finalreview extends Base
|
|||||||
}
|
}
|
||||||
//查询审稿记录
|
//查询审稿记录
|
||||||
$aWhere = ['reviewer_id' => $iReviewerId,'id' => $iId];
|
$aWhere = ['reviewer_id' => $iReviewerId,'id' => $iId];
|
||||||
$aReviewerFinal = Db::name('article_reviewer_final')->field('id,article_id,state,reviewer_id')->where($aWhere)->find();
|
$aReviewerFinal = Db::name('article_reviewer_final')->where($aWhere)->find();
|
||||||
if(empty($aReviewerFinal)){
|
if(empty($aReviewerFinal)){
|
||||||
return json_encode(['status' => 3,'msg' => 'Review record does not exist or review has been completed']);
|
return json_encode(['status' => 3,'msg' => 'Review record does not exist or review has been completed']);
|
||||||
}
|
}
|
||||||
|
$aWhere = ['user_id' => $iReviewerId];
|
||||||
|
$aUser = Db::name('user')->field('realname')->where($aWhere)->find();
|
||||||
|
$aReviewerFinal['realname'] = empty($aUser['realname']) ? '' : $aUser['realname'];
|
||||||
return json_encode(['status' => 1,'msg' => 'success','data' => $aReviewerFinal]);
|
return json_encode(['status' => 1,'msg' => 'success','data' => $aReviewerFinal]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1170,7 +1191,7 @@ class Finalreview extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取文章记录
|
//获取文章记录
|
||||||
$aWhere = ['article_id' => $iArticleId,'state' => 0,'state_to' => ['in',[0,4,5]]];
|
$aWhere = ['article_id' => $iArticleId,'state' => 0,'state_to' => ['in',[0,1,5]]];
|
||||||
$aArticleMsg = Db::name('article_msg')->field('state_from,state_to,ctime')->where($aWhere)->order('ctime deac')->select();
|
$aArticleMsg = Db::name('article_msg')->field('state_from,state_to,ctime')->where($aWhere)->order('ctime deac')->select();
|
||||||
if(!empty($aArticleMsg)){
|
if(!empty($aArticleMsg)){
|
||||||
$iReceivedTime = $iRevisionTime = $iAcceptedTime = 0;
|
$iReceivedTime = $iRevisionTime = $iAcceptedTime = 0;
|
||||||
@@ -1178,7 +1199,7 @@ class Finalreview extends Base
|
|||||||
if(empty($iReceivedTime) && $value['state_to'] == 0){
|
if(empty($iReceivedTime) && $value['state_to'] == 0){
|
||||||
$iReceivedTime = $value['ctime'];
|
$iReceivedTime = $value['ctime'];
|
||||||
}
|
}
|
||||||
if(empty($iRevisionTime) && $value['state_to'] == 4){
|
if(empty($iRevisionTime) && $value['state_to'] == 1){
|
||||||
$iRevisionTime = $value['ctime'];
|
$iRevisionTime = $value['ctime'];
|
||||||
}
|
}
|
||||||
if(empty($iAcceptedTime) && $value['state_to'] == 5){
|
if(empty($iAcceptedTime) && $value['state_to'] == 5){
|
||||||
|
|||||||
@@ -945,11 +945,32 @@ class Reviewer extends Base
|
|||||||
$insert_data['is_anonymous'] = isset($data['is_anonymous']) ? $data['is_anonymous'] : 0;
|
$insert_data['is_anonymous'] = isset($data['is_anonymous']) ? $data['is_anonymous'] : 0;
|
||||||
if ($data['rev_qu_id'] == '') { //新增
|
if ($data['rev_qu_id'] == '') { //新增
|
||||||
$insert_data['ctime'] = time();
|
$insert_data['ctime'] = time();
|
||||||
$res = $this->article_reviewer_question_obj->insert($insert_data);
|
$res = $this->article_reviewer_question_obj->insertGetId($insert_data);
|
||||||
} else { //更新
|
} else { //更新
|
||||||
$res = $this->article_reviewer_question_obj->where('rev_qu_id', $data['rev_qu_id'])->update($insert_data);
|
$res = $this->article_reviewer_question_obj->where('rev_qu_id', $data['rev_qu_id'])->update($insert_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$iArticleId = empty($art_rev_info['article_id']) ? 0 : $art_rev_info['article_id'];
|
||||||
|
if(!empty($iArticleId)){
|
||||||
|
//更新状态
|
||||||
|
$aUpdate = ['is_user_act' => 1,'user_update_time' => time()];
|
||||||
|
$aArticleWhere = ['article_id' => $iArticleId];
|
||||||
|
$article_result = Db::name('article')->where($aArticleWhere)->limit(1)->update($aUpdate);
|
||||||
|
//用户操作日志
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$iActId = empty($data['rev_qu_id']) ? 0 : $data['rev_qu_id'];
|
||||||
|
if(empty($iActId)){
|
||||||
|
$iActId = empty($res) ? 0 : $res;
|
||||||
|
}
|
||||||
|
if(!empty($iActId)){
|
||||||
|
$aUserLog = ['article_id' => $iArticleId,'type' => 1,'act_p_id' => empty($art_rev_info['art_rev_id']) ? 0 : $art_rev_info['art_rev_id'],'act_id' => $iActId,'user_id' => empty($art_rev_info['reviewer_id']) ? 0 : $art_rev_info['reviewer_id'],'content' => 'The initial review of the manuscript has been completed'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
|
|
||||||
//根据recommend问题,改变此实例的状态,并且更改act消息提醒状态
|
//根据recommend问题,改变此实例的状态,并且更改act消息提醒状态
|
||||||
if ($data['recommend'] == 1) {
|
if ($data['recommend'] == 1) {
|
||||||
$artrevstate = 3;
|
$artrevstate = 3;
|
||||||
@@ -1110,6 +1131,24 @@ class Reviewer extends Base
|
|||||||
$this->article_reviewer_obj->where("art_rev_id",$repeat_info['art_rev_id'])->update(['state'=>$state]);
|
$this->article_reviewer_obj->where("art_rev_id",$repeat_info['art_rev_id'])->update(['state'=>$state]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$iArticleId = empty($art_info['article_id']) ? 0 : $art_info['article_id'];
|
||||||
|
if(!empty($iArticleId)){
|
||||||
|
//更新状态
|
||||||
|
$aUpdate = ['is_user_act' => 1,'user_update_time' => time()];
|
||||||
|
$aArticleWhere = ['article_id' => $iArticleId];
|
||||||
|
$article_result = Db::name('article')->where($aArticleWhere)->limit(1)->update($aUpdate);
|
||||||
|
//用户操作日志
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$iActId = empty($data['art_rev_rep_id']) ? 0 : $data['art_rev_rep_id'];
|
||||||
|
if(!empty($iActId)){
|
||||||
|
$aUserLog = ['article_id' => $iArticleId,'type' => 2,'act_p_id' => empty($repeat_info['art_rev_id']) ? 0 : $repeat_info['art_rev_id'],'act_id' => $iActId,'user_id' => empty($art_info['reviewer_id']) ? 0 : $art_info['reviewer_id'],'content' => 'Manuscript review completed'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
|
|
||||||
//复审后发送邮件
|
//复审后发送邮件
|
||||||
|
|
||||||
//增加usermsg
|
//增加usermsg
|
||||||
@@ -2607,10 +2646,30 @@ class Reviewer extends Base
|
|||||||
$rev_qu_id = empty($data['rev_qu_id']) ? 0 : $data['rev_qu_id'];
|
$rev_qu_id = empty($data['rev_qu_id']) ? 0 : $data['rev_qu_id'];
|
||||||
if (empty($rev_qu_id)) { //新增
|
if (empty($rev_qu_id)) { //新增
|
||||||
$insert_data['ctime'] = time();
|
$insert_data['ctime'] = time();
|
||||||
$res = $this->article_reviewer_question_obj->insert($insert_data);
|
$res = $this->article_reviewer_question_obj->insertGetId($insert_data);
|
||||||
} else { //更新
|
} else { //更新
|
||||||
$res = $this->article_reviewer_question_obj->where('rev_qu_id', $rev_qu_id)->update($insert_data);
|
$res = $this->article_reviewer_question_obj->where('rev_qu_id', $rev_qu_id)->update($insert_data);
|
||||||
}
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling start 20251113
|
||||||
|
$iArticleId = empty($art_rev_info['article_id']) ? 0 : $art_rev_info['article_id'];
|
||||||
|
if(!empty($iArticleId)){
|
||||||
|
//更新状态
|
||||||
|
$aUpdate = ['is_user_act' => 1,'user_update_time' => time()];
|
||||||
|
$aArticleWhere = ['article_id' => $iArticleId];
|
||||||
|
$article_result = Db::name('article')->where($aArticleWhere)->limit(1)->update($aUpdate);
|
||||||
|
//用户操作日志
|
||||||
|
$oUserActLog = new \app\common\UserActLog;
|
||||||
|
$iActId = empty($data['rev_qu_id']) ? 0 : $data['rev_qu_id'];
|
||||||
|
if(empty($iActId)){
|
||||||
|
$iActId = empty($res) ? 0 : $res;
|
||||||
|
}
|
||||||
|
if(!empty($iActId)){
|
||||||
|
$aUserLog = ['article_id' => $iArticleId,'type' => 1,'act_p_id' => empty($art_rev_info['art_rev_id']) ? 0 : $art_rev_info['art_rev_id'],'act_id' => $iActId,'user_id' => empty($art_rev_info['reviewer_id']) ? 0 : $art_rev_info['reviewer_id'],'content' => 'The initial review of the manuscript has been completed'];
|
||||||
|
$aAddResult = $oUserActLog->addLog($aUserLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//更新文章用户最新操作状态 chengxiaoling end 20251113
|
||||||
|
|
||||||
//根据recommend问题,改变此实例的状态,并且更改act消息提醒状态
|
//根据recommend问题,改变此实例的状态,并且更改act消息提醒状态
|
||||||
$artrevstate = 2;
|
$artrevstate = 2;
|
||||||
|
|||||||
403
application/api/controller/Workbench.php
Normal file
403
application/api/controller/Workbench.php
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
use app\api\controller\Base;
|
||||||
|
use think\Db;
|
||||||
|
/**
|
||||||
|
* @title 文章机构管理
|
||||||
|
*/
|
||||||
|
class Workbench extends Base
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(\think\Request $request = null) {
|
||||||
|
parent::__construct($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章列表
|
||||||
|
*/
|
||||||
|
public function lists(){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||||
|
|
||||||
|
//获取账号
|
||||||
|
$sAccount = empty($aParam['account']) ? '' : $aParam['account'];
|
||||||
|
if(empty($sAccount)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Please enter your account']);
|
||||||
|
}
|
||||||
|
//查询用户是否存在
|
||||||
|
$aWhere = ['account' => $sAccount,'state' => 0];
|
||||||
|
$aUser = Db::name('user')->field('user_id')->where($aWhere)->find();
|
||||||
|
$iUserId = empty($aUser['user_id']) ? 0: $aUser['user_id'];
|
||||||
|
if(empty($iUserId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Account does not exist']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取状态
|
||||||
|
$iState = isset($aParam['state']) ? $aParam['state'] : -2;
|
||||||
|
//空的查询条件
|
||||||
|
$aWhere = [];
|
||||||
|
//SN
|
||||||
|
$sAcceptSn = empty($aParam['accept_sn']) ? '': $aParam['accept_sn'];
|
||||||
|
if(!empty($sAcceptSn)){
|
||||||
|
$aWhere = ['accept_sn' => trim($sAcceptSn)];
|
||||||
|
}
|
||||||
|
//标题
|
||||||
|
$sTitle = empty($aParam['title']) ? '': $aParam['title'];
|
||||||
|
if(!empty($sTitle)){
|
||||||
|
$aWhere = ['title' => trim($sTitle)];
|
||||||
|
}
|
||||||
|
//国家
|
||||||
|
$sCountry = -1;
|
||||||
|
if(empty($sAcceptSn) && empty($sTitle)){
|
||||||
|
//获取期刊ID
|
||||||
|
$iJournalId = empty($aParam['journal_id']) ? 0: $aParam['journal_id'];
|
||||||
|
//查询账号所管理的期刊
|
||||||
|
$aJournalWhere = ['editor_id' => $iUserId,'state' => 0];
|
||||||
|
$aJournalId = DB::name('journal')->where($aJournalWhere)->column('journal_id');
|
||||||
|
if(empty($iJournalId) && empty($aJournalId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'No journals managed by this account were found']);
|
||||||
|
}
|
||||||
|
if(!empty($iJournalId) && empty($aJournalId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'This account cannot view articles under the selected journal']);
|
||||||
|
}
|
||||||
|
if(!empty($iJournalId) && !empty($aJournalId)){
|
||||||
|
if(!in_array($iJournalId, $aJournalId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'This account cannot view articles under the selected journal']);
|
||||||
|
}
|
||||||
|
$aWhere['journal_id'] = $iJournalId;
|
||||||
|
}
|
||||||
|
if(empty($iJournalId) && !empty($aJournalId)){//期刊ID
|
||||||
|
$aWhere['journal_id'] = ['in',$aJournalId];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($iState >= 0){
|
||||||
|
$aWhere['state'] = $iState;
|
||||||
|
}else{
|
||||||
|
$aWhere['state'] = ['in',[0,1,2,4,6,7,8]];
|
||||||
|
}
|
||||||
|
//国家
|
||||||
|
$sCountry = empty($aParam['country']) ? 0 : $aParam['country'];
|
||||||
|
}
|
||||||
|
//获取分页相关参数
|
||||||
|
$iSize = empty($aParam['size']) ? 15 : $aParam['size'];//每页显示条数
|
||||||
|
$iPage = empty($aParam['page']) ? 1 : $aParam['page'];// 当前页码
|
||||||
|
|
||||||
|
//统计数量
|
||||||
|
$sAuthorQuery = '';
|
||||||
|
$aAuthorWhere = [];
|
||||||
|
if($sCountry == 1){
|
||||||
|
$aAuthorWhere = ['state' => 0, 'country' => 'China'];
|
||||||
|
}
|
||||||
|
if($sCountry == 2){
|
||||||
|
$aAuthorWhere = ['state' => 0, 'country' => ['<>','China']];
|
||||||
|
}
|
||||||
|
if(!empty($aAuthorWhere)){
|
||||||
|
$sAuthorQuery = Db::name('article_author')->field('DISTINCT article_id')->where($aAuthorWhere)->buildSql();
|
||||||
|
}
|
||||||
|
if(empty($sAuthorQuery)){
|
||||||
|
$iCount = Db::name('article')->where($aWhere)->count();
|
||||||
|
}
|
||||||
|
if(!empty($sAuthorQuery)){
|
||||||
|
$iCount = Db::name('article')->where($aWhere)
|
||||||
|
->join(Db::raw("({$sAuthorQuery}) article_author"),'article_author.article_id = t_article.article_id')
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
if(empty($iCount)){
|
||||||
|
return json_encode(['status' => 1,'msg' => 'Article 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' => []]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sField = 't_article.article_id,t_article.journal_id,t_article.accept_sn,t_article.title,t_article.type,t_article.scoring,t_article.h_fen,t_article.b_fen,t_article.c_fen,t_article.dw_fen,t_article.ly_fen,t_article.jj_fen,t_article.remarks,t_article.special_num,t_article.is_user_act,t_article.user_update_time,t_article.state,t_article.repetition,t_article.is_buy';
|
||||||
|
$sOrder = 't_article.is_user_act asc,t_article.user_update_time desc,t_article.article_id desc';
|
||||||
|
if(empty($sAuthorQuery)){
|
||||||
|
$aArticle = Db::name('article')
|
||||||
|
->field($sField)
|
||||||
|
->where($aWhere)
|
||||||
|
->page($iPage, $iSize)
|
||||||
|
->order($sOrder)
|
||||||
|
->select();
|
||||||
|
}
|
||||||
|
if(!empty($sAuthorQuery)){
|
||||||
|
$aArticle = Db::name('article')
|
||||||
|
->field($sField)
|
||||||
|
->where($aWhere)
|
||||||
|
->join(Db::raw("({$sAuthorQuery}) article_author"),'article_author.article_id = t_article.article_id')
|
||||||
|
->page($iPage, $iSize)
|
||||||
|
->order($sOrder)
|
||||||
|
->select();
|
||||||
|
}
|
||||||
|
if(empty($aArticle)){
|
||||||
|
return json_encode(['status' => 1,'msg' => 'Data is empty']);
|
||||||
|
}
|
||||||
|
//查询通讯作者
|
||||||
|
$aAuthorData = [];
|
||||||
|
$aArticleId = array_column($aArticle, 'article_id');
|
||||||
|
$aWhere = ['article_id' => ['in',$aArticleId],'state' => 0,'is_report' => 1,'email' => ['<>','']];
|
||||||
|
if($sCountry == 1){
|
||||||
|
$aWhere['country'] = 'China';
|
||||||
|
}
|
||||||
|
if($sCountry == 2){
|
||||||
|
$aWhere['country'] = ['<>','China'];
|
||||||
|
}
|
||||||
|
$aAuthor = Db::name('article_author')->field('art_aut_id,article_id,email,country')->where($aWhere)->select();
|
||||||
|
if(!empty($aAuthor)){
|
||||||
|
$aEmail = array_unique(array_column($aAuthor, 'email'));
|
||||||
|
if(!empty($aEmail)){
|
||||||
|
$aWhere = ['email' => ['in',$aEmail],'state' => 0];
|
||||||
|
$aUser = Db::name('user')->field('user_id,realname,phone,email,wos_index,scopus_index,wos_time,scopus_time')->where($aWhere)->select();
|
||||||
|
$aUser = empty($aUser) ? [] : array_column($aUser, null,'email');
|
||||||
|
}
|
||||||
|
|
||||||
|
//数据处理
|
||||||
|
foreach ($aAuthor as $key => $value) {
|
||||||
|
if(!empty($value['country'])){
|
||||||
|
$aCountry[$value['article_id']][] = trim($value['country']);
|
||||||
|
}
|
||||||
|
if(!empty($aUser[$value['email']])){
|
||||||
|
$value += $aUser[$value['email']];
|
||||||
|
}
|
||||||
|
$aAuthorData[$value['article_id']][] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//预接收查询文章的付费状态
|
||||||
|
// if($iState == 6){
|
||||||
|
// $aWhere = ['article_id' => ['in',$aArticleId]];
|
||||||
|
// $aOrder = Db::name('order')->where($aWhere)->column('article_id,ps_id');
|
||||||
|
// $aPsId = empty($aOrder) ? [] : array_values($aOrder);
|
||||||
|
// if(!empty($aPsId)){
|
||||||
|
// $aWhere = ['ps_id' => ['in',$aPsId]];
|
||||||
|
// $aPaystation = Db::name('paystation')->field('ps_id,request_time pay_time,amount pay_mount')->where($aWhere)->select();
|
||||||
|
// $aPaystation = empty($aPaystation) ? [] : array_column($aPaystation, null,'ps_id');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
foreach ($aArticle as $key => $value) {
|
||||||
|
$aAuthorInfo = empty($aAuthorData[$value['article_id']]) ? [] : $aAuthorData[$value['article_id']];
|
||||||
|
$aArticle[$key]['report'] = $aAuthorInfo;
|
||||||
|
$aArticle[$key]['country'] = empty($aAuthorInfo) ? [] : array_unique(array_column($aAuthorInfo, 'country'));
|
||||||
|
$aArticle[$key]['type_name'] = translateType($value['type']);
|
||||||
|
|
||||||
|
// //付款信息
|
||||||
|
// $iPsId = empty($aOrder[$value['article_id']]) ? 0 : $aOrder[$value['article_id']];
|
||||||
|
// $aArticle[$key]['pay_time'] = empty($aPaystation[$iPsId]['pay_time']) ? '' : $aPaystation[$iPsId]['pay_time'];
|
||||||
|
// $aArticle[$key]['pay_mount'] = empty($aPaystation[$iPsId]['pay_mount']) ? '' : $aPaystation[$iPsId]['pay_mount'];
|
||||||
|
}
|
||||||
|
return json_encode(['status' => 1,'msg' => 'success','data' => ['total' => $iCount,'lists' => $aArticle]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章详情
|
||||||
|
*/
|
||||||
|
public function get($aParam = []){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||||
|
|
||||||
|
//获取文章ID
|
||||||
|
$iArticleId = empty($aParam['article_id']) ? 0 : $aParam['article_id'];
|
||||||
|
//SN
|
||||||
|
$sAcceptSn = empty($aParam['accept_sn']) ? '': $aParam['accept_sn'];
|
||||||
|
if(empty($iArticleId) && empty($sAcceptSn)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Please select the article']);
|
||||||
|
}
|
||||||
|
//获取账号
|
||||||
|
$sAccount = empty($aParam['account']) ? '' : $aParam['account'];
|
||||||
|
if(empty($sAccount)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Please enter your account']);
|
||||||
|
}
|
||||||
|
//查询用户是否存在
|
||||||
|
$aWhere = ['account' => $sAccount,'state' => 0];
|
||||||
|
$aUser = Db::name('user')->field('user_id')->where($aWhere)->find();
|
||||||
|
if(empty($aUser)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Account does not exist']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询条件
|
||||||
|
$aWhere = [];
|
||||||
|
if(!empty($iArticleId)){
|
||||||
|
$aWhere['article_id'] = $iArticleId;
|
||||||
|
}
|
||||||
|
if(!empty($sAcceptSn)){
|
||||||
|
$aWhere['accept_sn'] = $sAcceptSn;
|
||||||
|
}
|
||||||
|
|
||||||
|
$aArticle = Db::name('article')->where($aWhere)->find();
|
||||||
|
if(!empty($aArticle)){
|
||||||
|
$aArticle['act_user_id'] = empty($aUser['user_id']) ? 0 : $aUser['user_id'];
|
||||||
|
}
|
||||||
|
return json_encode(['status' => 1,'msg' => 'success','data' => $aArticle]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取文章审稿记录
|
||||||
|
*/
|
||||||
|
public function getArticleReviewRecord($aParam = []){
|
||||||
|
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||||
|
//获取文章信息
|
||||||
|
$aArticle = json_decode($this->get($aParam),true);
|
||||||
|
$iStatus = empty($aArticle['status']) ? 0 : $aArticle['status'];
|
||||||
|
if($iStatus != 1){
|
||||||
|
return json_encode($aArticle);
|
||||||
|
}
|
||||||
|
$aArticle = empty($aArticle['data']) ? [] : $aArticle['data'];
|
||||||
|
if(empty($aArticle)){
|
||||||
|
return json_encode(['status' => 3,'msg' => 'The article does not exist']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询文章审稿记录
|
||||||
|
$iArticleId = empty($aArticle['article_id']) ? 0 : $aArticle['article_id'];
|
||||||
|
$aWhere = ['article_id' => $iArticleId,'state' => ['between',[0,3]]];
|
||||||
|
$aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,state,ctime,reviewer_id')->where($aWhere)->select();
|
||||||
|
if(empty($aArticleReviewer)){
|
||||||
|
return json_encode(['status' => 1,'msg' => 'No review record found for the article']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询初审问卷
|
||||||
|
$aArtRevId = array_column($aArticleReviewer, 'art_rev_id');
|
||||||
|
$aWhere = ['art_rev_id' => ['in',$aArtRevId],'state' => 0];
|
||||||
|
$aQuestion = Db::name('article_reviewer_question')->field('art_rev_id,ctime,score,rated,recommend')->where($aWhere)->order('ctime asc')->select();
|
||||||
|
$aQuestion = empty($aQuestion) ? [] : array_column($aQuestion, null,'art_rev_id');
|
||||||
|
|
||||||
|
//查询复审
|
||||||
|
$aReviewerRepeatLists = [];
|
||||||
|
$aWhere = ['art_rev_id' => ['in',$aArtRevId],'recommend' => ['between',[1,3]]];
|
||||||
|
$aReviewerRepeat = Db::name('article_reviewer_repeat')->field('art_rev_rep_id,art_rev_id,recommend,ctime,stime')->where($aWhere)->select();
|
||||||
|
if(!empty($aReviewerRepeat)){
|
||||||
|
foreach ($aReviewerRepeat as $key => $value) {
|
||||||
|
$aReviewerRepeatLists[$value['art_rev_id']][] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询审稿人信息
|
||||||
|
$aUserId = array_unique(array_column($aArticleReviewer, 'reviewer_id'));
|
||||||
|
$aWhere = ['user_id' => ['in',$aUserId],'state' => 0];
|
||||||
|
$aUser = Db::name('user')->where($aWhere)->column('user_id,realname');
|
||||||
|
foreach ($aArticleReviewer as $key => $value) {
|
||||||
|
$aQuestionData = empty($aQuestion[$value['art_rev_id']]) ? [] : $aQuestion[$value['art_rev_id']];
|
||||||
|
$value['ctime'] = empty($aQuestionData['ctime']) ? $value['ctime'] : $aQuestionData['ctime'];
|
||||||
|
$value['score'] = empty($aQuestionData['score']) ? 0 : $aQuestionData['score'];
|
||||||
|
$value['repeat'] = empty($aReviewerRepeatLists[$value['art_rev_id']]) ? [] : $aReviewerRepeatLists[$value['art_rev_id']];
|
||||||
|
$value['rated'] = empty($aQuestionData['rated']) ? 0 : $aQuestionData['rated'];
|
||||||
|
$value['realname'] = empty($aUser[$value['reviewer_id']]) ? '' : $aUser[$value['reviewer_id']];
|
||||||
|
$value['recommend'] = empty($aQuestionData['recommend']) ? 0 : $aQuestionData['recommend'];
|
||||||
|
$aArticleReviewer[$key] = $value;
|
||||||
|
}
|
||||||
|
return json_encode(['status' => 1,'msg' => 'success','data' => $aArticleReviewer]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
*/
|
||||||
|
public function getCorrespondingInfo(){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||||
|
|
||||||
|
//获取通讯作者ID
|
||||||
|
$iArtAutId = empty($aParam['art_aut_id']) ? 0 : $aParam['art_aut_id'];
|
||||||
|
if(empty($iArtAutId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Please select the user']);
|
||||||
|
}
|
||||||
|
//获取文章ID
|
||||||
|
$iArticleId = empty($aParam['article_id']) ? 0 : $aParam['article_id'];
|
||||||
|
if(empty($iArticleId)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Please select the article']);
|
||||||
|
}
|
||||||
|
$aWhere = ['article_id' => $iArticleId];
|
||||||
|
$aArticle = Db::name('article')->where($aWhere)->find();
|
||||||
|
if(empty($aArticle)){
|
||||||
|
return json_encode(['status' => 3,'msg' => 'The article does not exist']);
|
||||||
|
}
|
||||||
|
//查询通讯作者
|
||||||
|
$aWhere = ['art_aut_id' => $iArtAutId,'article_id' => $iArticleId,'state' => 0,'is_report' => 1,'email' => ['<>','']];
|
||||||
|
$aAuthor = Db::name('article_author')->field('art_aut_id,email,author_title,firstname,lastname,company,country')->where($aWhere)->find();
|
||||||
|
if(empty($aAuthor)){
|
||||||
|
return json_encode(['status' => 4,'msg' => 'Author information not found']);
|
||||||
|
}
|
||||||
|
//获取主信息
|
||||||
|
$sEmail = empty($aAuthor['email']) ? '' : $aAuthor['email'];
|
||||||
|
$aWhere = ['email' => $sEmail,'state' => 0];
|
||||||
|
$aUser = Db::name('user')->field('user_id,realname,phone,email,remark,wos_index,wos_time,g_author,g_website,google_index,google_time,google_editor,scopus_index,scopus_time,scopus_website,scopus_editor')->where($aWhere)->find();
|
||||||
|
if(empty($aUser)){
|
||||||
|
return json_encode(['status' => 1,'msg' => 'User does not exist']);
|
||||||
|
}
|
||||||
|
// //获取附属信息
|
||||||
|
// $iUserId = $aUser['user_id'];
|
||||||
|
// $aWhere = ['reviewer_id' => $iUserId,'state' => 0];
|
||||||
|
// $aUserInfo = Db::name('user_reviewer_info')->field('technical,country,introduction,company,website,field')->where($aWhere)->find();
|
||||||
|
// if(!empty($aUserInfo)){
|
||||||
|
// $aUser += $aUserInfo;
|
||||||
|
// }
|
||||||
|
$aUser += $aAuthor;
|
||||||
|
return json_encode(['status' => 1,'msg' => 'success','data' => ['article' => $aArticle,'user' => $aUser]]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 更新文章是否有新操作状态
|
||||||
|
*/
|
||||||
|
public function updateArticleState(){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? $this->request->post() : $aParam;
|
||||||
|
//主键ID
|
||||||
|
$iActId = empty($aParam['act_id']) ? 0 : $aParam['act_id'];
|
||||||
|
//主键父ID
|
||||||
|
$iActPId = empty($aParam['act_p_id']) ? 0 : $aParam['act_p_id'];
|
||||||
|
//类型
|
||||||
|
$iType = empty($aParam['type']) ? 0 : $aParam['type'];
|
||||||
|
if(empty($iType)){
|
||||||
|
return json_encode(['status' => 2,'msg' => 'Missing parameter']);
|
||||||
|
}
|
||||||
|
$aType = is_string($iType) ? explode(',', $iType) : [$iType];
|
||||||
|
|
||||||
|
//获取文章信息
|
||||||
|
$aArticle = json_decode($this->get($aParam),true);
|
||||||
|
$iStatus = empty($aArticle['status']) ? 0 : $aArticle['status'];
|
||||||
|
if($iStatus != 1){
|
||||||
|
return json_encode($aArticle);
|
||||||
|
}
|
||||||
|
$aArticle = empty($aArticle['data']) ? [] : $aArticle['data'];
|
||||||
|
if(empty($aArticle)){
|
||||||
|
return json_encode(['status' => 3,'msg' => 'The article does not exist']);
|
||||||
|
}
|
||||||
|
$iIsUseAct = empty($aArticle['is_user_act']) ? -1 : $aArticle['is_user_act'];
|
||||||
|
if($iIsUseAct != 1){
|
||||||
|
return json_encode(['status' => 4,'msg' => 'No action required']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//文章ID
|
||||||
|
$iArticleId = empty($aArticle['article_id']) ? 0 : $aArticle['article_id'];
|
||||||
|
|
||||||
|
//查询日志
|
||||||
|
$aLogWhere = ['article_id' => $iArticleId,'type' => ['in',$aType],'is_view' => 2];
|
||||||
|
if(in_array(1, $aType) || in_array(2, $aType)){//初审/复审
|
||||||
|
$aWhere['act_p_id'] = $iActPId;
|
||||||
|
}
|
||||||
|
if(in_array(3, $aType)){//终审
|
||||||
|
$aWhere['act_id'] = $iActId;
|
||||||
|
}
|
||||||
|
$aLog = Db::name('user_act_log')->field('log_id')->where($aLogWhere)->find();
|
||||||
|
if(empty($aLog)){
|
||||||
|
return json_encode(['status' => 5,'msg' => 'log does not exist']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新状态
|
||||||
|
Db::startTrans();
|
||||||
|
$aLogWhere = ['article_id' => $iArticleId,'is_view' => 2];
|
||||||
|
$aLogUpdate = ['is_view' => 1,'update_time' => time(),'update_user_id' => empty($aArticle['act_user_id']) ? 0 : $aArticle['act_user_id']];
|
||||||
|
$log_update_result = Db::name('user_act_log')->where($aLogWhere)->update($aLogUpdate);
|
||||||
|
if($log_update_result === false){
|
||||||
|
return json_encode(['status' => 5,'msg' => 'Log Update failed']);
|
||||||
|
}
|
||||||
|
$aUpdate = ['is_user_act' => 2,'user_update_time' => 0,'update_time' => time()];
|
||||||
|
$aWhere = ['article_id' => $aArticle['article_id']];
|
||||||
|
$result = Db::name('article')->where($aWhere)->limit(1)->update($aUpdate);
|
||||||
|
if($result === false){
|
||||||
|
return json_encode(['status' => 5,'msg' => 'Update failed']);
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
return json_encode(['status' => 1,'msg' => 'Update successful']);
|
||||||
|
}
|
||||||
|
}
|
||||||
81
application/common/UserActLog.php
Normal file
81
application/common/UserActLog.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\common;
|
||||||
|
use think\Db;
|
||||||
|
class UserActLog
|
||||||
|
{
|
||||||
|
|
||||||
|
private $aField = ['article_id','user_id','act_p_id','act_id','type','content','is_view'];
|
||||||
|
/**
|
||||||
|
* 添加用户操作日志
|
||||||
|
*/
|
||||||
|
public function addLog($aParam = []){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? [] : $aParam;
|
||||||
|
//获取表字段
|
||||||
|
$aField = $this->aField;
|
||||||
|
|
||||||
|
$aInsert = [];
|
||||||
|
foreach ($aField as $key => $value) {
|
||||||
|
if(empty($aParam[$value])){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$aInsert[$value] = $aParam[$value];
|
||||||
|
}
|
||||||
|
//必填参数验证
|
||||||
|
if(empty($aInsert['article_id']) || empty($aInsert['type']) || empty($aInsert['act_id'])){
|
||||||
|
return ['status' => 2, 'msg' => '非法操作'];
|
||||||
|
}
|
||||||
|
$aInsert['create_time'] = time();
|
||||||
|
$result = Db::name('user_act_log')->insertGetId($aInsert);
|
||||||
|
if(empty($result)){
|
||||||
|
return ['status' => 3, 'msg' => '数据插入失败'.Db::getLastSql()."\n数据内容:",'data' => $aParam];
|
||||||
|
}
|
||||||
|
return ['status' => 1, 'msg' => '日志插入成功'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日志
|
||||||
|
*/
|
||||||
|
public function getLog($aParam = []){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? [] : $aParam;
|
||||||
|
//必填参数验证
|
||||||
|
if(empty($aParam['article_id']) || empty($aParam['type']) || empty($aParam['act_id'])){
|
||||||
|
return ['status' => 2, 'msg' => '非法操作'];
|
||||||
|
}
|
||||||
|
$aLog = Db::name('user_act_log')->where($aParam)->find();
|
||||||
|
return ['status' => 1, 'msg' => '获取数据成功','data' => $aLog];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户操作日志
|
||||||
|
*/
|
||||||
|
public function updateLog($aParam = []){
|
||||||
|
//获取参数
|
||||||
|
$aParam = empty($aParam) ? [] : $aParam;
|
||||||
|
//必填参数验证
|
||||||
|
if(empty($aParam['log_id'])){
|
||||||
|
return ['status' => 2, 'msg' => '非法操作'];
|
||||||
|
}
|
||||||
|
//获取表字段
|
||||||
|
$aField = $this->aField;
|
||||||
|
$aUpdate = [];
|
||||||
|
foreach ($aField as $key => $value) {
|
||||||
|
if(empty($aParam[$value])){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$aUpdate[$value] = $aParam[$value];
|
||||||
|
}
|
||||||
|
if(empty($aUpdate)){
|
||||||
|
return ['status' => 2, 'msg' => '更新数据为空'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$aUpdate['update_time'] = time();
|
||||||
|
$aWhere = ['log_id' => $aParam['log_id']];
|
||||||
|
$result = Db::name('user_act_log')->where($aWhere)->limit(1)->update($aInsert);
|
||||||
|
if($result === false){
|
||||||
|
return ['status' => 3, 'msg' => '数据插入更新失败'.Db::getLastSql()."\n数据内容:",'data' => $aParam];
|
||||||
|
}
|
||||||
|
return ['status' => 1, 'msg' => '日志更新成功'];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user