update
This commit is contained in:
parent
9937c217a2
commit
7bb9aea11d
@ -76,6 +76,22 @@ class MaterialClassifyController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
return $this->fail(MaterialClassifyLogic::getError());
|
return $this->fail(MaterialClassifyLogic::getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除工料分类
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/03/04 14:00
|
||||||
|
*/
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$params = (new MaterialClassifyValidate())->post()->goCheck('delete');
|
||||||
|
$result = MaterialClassifyLogic::delete($params);
|
||||||
|
if (true === $result) {
|
||||||
|
return $this->success('删除成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(MaterialClassifyLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,6 +89,11 @@ class MaterialClassifyLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function delete(array $params): bool
|
public static function delete(array $params): bool
|
||||||
{
|
{
|
||||||
|
$data = MaterialClassify::where('pid',$params['id'])->findOrEmpty();
|
||||||
|
if(!$data->isEmpty()){
|
||||||
|
self::setError('当前分类下存在子分类,须先删除子分类');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return MaterialClassify::destroy($params['id']);
|
return MaterialClassify::destroy($params['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user