success('查询成功', $category_tree); } /** * @notes 添加 * @return \think\response\Json * @author likeadmin * @date 2025/05/20 17:35 */ public function add() { $params = (new GoodsCategoryValidate())->post()->goCheck('add'); $result = GoodsCategoryLogic::add($params); if (true === $result) { return $this->success('添加成功', [], 1, 1); } return $this->fail(GoodsCategoryLogic::getError()); } // 查询分类 public function checkCategory(){ $result = GoodsCategoryLogic::getAllTree(); return $this->success('查询成功', $result); } /** * @notes 编辑 * @return \think\response\Json * @author likeadmin * @date 2025/05/20 17:35 */ public function edit() { $params = (new GoodsCategoryValidate())->post()->goCheck('edit'); $result = GoodsCategoryLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(GoodsCategoryLogic::getError()); } /** * @notes 删除 * @return \think\response\Json * @author likeadmin * @date 2025/05/20 17:35 */ public function delete() { $params = (new GoodsCategoryValidate())->post()->goCheck('delete'); GoodsCategoryLogic::delete($params); return $this->success('删除成功', [], 1, 1); } /** * @notes 获取详情 * @return \think\response\Json * @author likeadmin * @date 2025/05/20 17:35 */ public function detail() { $params = (new GoodsCategoryValidate())->goCheck('detail'); $result = GoodsCategoryLogic::detail($params); return $this->data($result); } }