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
80ceab50
authored
Aug 10, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
联系人完善判断
parent
5017175f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
app/Http/Validators/SupplierValidator.php
app/Http/Validators/SupplierValidator.php
View file @
80ceab50
...
@@ -67,19 +67,21 @@ class SupplierValidator
...
@@ -67,19 +67,21 @@ class SupplierValidator
return
$validator
->
errors
()
->
first
();
return
$validator
->
errors
()
->
first
();
}
}
$supplierId
=
$request
->
get
(
'supplier_id'
);
//检验名称是否已经存在数据库
//检验名称是否已经存在数据库
$supplierModel
=
new
SupplierChannelModel
();
$supplierModel
=
new
SupplierChannelModel
();
$contactModel
=
new
SupplierContactModel
();
$companyNameCount
=
0
;
$companyNameCount
=
0
;
if
(
empty
(
$
request
->
get
(
'supplier_id'
)
))
{
if
(
empty
(
$
supplierId
))
{
$count
=
$supplierModel
->
where
(
'supplier_name'
,
$request
->
get
(
'supplier_name'
))
->
count
();
$count
=
$supplierModel
->
where
(
'supplier_name'
,
$request
->
get
(
'supplier_name'
))
->
count
();
$companyNameCount
=
$supplierModel
->
where
(
'register_company_name'
,
$companyNameCount
=
$supplierModel
->
where
(
'register_company_name'
,
$request
->
get
(
'register_company_name'
))
->
where
(
'register_company_name'
,
'!='
,
''
)
->
count
();
$request
->
get
(
'register_company_name'
))
->
where
(
'register_company_name'
,
'!='
,
''
)
->
count
();
}
else
{
}
else
{
$count
=
$supplierModel
->
where
(
'supplier_name'
,
$request
->
get
(
'supplier_name'
))
$count
=
$supplierModel
->
where
(
'supplier_name'
,
$request
->
get
(
'supplier_name'
))
->
where
(
'supplier_id'
,
'!='
,
$
request
->
get
(
'supplier_id'
)
)
->
count
();
->
where
(
'supplier_id'
,
'!='
,
$
supplierId
)
->
count
();
//至少要有一个联系方式
//至少要有一个联系方式
$contactModel
=
new
SupplierContactModel
();
$contactCount
=
$contactModel
->
where
(
'supplier_id'
,
$supplierId
)
->
count
();
$contactCount
=
$contactModel
->
where
(
'supplier_id'
,
$request
->
get
(
'supplier_id'
))
->
count
();
if
(
!
$contactCount
)
{
if
(
!
$contactCount
)
{
return
"供应商至少要有一个联系人,请补全"
;
return
"供应商至少要有一个联系人,请补全"
;
}
}
...
@@ -90,6 +92,24 @@ class SupplierValidator
...
@@ -90,6 +92,24 @@ class SupplierValidator
if
(
$companyNameCount
)
{
if
(
$companyNameCount
)
{
return
"该注册公司名已经存在,请核验后再提交"
;
return
"该注册公司名已经存在,请核验后再提交"
;
}
}
if
(
!
empty
(
$supplierId
))
{
//还要去判断当前提交人是否存在与其关联的联系人没有完善
$codeId
=
$request
->
user
->
codeId
;
$notCompleteContacts
=
$contactModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'can_check_uids'
,
$codeId
)
->
where
(
function
(
$q
)
{
$q
->
where
(
'supplier_consignee'
,
''
)
->
orWhere
(
'supplier_position'
,
''
)
->
orWhere
(
'supplier_email'
,
''
)
->
orWhere
(
'supplier_mobile'
,
''
)
->
orWhere
(
'supplier_telephone'
,
''
);
})
->
get
();
$notCompleteContacts
=
!
empty
(
$notCompleteContacts
)
?
$notCompleteContacts
->
toArray
()
:
[];
if
(
$notCompleteContacts
)
{
return
"存在和你相关的联系人没有完善,请先去完善相关联系人"
;
}
}
}
}
private
function
messages
()
private
function
messages
()
...
...
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