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
3720f440
authored
Nov 18, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完善客户编码等问题
parent
c6e8af7f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
2 deletions
app/Admin/Renderable/CreateUser.php
app/Admin/Service/UserService.php
app/Models/BaseModel.php
app/Models/User.php
app/Admin/Renderable/CreateUser.php
View file @
3720f440
...
@@ -27,7 +27,7 @@ class CreateUser extends \Dcat\Admin\Support\LazyRenderable
...
@@ -27,7 +27,7 @@ class CreateUser extends \Dcat\Admin\Support\LazyRenderable
$form
->
disableCreatingCheck
();
$form
->
disableCreatingCheck
();
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'company_name'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'company_name'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'user_sn'
);
$form
->
width
(
4
)
->
text
(
'user_sn'
)
->
disable
()
;
});
});
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
row
(
function
(
Form\Row
$form
)
{
$form
->
width
(
4
)
->
text
(
'first_name'
)
->
required
();
$form
->
width
(
4
)
->
text
(
'first_name'
)
->
required
();
...
...
app/Admin/Service/UserService.php
View file @
3720f440
...
@@ -114,6 +114,8 @@ class UserService
...
@@ -114,6 +114,8 @@ class UserService
"update_time"
=>
time
(),
"update_time"
=>
time
(),
];
];
$userId
=
User
::
insertData
(
$userData
);
$userId
=
User
::
insertData
(
$userData
);
$userSn
=
self
::
generateSn
(
$userId
);
User
::
updateById
(
$userId
,
[
"user_sn"
=>
$userSn
]);
foreach
(
$params
[
'user_address_list'
]
as
$address
)
{
foreach
(
$params
[
'user_address_list'
]
as
$address
)
{
if
(
$address
[
'_remove_'
])
{
if
(
$address
[
'_remove_'
])
{
...
@@ -162,6 +164,12 @@ class UserService
...
@@ -162,6 +164,12 @@ class UserService
}
}
}
}
public
static
function
generateSn
(
$userId
)
{
$id
=
str_pad
(
$userId
,
6
,
0
,
STR_PAD_LEFT
);
return
'SU'
.
$id
;
}
public
static
function
transferUser
(
$ids
,
$saleId
)
public
static
function
transferUser
(
$ids
,
$saleId
)
{
{
try
{
try
{
...
@@ -178,6 +186,8 @@ class UserService
...
@@ -178,6 +186,8 @@ class UserService
"sale_name"
=>
$saleInfo
[
"name"
],
"sale_name"
=>
$saleInfo
[
"name"
],
];
];
User
::
updateByIdArr
(
$userIds
,
$update
);
User
::
updateByIdArr
(
$userIds
,
$update
);
InquiryService
::
batchUpdateSalesId
(
$saleId
,
$userIds
);
// OrderService::changeOrderSales($userIds,$saleId,$saleInfo["name"]);
DB
::
commit
();
DB
::
commit
();
}
catch
(
\Throwable
$throwable
)
{
}
catch
(
\Throwable
$throwable
)
{
...
...
app/Models/BaseModel.php
0 → 100644
View file @
3720f440
<?php
namespace
App\Models
;
use
App\Http\Services\PermService
;
use
Illuminate\Database\Eloquent\Model
;
class
BaseModel
extends
Model
{
/*
* 权限
*/
public
function
scopeRule
(
$query
,
$viewList
,
$adminUser
=
"sale_id"
)
{
if
(
getAdminUserId
()
==
1000
)
{
return
$query
;
}
//查看所有
if
(
PermService
::
hasPerm
(
$viewList
[
0
]))
{
return
$query
;
}
//查看下级
if
(
PermService
::
hasPerm
(
$viewList
[
1
]))
{
//查看下级的权限//获取用户部门下的所有用户
$userIds
=
PermService
::
getSubUserId
(
getAdminUserId
());
if
(
!
empty
(
$userIds
))
{
return
$query
->
whereIn
(
$adminUser
,
$userIds
);
}
}
$query
=
$query
->
where
(
$adminUser
,
getAdminUserId
());
return
$query
;
}
}
app/Models/User.php
View file @
3720f440
...
@@ -26,7 +26,7 @@ use Illuminate\Database\Eloquent\Model;
...
@@ -26,7 +26,7 @@ use Illuminate\Database\Eloquent\Model;
* @property $created_time 创建时间
* @property $created_time 创建时间
* @property $update_time 更新时间
* @property $update_time 更新时间
*/
*/
class
User
extends
Model
class
User
extends
Base
Model
{
{
use
HasDateTimeFormatter
;
use
HasDateTimeFormatter
;
protected
$table
=
'users'
;
protected
$table
=
'users'
;
...
@@ -39,6 +39,13 @@ class User extends Model
...
@@ -39,6 +39,13 @@ class User extends Model
const
ACCOUNT_PROPERTIES_PERSONAL
=
1
;
const
ACCOUNT_PROPERTIES_PERSONAL
=
1
;
const
ACCOUNT_PROPERTIES_ENTERPRISE
=
2
;
const
ACCOUNT_PROPERTIES_ENTERPRISE
=
2
;
//查看权限
public
static
$ruleViewList
=
[
self
::
SEM_USER_VIEW_ALL
,
//查看所有
self
::
SEM_USER_VIEW_SUB
,
//查看下级
];
const
SEM_USER_VIEW_ALL
=
"sem_user_viewAllList"
;
//查看所有
const
SEM_USER_VIEW_SUB
=
"sem_user_viewSubList"
;
//查看下级
public
static
function
insertData
(
$data
)
public
static
function
insertData
(
$data
)
{
{
...
...
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