Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
f8a5231d
Commit
f8a5231d
authored
Sep 13, 2021
by
孟维甫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_ota_manage' into 'test'
update:ota manage See merge request bp/goods!49
parents
e06effd8
d0653a77
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
OtaValidate.php
application/library/Validate/OtaValidate.php
+1
-1
OtaService.php
application/services/goods/OtaService.php
+8
-3
No files found.
application/library/Validate/OtaValidate.php
View file @
f8a5231d
...
@@ -65,7 +65,7 @@ class OtaValidate extends \Validate\BaseValidate
...
@@ -65,7 +65,7 @@ class OtaValidate extends \Validate\BaseValidate
protected
function
is_label_printer_sn
(
$value
){
protected
function
is_label_printer_sn
(
$value
){
if
(
substr
(
$value
,
3
,
1
)
!=
2
){
if
(
substr
(
$value
,
3
,
1
)
!=
'2'
){
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
...
application/services/goods/OtaService.php
View file @
f8a5231d
...
@@ -78,8 +78,10 @@ class OtaService
...
@@ -78,8 +78,10 @@ class OtaService
//检查打印机是否已存在 -- 打印机已被(商家名称)绑定
//检查打印机是否已存在 -- 打印机已被(商家名称)绑定
if
(
isset
(
$params
[
'printer_sn'
])
&&
$params
[
'printer_sn'
])
{
if
(
isset
(
$params
[
'printer_sn'
])
&&
$params
[
'printer_sn'
])
{
if
((
new
OtaValidate
())
->
is_label_printer_sn
(
$params
[
'printer_sn'
]))
{
throw
new
GoodsException
([
'cus'
=>
GoodsException
::
PRINTER_SN_ERROR
]);
}
$printer
=
self
::
list
(
''
,
$params
[
'printer_sn'
]);
$printer
=
self
::
list
(
''
,
$params
[
'printer_sn'
]);
if
(
$printer
[
'total'
]
>
0
)
{
if
(
$printer
[
'total'
]
>
0
)
{
throw
new
GoodsException
(
throw
new
GoodsException
(
[
'cus'
=>
GoodsException
::
PRINTER_ALREADY_EXIST
,
'data'
=>
[
$printer
[
'list'
][
0
][
'ota_name'
]]]
[
'cus'
=>
GoodsException
::
PRINTER_ALREADY_EXIST
,
'data'
=>
[
$printer
[
'list'
][
0
][
'ota_name'
]]]
...
@@ -88,8 +90,11 @@ class OtaService
...
@@ -88,8 +90,11 @@ class OtaService
}
}
//检查标签打印机是否已存在 -- 打印机已被(商家名称)绑定
//检查标签打印机是否已存在 -- 打印机已被(商家名称)绑定
if
(
isset
(
$params
[
'label_printer_sn'
])
&&
$params
[
'label_printer_sn'
])
{
if
(
isset
(
$params
[
'label_printer_sn'
])
&&
$params
[
'label_printer_sn'
])
{
$printer
=
self
::
list
(
''
,
''
,
''
,
$params
[
'label_printer_sn'
]);
if
(
!
(
new
OtaValidate
())
->
is_label_printer_sn
(
$params
[
'label_printer_sn'
]))
{
throw
new
GoodsException
([
'cus'
=>
GoodsException
::
PRINTER_SN_ERROR
]);
}
$printer
=
self
::
list
(
''
,
''
,
''
,
$params
[
'label_printer_sn'
]);
if
(
$printer
[
'total'
]
>
0
)
{
if
(
$printer
[
'total'
]
>
0
)
{
throw
new
GoodsException
(
throw
new
GoodsException
(
[
'cus'
=>
GoodsException
::
LABEL_PRINTER_ALREADY_EXIST
,
'data'
=>
[
$printer
[
'list'
][
0
][
'ota_name'
]]]
[
'cus'
=>
GoodsException
::
LABEL_PRINTER_ALREADY_EXIST
,
'data'
=>
[
$printer
[
'list'
][
0
][
'ota_name'
]]]
...
@@ -179,7 +184,7 @@ class OtaService
...
@@ -179,7 +184,7 @@ class OtaService
//检查打印机是否已存在 -- 打印机已被(商家名称)绑定
//检查打印机是否已存在 -- 打印机已被(商家名称)绑定
if
(
isset
(
$params
[
'printer_sn'
])
&&
$params
[
'printer_sn'
]
&&
$otaDetail
[
'printer_sn'
]
!=
$params
[
'printer_sn'
])
{
if
(
isset
(
$params
[
'printer_sn'
])
&&
$params
[
'printer_sn'
]
&&
$otaDetail
[
'printer_sn'
]
!=
$params
[
'printer_sn'
])
{
if
((
new
OtaValidate
())
->
is_label_printer_sn
(
$params
[
'
label_
printer_sn'
]))
{
if
((
new
OtaValidate
())
->
is_label_printer_sn
(
$params
[
'printer_sn'
]))
{
throw
new
GoodsException
([
'cus'
=>
GoodsException
::
PRINTER_SN_ERROR
]);
throw
new
GoodsException
([
'cus'
=>
GoodsException
::
PRINTER_SN_ERROR
]);
}
}
...
...
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