feat: 注册页加部门选择/用户管理修部门下拉/超管可跨店建用户/公开部门接口

This commit is contained in:
li
2026-03-14 18:28:35 +08:00
parent f7adb5f609
commit 94b46611d3
98 changed files with 209 additions and 129 deletions
@@ -47,12 +47,20 @@ class UserController extends Controller
'status' => 'in:0,1,2',
'role_ids' => 'array',
'role_ids.*' => 'exists:roles,id',
'store_id' => 'nullable|exists:stores,id',
]);
$roleIds = $data['role_ids'] ?? [];
unset($data['role_ids']);
$data['store_id'] = auth()->user()->store_id;
$authUser = auth()->user();
// 超级管理员可指定 store_id,普通管理员只能在自己门店下创建
if ($authUser->is_super && !empty($data['store_id'])) {
// use provided store_id
} else {
$data['store_id'] = $authUser->store_id;
}
$user = User::create($data);
if ($roleIds) {