This commit is contained in:
wangjinlei
2024-12-18 09:10:10 +08:00
parent f11e97e89c
commit 3f03d9357a
4 changed files with 540 additions and 36 deletions

View File

@@ -368,6 +368,103 @@ class Preaccept extends Base
return jsonSuccess($re);
}
public function getArticleMains(){
$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']);
}
$mains = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort asc")->select();
if(!$mains){
return jsonError("error");
}
foreach ($mains as $k=>$main) {
if($main['type']==0){
continue;
}elseif($main['type']==1){
$c_d = $this->article_main_image_obj->where("ami_id",$main['ami_id'])->find();
$mains[$k]['image'] = $c_d;
}else{
$c_d_t = $this->article_main_table_obj->where("amt_id",$main['amt_id'])->find();
$mains[$k]['table'] = $c_d_t;
}
}
$re['list'] = $mains;
return jsonSuccess($re);
}
public function delArticleMains(){
$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(['state'=>1]);
return jsonSuccess([]);
}
public function editArticleMainsForAuthor(){
$data = $this->request->post();
$rule = new Validate([
"am_id"=>"require",
"content"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$update['content'] = $this->replaceChinesePunctuation($this->removeExtraSpaces(trim($data['content'])));
$update['state'] = 0;
$this->article_main_obj->where("am_id",$data['am_id'])->update($update);
return jsonSuccess([]);
}
public function getArticleMainsRecycle(){
$data = $this->request->post();
$rule = new Validate([
"article_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->article_main_obj->where("article_id",$data['article_id'])->where("state",1)->select();
$re['list'] = $list;
return jsonSuccess($re);
}
public function replyArticleRecycle(){
$data = $this->request->post();
$rule = new Validate([
'am_id'=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
$check = $this->article_main_obj->where("article_id",$info['article_id'])->where("sort",$info['sort'])->whereIn("state",[0,2])->find();
if($check){
$this->article_main_obj->where("article_id",$data['article_id'])->where("sort",">=",$info['sort'])->inc('sort',1)->update();
}
$this->article_main_obj->where("am_id",$data['am_id'])->update(['state'=>0]);
return jsonSuccess([]);
}
/**调整refer排序
* @return \think\response\Json
* @throws \think\Exception
@@ -405,6 +502,22 @@ class Preaccept extends Base
}
// public function getArticleMains(){
// $data = $this->request->post();
// $rule = new Validate([
// "article_id"=>"require"
// ]);
// if(!$rule->check($data)){
// return jsonError($rule->getError());
// }
// $article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
// $product_info = $this->production_article_obj->where("article_id".$data['article_id'])->find();
//
//
//
// }
public function addRefersByExcel()
{
$data = $this->request->post();