20201112
This commit is contained in:
@@ -247,6 +247,55 @@ class Journal extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 更改话题信息
|
||||||
|
* @description 更改话题信息
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /master/Journal/editTopic
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_topic_id type:int require:1 desc:主键
|
||||||
|
* @param name:title type:string require:1 desc:标题
|
||||||
|
* @param name:icon type:string require:1 desc:缩略图
|
||||||
|
* @param name:is_final type:int require:1 desc:是否终结点(0no1yes)
|
||||||
|
* @param name:sort type:int require:1 default:0 desc:权重
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function editTopic(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$res = $this->journal_topic_obj->update($data);
|
||||||
|
if($res){
|
||||||
|
return json(['code'=>0,'msg'=>'success']);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>1,'msg'=>'system error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 删除话题
|
||||||
|
* @description 删除话题
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /master/Journal/delTopic
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_topic_id type:int require:1 desc:主键
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function delTopic(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
//排除有子节点的项
|
||||||
|
$rep = $this->journal_topic_obj->where('parent_id',$data['journal_topic_id'])->where('state',0)->find();
|
||||||
|
if($rep){
|
||||||
|
return json(['code'=>1,'msg'=>'删除的话题不能有子节点!']);
|
||||||
|
}
|
||||||
|
$res = $this->journal_topic_obj->where('journal_topic_id',$data['journal_topic_id'])->update(['state'=>1]);
|
||||||
|
if($res){
|
||||||
|
return json(['code'=>0,'msg'=>'success']);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>1,'msg'=>'system error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取话题父级列表
|
* @title 获取话题父级列表
|
||||||
* @description 获取话题父级列表
|
* @description 获取话题父级列表
|
||||||
@@ -320,7 +369,7 @@ class Journal extends Controller {
|
|||||||
}
|
}
|
||||||
foreach ($res as $v){
|
foreach ($res as $v){
|
||||||
if($v['parent_id'] == $vv['journal_topic_id']){
|
if($v['parent_id'] == $vv['journal_topic_id']){
|
||||||
$vv['child'][] = $this->getChieldarr($v, $res);
|
$vv['children'][] = $this->getChieldarr($v, $res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $vv;
|
return $vv;
|
||||||
|
|||||||
Reference in New Issue
Block a user