1
This commit is contained in:
@@ -464,8 +464,7 @@ class Preaccept extends Base
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require",
|
||||
"am_id"=>"require",
|
||||
"content"=>"require"
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
@@ -479,7 +478,9 @@ class Preaccept extends Base
|
||||
if(isset($data['remark'])&&$data['remark']!=""){
|
||||
$insert["remark"] = $data['remark'];
|
||||
}
|
||||
$insert["content"] = $data['content'];
|
||||
if(isset($data['content'])&&$data['content']!=""){
|
||||
$insert["content"] = $data['content'];
|
||||
}
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_check_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
@@ -693,6 +694,23 @@ class Preaccept extends Base
|
||||
}
|
||||
|
||||
|
||||
public function myCreatMains(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$mains = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort asc")->select();
|
||||
if(!$mains) {
|
||||
$this->addArticleMainEx($data["article_id"]);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function getArticleMains(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
@@ -745,7 +763,7 @@ class Preaccept extends Base
|
||||
if($n_list[0]['type']>0||$n_list[0]['content']!=""){
|
||||
$this->addBRow($am_info['article_id'],$data['am_id']);
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1]);
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1,"content"=>"<b><i>".$am_info['content']."</i></b>"]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -763,7 +781,7 @@ class Preaccept extends Base
|
||||
if($p_list[0]['type']>0||$p_list[0]['content']!=""){
|
||||
$this->addBRow($am_info['article_id'],$p_list[0]['am_id']);
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h2"=>1]);
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h2"=>1,"content"=>"<b>".$am_info['content']."</b>"]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -775,7 +793,8 @@ class Preaccept extends Base
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h3"=>1]);
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h3"=>1,"content"=>"<b>".$am_info['content']."</b>"]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -795,7 +814,7 @@ class Preaccept extends Base
|
||||
|
||||
private function addBRow($article_id,$am_id){
|
||||
if($am_id==0){//顶行
|
||||
$this->article_main_obj->where("article_id",$article_id)->inc("sort",1);
|
||||
$this->article_main_obj->where("article_id",$article_id)->inc("sort",1)->update();
|
||||
$insert['article_id'] = $article_id;
|
||||
$insert['content'] = "";
|
||||
$insert['sort'] = 1;
|
||||
@@ -803,7 +822,7 @@ class Preaccept extends Base
|
||||
$this->article_main_obj->insert($insert);
|
||||
}else{
|
||||
$am_info = $this->article_main_obj->where("am_id",$am_id)->find();
|
||||
$this->article_main_obj->where("article_id",$article_id)->where("sort",">",$am_info['sort'])->inc("sort",1);
|
||||
$this->article_main_obj->where("article_id",$article_id)->where("sort",">",$am_info['sort'])->inc("sort",1)->update();
|
||||
$insert['article_id'] = $article_id;
|
||||
$insert['content'] = "";
|
||||
$insert['sort'] = $am_info['sort']+1;
|
||||
|
||||
Reference in New Issue
Block a user