diff --git a/application/api/controller/Base.php b/application/api/controller/Base.php index 60f5af5..0478339 100644 --- a/application/api/controller/Base.php +++ b/application/api/controller/Base.php @@ -82,6 +82,8 @@ class Base extends Controller protected $article_main_image_obj = ""; protected $article_main_table_obj = ''; protected $order_obj = ""; + protected $article_main_log_obj = ""; + protected $article_main_check_obj = ""; public function __construct(\think\Request $request = null) @@ -159,6 +161,8 @@ class Base extends Controller $this->article_main_image_obj = Db::name("article_main_image"); $this->article_main_table_obj = Db::name("article_main_table"); $this->order_obj = Db::name("order"); + $this->article_main_log_obj = Db::name("article_main_log"); + $this->article_main_check_obj = Db::name("article_main_check"); } diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php index 37840f6..008926b 100644 --- a/application/api/controller/Preaccept.php +++ b/application/api/controller/Preaccept.php @@ -433,7 +433,11 @@ class Preaccept extends Base } - + /**添加文章主体内容的备注(马上废弃) + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\exception\PDOException + */ public function addMainsRemark(){ $data = $this->request->post(); $rule = new Validate([ @@ -450,6 +454,159 @@ class Preaccept extends Base } + /**编辑发布文章正文更改意见 + * @return \think\response\Json + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public function createArticleMainCheckForEditor(){ + $data = $this->request->post(); + $rule = new Validate([ + "article_id"=>"require", + "am_id"=>"require", + "content"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find(); + if(!$am_info){ + return jsonError("am state error"); + } + $insert['article_id'] = $data['article_id']; + $insert['am_id'] = $data['am_id']; + if(isset($data['remark'])&&$data['remark']!=""){ + $insert["remark"] = $data['remark']; + } + $insert["content"] = $data['content']; + $insert['ctime'] = time(); + $this->article_main_check_obj->insert($insert); + return jsonSuccess([]); + } + + /**编辑整改信息备注 + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\exception\PDOException + */ + public function editArticleMainCheck(){ + $data = $this->request->post(); + $rule = new Validate([ + "amc_id"=>"require", + "remark"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $amc_info = $this->article_main_check_obj->where("amc_id",$data['amc_id'])->find(); + if($amc_info['estate']==1){ + return jsonError("The author has completed"); + } + + $this->article_main_check_obj->where("amc_id",$data['amc_id'])->update(['remark'=>$data['remark']]); + return jsonSuccess([]); + } + + /**作者标记完成整改条目 + * @return void + */ + public function completeArticleMainCheckForAuthor(){ + $data = $this->request->post(); + $rule = new Validate([ + "amc_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $this->article_main_check_obj->where("amc_id",$data['amc_id'])->update(['estate'=>1]); + return jsonSuccess([]); + } + + /**作者驳回整改条目 + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\exception\PDOException + */ + public function rejectArticleMainCheckForAuthor(){ + $data = $this->request->post(); + $rule = new Validate([ + "amc_id"=>"require", + "author_remark"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $this->article_main_check_obj->where("amc_id",$data['amc_id'])->update(['author_remark'=>$data['author_remark']]); + return jsonSuccess([]); + } + + /**编辑驳回作者的修复 + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\exception\PDOException + */ + public function rejectArticleMainCheckForEditor(){ + $data = $this->request->post(); + $rule = new Validate([ + "amc_id"=>"require", + "remark"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $this->article_main_check_obj->where("amc_id",$data['amc_id'])->update(['remark'=>$data['remark'],"estate"=>0]); + return jsonSuccess([]); + } + + /**删除文章全文校对 + * @return \think\response\Json + * @throws \think\Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + * @throws \think\exception\PDOException + */ + public function delArticleMainCheckForEditor(){ + $data = $this->request->post(); + $rule = new Validate([ + "amc_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $amc_info = $this->article_main_check_obj->where("amc_id",$data['amc_id'])->find(); + if($amc_info['estate']==1){ + return jsonError("status is complete"); + } + $this->article_main_check_obj->where("amc_id",$data['amc_id'])->update(['state'=>1]); + return jsonSuccess([]); + } + + + /**获取文章正文内容修改建议列表 + * @return \think\response\Json + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public function getArticleMainCheckList(){ + $data = $this->request->post(); + $rule = new Validate([ + "article_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $list = $this->article_main_check_obj->where("article_id",$data['article_id'])->where("state",0)->order("am_id")->select(); + $frag = []; + foreach ($list as $k => $v){ + $frag[$v['am_id']][] = $v; + } + $re['list'] = $frag; + return jsonSuccess($re); + } + public function clearMainsRemark(){ $data = $this->request->post(); @@ -554,6 +711,7 @@ class Preaccept extends Base return jsonError("error"); } foreach ($mains as $k=>$main) { + $mains[$k]['checks'] = $this->article_main_check_obj->where("am_id",$main['am_id'])->where("state",0)->select(); if($main['type']==0){ continue; }elseif($main['type']==1){ @@ -730,6 +888,18 @@ class Preaccept extends Base if(!$rule->check($data)){ return jsonError($rule->getError()); } + $am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find(); + $insert['article_id'] = $am_info['article_id']; + $insert['am_id'] = $data['am_id']; + $insert['type'] = 0; + $insert['act_type'] = 0; + $insert['p_content'] = $am_info['content']; + $insert['n_content'] = $data['content']; + $insert['ctime'] = time(); + $this->article_main_log_obj->insert($insert); + + + $update['content'] = $this->formatMain($data['content']); $update['state'] = 0; $this->article_main_obj->where("am_id",$data['am_id'])->update($update); diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 027cdb5..c37cee9 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -1217,8 +1217,8 @@ class Production extends Base $typesetInfo['images'] = $images==[]?null:$images; $typesetInfo['tables'] = $tables==[]?null:$tables; -// $url = $this->ts_base_url."api/typeset/createDocx"; - $url = "http://192.168.110.110:8081/typeset/createDocx"; + $url = $this->ts_base_url."api/typeset/createDocx"; +// $url = "http://192.168.110.110:8081/typeset/createDocx"; // $url = "http://192.168.110.110:8081/typeset/testqt"; $res = object_to_array(json_decode(myPost1($url, $typesetInfo)));