class Test extends Controller{
public function index(){
$id = input('id');
//$this->setparent();
$this->setchild($id);
}
public function setparent(){
$list = [];
$list = db('ce')->insert([
'cname'=>rand(1000,9999),
'f_id'=>0,
'left_num'=>1,
'right_num'=>2,
'level' =>1
]);
}
public function setchild($fid){
$p_data = db('ce')->where('id',$fid)->find();
$max_data = db('ce')->where('f_id',$fid)->max('right_num');
if(empty($max_data)){
db('ce')->where('right_num','>=',$p_data['right_num'])->setInc('right_num',2);
}else{
db('ce')->where('left_num','>=
mysql 预查询-无限极分类
最新推荐文章于 2024-06-28 12:32:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)