/**
  * 将id以及id的子分类的状态修改掉
  * @param $id
  * @param $status
  */
 public function changeStatus($id, $status)
 {
     $sql = "SELECT child.id FROM goods_category AS parent,goods_category AS child WHERE child.lft>=parent.`lft` AND child.rght<=parent.`rght` AND parent.id={$id}";
     $rows = $this->query($sql);
     $ids = array_column($rows, 'id');
     //然后在修改奇状态
     return parent::changeStatus($ids, $status);
 }
 /**
  * @param $id
  * @param $status
  * @return bool
  * 改变状态
  */
 public function changeStatus($id, $status)
 {
     //找到id以及该id作为其他子类的parent_id的子类id
     $sql = "select  child.id   from goods_category as parent,goods_category as child where child.lft>=parent.lft and child.rght<=parent.rght and parent.id = {$id}";
     $rows = $this->query($sql);
     $ids = array_column($rows, "id");
     parent::changeStatus($ids, $status);
 }
 /**
  * 将id以及id的子分类的状态修改掉
  * @param $id
  * @param $status
  * @return bool
  */
 public function changeStatus($id, $status)
 {
     //>>这里需要排除一下status=-1的数据,以后补上
     //>>1.找到id以及子分类的id
     $sql = "select  child.id   from goods_category as parent,goods_category as child where child.lft>=parent.lft and child.rght<=parent.rght and parent.id = {$id}";
     $rows = $this->query($sql);
     //>>array_column方法支持>php5.5,自己定义了该方法在common下的function.php中.
     $ids = array_column($rows, "id");
     //>>2.然后再修改其状态
     return parent::changeStatus($ids, $status);
 }