Commit ca951ee9 by 孙龙
parents 16dc8515 f66afe25
......@@ -29,7 +29,7 @@ class UserEditAction extends AbstractTool
public function render()
{
$form = EditUserHandle::make(['key'=>$this->getKey()]);
$buttonName = trans('user.labels.handle');
$buttonName = admin_trans('edit');
return Modal::make()->lg()->title($this->title)->body($form->payload(['key'=>$this->getKey()]))->onLoad
($this->getModalScript())->button('<button style="margin-right: 5px" class="btn btn-sm btn-primary">
<i class="feather icon-check-circle"></i> <span class="d-none d-sm-inline" style="margin-left: 5px">' .
......
......@@ -21,7 +21,7 @@ class UserDetail extends \Dcat\Admin\Support\LazyRenderable
return Show::make($id, new User(), function (Show $show) {
$show->panel()
->tools(function (Show\Tools $tools) {
$userEditAction = new UserEditAction("用户编辑");
$userEditAction = new UserEditAction(admin_trans("edit"));
$userEditAction->setKey($this->key);
$tools->disableDelete();
$tools->disableEdit();
......
......@@ -51,7 +51,7 @@ class UserService
$grid->column('remark');
$grid->column('sale_name');
$grid->column('order_num_data')->display(function ($order_num_data) {
$data = InquiryService::getInquiryCountByUserIds([$this->id])[$this->id] ?? [
$data = OrderService::getUserOrderStatistical([$this->id])[$this->id] ?? [
"pending" => 0,
"all" => 0
];
......@@ -68,6 +68,8 @@ class UserService
return $time ? date('Y-m-d H:i:s', $time) : '';
})->sortable();;
$grid->column('status')->using(admin_trans('user.options.status'));
//客户来源
$grid->column('reg_source')->using(admin_trans('user.options.reg_source'));
}
public static function userListTool(Grid $grid)
......@@ -111,6 +113,12 @@ class UserService
{
try {
DB::beginTransaction();
//判断邮箱是否唯一
$email = $params['email'] ?? '';
$userInfo = User::getInfoByEmail($email);
if ($userInfo) {
throw new \Exception("user email already exists");
}
$userData = [
"company_name" => $params["company_name"] ?? "",
"user_sn" => $params["user_sn"] ?? "",
......@@ -143,6 +151,7 @@ class UserService
'phone' => 'required',
'country' => 'required',
'city' => 'required',
'address_type' => 'required',
'post_code' => 'required',
'detail_address' => 'required',
'is_default' => 'required',
......
......@@ -64,6 +64,12 @@ class User extends BaseModel
$res = self::where('id', $userId)->first();
return ($res) ? $res->toArray() : [];
}
//根据邮箱获取用户信息
public static function getInfoByEmail($email)
{
$res = self::where('email', $email)->first();
return ($res) ? $res->toArray() : [];
}
// 批量获取用户信息
public static function getInfoByUserIds($userId)
......
......@@ -67,7 +67,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'Asia/Shanghai',
/*
|--------------------------------------------------------------------------
......
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