mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
修改
This commit is contained in:
parent
0f683764fd
commit
00af7e929f
@ -73,7 +73,7 @@ class SystemRouteCate extends AuthController
|
||||
public function save(Request $request)
|
||||
{
|
||||
$data = $request->postMore([
|
||||
['pid', ''],
|
||||
['pid', 0],
|
||||
['name', ''],
|
||||
['sort', 0],
|
||||
['app_name', ''],
|
||||
@ -84,16 +84,9 @@ class SystemRouteCate extends AuthController
|
||||
}
|
||||
|
||||
$data['add_time'] = time();
|
||||
$pathAttr = explode('/', $data['pid']);
|
||||
$pathData = [];
|
||||
foreach ($pathAttr as $item) {
|
||||
if (!$item) {
|
||||
$pathData[] = $item;
|
||||
}
|
||||
}
|
||||
$data['pid'] = $pathData[count($pathData) - 1] ?? 0;
|
||||
$res = $this->services->save($data);
|
||||
$path = $this->services->setPathValue($data['pid'], $res->id);
|
||||
$path = $this->services->getPathValue($data['pid']);
|
||||
$path = $this->services->setPathValue($path, $res->id);
|
||||
$res->path = $path;
|
||||
$res->save();
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ class SystemRouteCateServices extends BaseServices
|
||||
$cateInfo = $cateInfo ? $cateInfo->toArray() : [];
|
||||
$url .= '/' . $id;
|
||||
}
|
||||
$options = $this->dao->selectList(['app_name' => $appName], 'name as label,path as value')->toArray();
|
||||
$options = $this->dao->selectList(['app_name' => $appName], 'name as label,id as value')->toArray();
|
||||
$rule = [
|
||||
FormBuilder::select('pid', '上级分类', (int)($cateInfo['pid'] ?? 0))->options($options),
|
||||
FormBuilder::input('name', '分类名称', $cateInfo['name'] ?? '')->required(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user