This commit is contained in:
wangjinlei
2025-01-22 10:21:50 +08:00
parent 583bc87bbe
commit ce33a94db7
3 changed files with 177 additions and 3 deletions

View File

@@ -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);