新增方法

This commit is contained in:
chengxl
2025-12-31 15:14:14 +08:00
parent 7de225237d
commit 85d441cc60

View File

@@ -1577,7 +1577,6 @@ class Article extends Base
$update_data['rstime'] = time(); $update_data['rstime'] = time();
} }
$this->article_obj->where($where_article)->update($update_data); $this->article_obj->where($where_article)->update($update_data);
//拒稿或者录用 - 发送审稿意见 //拒稿或者录用 - 发送审稿意见
if ($article_info['journal_id'] == 1 && ($data['state'] == 3 || $data['state'] == 5)) { if ($article_info['journal_id'] == 1 && ($data['state'] == 3 || $data['state'] == 5)) {
$this->sendEmailToReviewer($data['articleId'], $data['state']); $this->sendEmailToReviewer($data['articleId'], $data['state']);
@@ -6241,4 +6240,92 @@ class Article extends Base
} }
return ['status' => 1,'msg' => 'success']; return ['status' => 1,'msg' => 'success'];
} }
/**
* 添加图片版权声明文件-编辑
*/
public function addFigureCopyrightForEditor($aParam = []){
//获取参数
$aParam = empty($aParam) ? $this->request->post() : $aParam;
//获取文章ID
$iArticleId = empty($aParam['article_id']) ? 0 : $aParam['article_id'];
if(empty($iArticleId)){
return json_encode(['status' => 2,'msg' => 'Please select the article']);
}
//用户ID
$iUserId = empty($aParam['user_id']) ? '' : $aParam['user_id'];
if(empty($iUserId)){
return json_encode(['status' => 2,'msg' => 'Please select author']);
}
// //是否上传文件
// $is_figure_copyright = empty($aParam['is_figure_copyright']) ? 3 : $aParam['is_figure_copyright'];
// if($is_figure_copyright == 3){
// return json_encode(['status' => 3,'msg' => 'Please check whether to upload the figure copyright statement']);
// }
//获取操作人信息
$aWhere = ['user_id' => $iUserId,'state' => 0];
$aUser = Db::name('user')->field('account')->where($aWhere)->find();
if(empty($aUser)){
return json_encode(['status' => 5,'msg' => 'No operator information found']);
}
//获取文章信息
$aWhere = ['article_id' => $iArticleId];
$aArticle = Db::name('article')->field('article_id,state,editor_id,journal_id')->where($aWhere)->find();
if(empty($aArticle)){
return json_encode(['status' => 6,'msg' => 'The article does not exist']);
}
//判断是否有权限操作
if($iUserId != $aArticle['editor_id']){
return json_encode(['status' => 7,'msg' => 'Unauthorized operation']);
}
//查询期刊负责编辑
$aWhere = ['journal_id' => $aArticle['journal_id'],'state' => 0];
$aJournal = Db::name('journal')->field('editor_id')->where($aWhere)->find();
if(empty($aJournal)){
return json_encode(['status' => 7,'msg' => 'No article or journal information found']);
}
if($iUserId != $aJournal['editor_id']){
return json_encode(['status' => 7,'msg' => 'No operation permission']);
}
//图片路径
// if($is_figure_copyright == 1){
//文件地址
$sUrl = empty($aParam['url']) ? '' : $aParam['url'];
if(empty($sUrl)){
return json_encode(['status' => 4,'msg' => 'Please choose to upload the file']);
}
// }
//文件类型
$sTypeName = 'figurecopyright';
$sUserAccount = empty($aUser['account']) ? '' : $aUser['account'];
Db::startTrans();
if(!empty($sUrl)){
//验证文件是否上传
$aWhere = ['file_url' => $sUrl,'state' => 0,'article_id' => $iArticleId,'type_name' => $sTypeName];
$result = Db::name('article_file')->where($aWhere)->find();
if(empty($result)){
$aInsert['article_id'] = $iArticleId;
$aInsert['user_id'] = $iUserId;
$aInsert['username'] = $sUserAccount;
$aInsert['file_url'] = $sUrl;
$aInsert['type_name'] = $sTypeName;
$aInsert['ctime'] = time();
$result = Db::name('article_file')->insertGetId($aInsert);
}
}
// //更新文章内容
// $aArticleUpdate = ['is_figure_copyright' => $is_figure_copyright];
// if(!empty($aArticleUpdate)){
// $aWhere = ['article_id' => $iArticleId];
// $update_result = Db::name('article')->where($aWhere)->limit(1)->update($aArticleUpdate);
// }
//操作日志
$aLog = ['article_id' => $iArticleId,'user_id' => $iUserId,'type' => 7,'create_time' => time(),'content' => $sUserAccount . ':Operating the article copyright statement','is_view' => 1];
Db::name('user_act_log')->insert($aLog);
Db::commit();
return json_encode(['status' => 1,'msg' => 'success']);
}
} }