From 5124b4a9708d56705dd3ef0e7bd01dcb9cc6226c Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 10 Mar 2022 17:39:36 +0800 Subject: [PATCH] 20201112 --- application/api/controller/Article.php | 115 +++++++++++++++++++++++++ application/api/controller/User.php | 1 + 2 files changed, 116 insertions(+) diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 28781f7..57a5855 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -30,6 +30,8 @@ class Article extends Controller { protected $major_obj = ""; protected $major_to_journal_obj = ''; protected $reviewer_from_author_obj = ''; + protected $article_dialog_obj = ''; + protected $article_proposal_obj = ''; public function __construct(\think\Request $request = null) { parent::__construct($request); @@ -52,6 +54,8 @@ class Article extends Controller { $this->major_obj = Db::name("major"); $this->major_to_journal_obj = Db::name('major_to_journal'); $this->reviewer_from_author_obj = Db::name("reviewer_from_author"); + $this->article_dialog_obj = Db::name('article_dialog'); + $this->article_proposal_obj = Db::name('article_proposal'); } /** @@ -392,6 +396,94 @@ class Article extends Controller { } } + + /** + * @title 发送留言板消息 + * @description 发送留言板消息 + * @author wangjinlei + * @url /api/Article/pushArticleDialog + * @method POST + * + * @param name:article_id type:int require:1 desc:文章id + * @param name:username type:String require:1 desc:发送者用户名 + * @param name:ad_content type:String require:1 desc:内容 + * + */ + public function pushArticleDialog(){ + $data = $this->request->post(); + $user_info = $this->user_obj->where('account',$data['username'])->find(); + $insert['article_id'] = $data['article_id']; + $insert['user_id'] = $user_info['user_id']; + $insert['ad_content'] = trim($data['ad_content']); + $insert['ad_ctime'] = time(); + $this->article_dialog_obj->insert($insert); + return jsonSuccess([]); + } + + /** + * @title 获取留言板消息列表 + * @description 获取留言板消息列表 + * @author wangjinlei + * @url /api/Article/getArticleDialogs + * @method POST + * + * @param name:article_id type:int require:1 desc:文章id + * + * @return dialogs:消息列表@ + * @dialogs ad_id:主键 article_id:文章id user_id:用户id username:用户名 ad_content:消息 ad_time:时间 ad_state:状态 + * + */ + public function getArticleDialogs(){ + $data = $this->request->post(); + $list = $this->article_dialog_obj + ->field("t_article_dialog.*,t_user.account username") + ->join("t_user","t_user.user_id = t_article_dialog.user_id","left") + ->where("t_article_dialog.article_id",$data['article_id']) + ->where('t_article_dialog.ad_state',0) + ->select(); + + $re['dialogs'] = $list; + return jsonSuccess($re); + } + + /** + * @title 添加修回页修回意见(编辑) + * @description 添加修回页修回意见(编辑) + * @author wangjinlei + * @url /api/Article/addArticleProposal + * @method POST + * + * @param name:article_id type:int require:1 desc:文章id + * @param name:proposal_file type:String require:1 desc:文件地址 + * + */ + public function addArticleProposal(){ + $data = $this->request->post(); + $insert['article_id'] = $data['article_id']; + $insert['proposal_file'] = trim($data['proposal_file']); + $insert['ap_ctime'] = time(); + $this->article_proposal_obj->insert($insert); + return jsonSuccess([]); + } + + /** + * @title 获取修回页修回意见列表 + * @description 获取修回页修回意见列表 + * @author wangjinlei + * @url /api/Article/getArticleProposals + * @method POST + * + * @param name:article_id type:int require:1 desc:文章id + * + * @return proposals:意见列表@ + * @proposals proposal_id:主键 proposal_file:文件地址 ap_ctime:添加时间 + */ + public function getArticleProposals(){ + $data = $this->request->post(); + $list = $this->article_proposal_obj->where('article_id',$data['article_id'])->where('ap_state',0)->select(); + $re['proposals'] = $list; + return jsonSuccess($re); + } /** * 修改文章的作者(作者) @@ -1250,6 +1342,29 @@ class Article extends Controller { } } } + + /** + * @title 上传编辑修回意见文件 + * @description 上传编辑修回意见文件 + * @author wangjinlei + * @url /api/Article/up_proposal_file + * @method POST + * + * @param name:name type:string require:1 default:articleProposal desc:文件域名称 + * + * @return upurl:图片地址 + */ + public function up_proposal_file() { + $file = request()->file('articleProposal'); + if ($file) { + $info = $file->move(ROOT_PATH . 'public' . DS . 'articleProposal'); + if ($info) { + return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]); + } else { + return json(['code' => 1, 'msg' => $file->getError()]); + } + } + } /** * 获取文章审稿实例列表 diff --git a/application/api/controller/User.php b/application/api/controller/User.php index f9fa502..eccd026 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -729,6 +729,7 @@ class User extends Controller { if($has_res){ $check = $this->reviewer_to_journal_obj->where('reviewer_id',$has_res['user_id'])->where('journal_id',$journal_info['journal_id'])->where('state',0)->find(); if($check){ + $this->user_reviewer_obj->where($where)->update(['state'=>1]); return jsonError("has reviewer!"); } }