Commit 6b80ce3e by 宁成龙

优化客户列表

parent 773a7ca3
......@@ -114,13 +114,13 @@ class UserController extends AdminController
}
UserService::createUserAndAddress($params);
} catch (\Throwable $throwable) {
var_dump((string)$throwable);
// var_dump((string)$throwable);
return Form::make()->response()
->error(trans('admin.save_failed'))
->withExceptionIf($throwable->getMessage(), $throwable);
}
$url = admin_url("/users/list");
return Form::make()->response()->success('操作成功')->redirect($url)->refresh();
$url = admin_url("/users");
return Form::make()->response()->success(admin_trans("succeeded"))->redirect($url);
}
......
......@@ -104,8 +104,8 @@ class UserService
"phone" => $params["phone"],
"email" => $params["email"],
"reg_source" => User::REG_SOURCE_MANUAL,
"remark" => $params["remark"],
"password" => "1234567",
"remark" => $params["remark"] ?? "",
"password" => "123456",
"status" => User::STATUS_NORMAL,
"sale_id" => request()->user->userId ?? "1000",
"sale_name" => request()->user->name ?? "admin",
......@@ -115,6 +115,9 @@ class UserService
$userId = User::insertData($userData);
foreach ($params['user_address_list'] as $address) {
if ($address['_remove_']) {
continue;
}
$validator = Validator::make($address, [
'first_name' => 'required',
'last_name' => 'required',
......@@ -128,7 +131,7 @@ class UserService
]);
if ($validator->fails()) {
$error = $validator->errors()->first();
throw new \Exception($error);
throw new \Exception("user addressList failed:" . $error);
}
$addressData = [
"user_id" => $userId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment