1
This commit is contained in:
@@ -569,6 +569,92 @@ class Preaccept extends Base
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function changeH1(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
//上一行,空行
|
||||
$p_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort","<",$am_info['sort'])->whereIn("state",[0,2])->order("sort desc")->limit(1)->select();
|
||||
if($p_list[0]['type']>0||$p_list[0]['content']!=""){
|
||||
$this->addBRow($am_info['article_id'],$p_list[0]['am_id']);
|
||||
}
|
||||
$n_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort",">",$am_info['sort'])->whereIn("state",[0,2])->order("sort asc")->limit(1)->select();
|
||||
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]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function changeH2(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||
//上一行,空行
|
||||
$p_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort","<",$am_info['sort'])->whereIn("state",[0,2])->order("sort desc")->limit(1)->select();
|
||||
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]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function changeH3(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h3"=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function addBlankRow(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require",
|
||||
"am_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->addBRow($data['article_id'],$data['am_id']);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
private function addBRow($article_id,$am_id){
|
||||
if($am_id==0){//顶行
|
||||
$this->article_main_obj->where("article_id",$article_id)->whereIn("state",[0,2])->inc("sort",1);
|
||||
$insert['article_id'] = $article_id;
|
||||
$insert['content'] = "";
|
||||
$insert['sort'] = 1;
|
||||
$insert['ctime'] = time();
|
||||
$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'])->whereIn("state",[0,2])->inc("sort",1);
|
||||
$insert['article_id'] = $article_id;
|
||||
$insert['content'] = "";
|
||||
$insert['sort'] = $am_info['sort']+1;
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_obj->insert($insert);
|
||||
}
|
||||
}
|
||||
|
||||
public function getMainImages(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
|
||||
Reference in New Issue
Block a user