Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
10b71f03
authored
Nov 21, 2022
by
孙龙
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://git.ichunt.net/semour/semour_admin
parents
aa344e0e
c8dbb5a1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
8 deletions
app/Admin/Forms/User/AssignUserHandle.php
app/Admin/Forms/User/EditUserHandle.php
app/Admin/Forms/User/TransferUserHandle.php
app/Admin/Forms/UserAddress/SaveUserAddressHandle.php
app/Admin/Service/UserAddressService.php
app/Admin/Service/UserService.php
app/Admin/Forms/User/AssignUserHandle.php
View file @
10b71f03
...
...
@@ -32,7 +32,7 @@ class AssignUserHandle extends Form implements LazyRenderable
->
refresh
();
}
catch
(
\Throwable
$throwable
)
{
// var_dump((string)$throwable);
return
$this
->
response
()
->
error
(
trans
(
'admin.update_failed'
));
return
$this
->
response
()
->
error
(
trans
(
'admin.update_failed'
)
.
":
{
$throwable
->
getMessage
()
}
"
);
}
}
...
...
app/Admin/Forms/User/EditUserHandle.php
View file @
10b71f03
...
...
@@ -28,8 +28,12 @@ class EditUserHandle extends Form implements LazyRenderable
// $userList = User::getListByIdArr($ids);
$userInfo
=
User
::
getInfoByUserId
(
$id
);
if
(
!
$userInfo
)
{
throw
new
\Exception
(
'客户不存在'
);
throw
new
\Exception
(
"Record not found"
);
}
$input
=
array_filter
(
$input
,
function
(
$value
)
{
return
$value
!==
null
;
});
User
::
updateById
(
$id
,
$input
);
return
$this
->
response
()
...
...
@@ -37,7 +41,7 @@ class EditUserHandle extends Form implements LazyRenderable
->
refresh
();
}
catch
(
\Throwable
$throwable
)
{
// var_dump((string)$throwable);
return
$this
->
response
()
->
error
(
trans
(
'admin.update_failed'
));
return
$this
->
response
()
->
error
(
trans
(
'admin.update_failed'
)
.
" :
{
$throwable
->
getMessage
()
}
"
);
}
}
...
...
@@ -50,7 +54,7 @@ class EditUserHandle extends Form implements LazyRenderable
$this
->
hidden
(
'id'
)
->
attribute
(
'id'
,
'id'
)
->
width
(
4
);
$this
->
row
(
function
(
Row
$form
)
{
$form
->
width
(
5
)
->
text
(
'company_name'
)
->
required
();
$form
->
width
(
5
)
->
text
(
'user_sn'
);
$form
->
width
(
5
)
->
text
(
'user_sn'
)
->
disable
()
;
});
$this
->
row
(
function
(
Row
$form
)
{
$form
->
width
(
5
)
->
text
(
'first_name'
)
->
required
();
...
...
@@ -61,7 +65,7 @@ class EditUserHandle extends Form implements LazyRenderable
$form
->
width
(
5
)
->
text
(
'email'
);
});
$this
->
row
(
function
(
Row
$form
)
{
$form
->
width
(
5
)
->
select
(
'
reg_source'
)
->
options
(
admin_trans
(
'user.options.reg_source
'
))
->
required
();
$form
->
width
(
5
)
->
select
(
'
account_properties'
)
->
options
(
admin_trans
(
'user.options.account_properties
'
))
->
required
();
$form
->
width
(
5
)
->
text
(
'remark'
);
});
}
...
...
app/Admin/Forms/User/TransferUserHandle.php
View file @
10b71f03
...
...
@@ -32,7 +32,7 @@ class TransferUserHandle extends Form implements LazyRenderable
->
refresh
();
}
catch
(
\Throwable
$throwable
)
{
// var_dump((string)$throwable);
return
$this
->
response
()
->
error
(
trans
(
'admin.update_failed'
));
return
$this
->
response
()
->
error
(
trans
(
'admin.update_failed'
)
.
":
{
$throwable
->
getMessage
()
}
"
);
}
}
...
...
app/Admin/Forms/UserAddress/SaveUserAddressHandle.php
View file @
10b71f03
...
...
@@ -38,6 +38,7 @@ class SaveUserAddressHandle extends Form implements LazyRenderable
if
(
$input
[
'is_default'
]
==
1
)
{
UserAddress
::
updateByUserId
(
$address
[
'user_id'
],
[
'is_default'
=>
0
]);
}
$input
[
'consignee'
]
=
$input
[
'first_name'
]
.
' '
.
$input
[
'last_name'
];
UserAddress
::
updateById
(
$addressId
,
$input
);
}
else
{
$userId
=
$this
->
payload
[
'user_id'
]
??
0
;
...
...
app/Admin/Service/UserAddressService.php
View file @
10b71f03
...
...
@@ -5,6 +5,7 @@ namespace App\Admin\Service;
use
App\Admin\Actions\User\UserAssignAction
;
use
App\Admin\Actions\User\UserStatusAction
;
use
App\Admin\Actions\User\UserTransferAction
;
use
App\Models\Country
;
use
App\Models\User
;
use
Dcat\Admin\Grid
;
...
...
@@ -18,9 +19,9 @@ class UserAddressService
$grid
->
column
(
'phone'
);
$grid
->
column
(
'detail_address'
);
$grid
->
column
(
'city'
);
$grid
->
column
(
'address_type'
);
$grid
->
column
(
'address_type'
)
->
using
(
admin_trans
(
'user-address.options.address_type'
))
;
$grid
->
column
(
'post_code'
);
$grid
->
column
(
'country'
);
$grid
->
column
(
'country'
)
->
using
(
Country
::
getCountryMap
())
;
$grid
->
column
(
'province'
);
}
}
app/Admin/Service/UserService.php
View file @
10b71f03
...
...
@@ -177,6 +177,7 @@ class UserService
"create_time"
=>
time
(),
"update_time"
=>
time
(),
];
$addressData
[
'consignee'
]
=
$addressData
[
'first_name'
]
.
" "
.
$addressData
[
'last_name'
];
UserAddress
::
insertData
(
$addressData
);
}
...
...
@@ -204,6 +205,13 @@ class UserService
}
//更新客户的数据
$userList
=
User
::
getListByIdArr
(
$ids
);
//判断客户状态
foreach
(
$userList
as
$user
)
{
if
(
$user
[
'status'
]
!=
User
::
STATUS_NORMAL
)
{
throw
new
\Exception
(
"user:[
{
$user
[
'user_sn'
]
}
] status is not normal"
);
}
}
$userIds
=
array_column
(
$userList
,
"id"
);
$update
=
[
"sale_id"
=>
$saleId
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment