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
d0653a77
Commit
d0653a77
authored
Sep 13, 2021
by
mengweifu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:ota manage
parent
0df0d809
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 @
d0653a77
...
...
@@ -65,7 +65,7 @@ class OtaValidate extends \Validate\BaseValidate
protected
function
is_label_printer_sn
(
$value
){
if
(
substr
(
$value
,
3
,
1
)
!=
2
){
if
(
substr
(
$value
,
3
,
1
)
!=
'2'
){
return
false
;
}
return
true
;
...
...
application/services/goods/OtaService.php
View file @
d0653a77
...
...
@@ -78,8 +78,10 @@ class OtaService
//检查打印机是否已存在 -- 打印机已被(商家名称)绑定
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'
]);
if
(
$printer
[
'total'
]
>
0
)
{
throw
new
GoodsException
(
[
'cus'
=>
GoodsException
::
PRINTER_ALREADY_EXIST
,
'data'
=>
[
$printer
[
'list'
][
0
][
'ota_name'
]]]
...
...
@@ -88,8 +90,11 @@ class OtaService
}
//检查标签打印机是否已存在 -- 打印机已被(商家名称)绑定
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
)
{
throw
new
GoodsException
(
[
'cus'
=>
GoodsException
::
LABEL_PRINTER_ALREADY_EXIST
,
'data'
=>
[
$printer
[
'list'
][
0
][
'ota_name'
]]]
...
...
@@ -179,7 +184,7 @@ class OtaService
//检查打印机是否已存在 -- 打印机已被(商家名称)绑定
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
]);
}
...
...
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