Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
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
21b7a70d
authored
May 20, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
6d285e2d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
app/Http/Validators/SupplierAccountValidator.php
app/Http/Validators/SupplierAccountValidator.php
View file @
21b7a70d
...
@@ -14,26 +14,31 @@ class SupplierAccountValidator
...
@@ -14,26 +14,31 @@ class SupplierAccountValidator
public
function
checkSave
(
$request
)
public
function
checkSave
(
$request
)
{
{
//整理下请求数据
//整理下请求数据
$
receip
t
=
$request
->
all
();
$
accoun
t
=
$request
->
all
();
$rules
=
[
$rules
=
[
"supplier_code"
=>
"required"
,
"supplier_code"
=>
"required"
,
"mobile"
=>
"required|regex:/^1[0-9][0-9]
{
9
}
$/"
,
"mobile"
=>
"required|regex:/^1[0-9][0-9]
{
9
}
$/"
,
"password_raw"
=>
"required"
,
"password_raw"
=>
"required"
,
];
];
$messages
=
$this
->
messages
();
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$
receip
t
,
$rules
,
$messages
);
$validator
=
Validator
::
make
(
$
accoun
t
,
$rules
,
$messages
);
//判断联系方式的表单验证
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
if
(
$validator
->
fails
())
{
return
$validator
->
errors
()
->
first
();
return
$validator
->
errors
()
->
first
();
}
}
if
(
empty
(
$
receip
t
[
'id'
]))
{
if
(
empty
(
$
accoun
t
[
'id'
]))
{
$model
=
new
SupplierAccountModel
();
$model
=
new
SupplierAccountModel
();
$count
=
$model
->
where
(
'supplier_code'
,
$receipt
[
'supplier_code'
])
$supplierCount
=
$model
->
where
(
'supplier_code'
,
$account
[
'supplier_code'
])
->
orWhere
(
'mobile'
,
$receipt
[
'mobile'
])
->
count
();
->
count
();
if
(
$count
>
0
)
{
if
(
$supplierCount
>
0
)
{
return
'该供应商以及对应的账号已经存在,请更换手机号'
;
return
'该供应商已经存在账号'
;
}
$mobileCount
=
$model
->
where
(
'mobile'
,
$account
[
'mobile'
])
->
count
();
if
(
$mobileCount
>
0
)
{
return
'该手机号已经被注册'
;
}
}
}
}
...
...
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