Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
bom_server
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
6d1751dc
authored
Jun 01, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复
parent
30fbbbf7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
19 deletions
cmd/queue/bom.go
internal/logic/bom_matching.go
server/main.go
cmd/queue/bom.go
View file @
6d1751dc
...
...
@@ -8,7 +8,6 @@ import (
"fmt"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/prometheus/common/log"
"time"
)
type
RecvPro
struct
{
...
...
@@ -28,7 +27,6 @@ func init() {
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
(
err
error
)
{
start
:=
time
.
Now
()
var
message
model
.
BomMessage
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
log
.
Error
(
err
)
...
...
@@ -40,8 +38,6 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
if
err
!=
nil
{
log
.
Error
(
err
)
}
duration
:=
time
.
Now
()
.
Sub
(
start
)
fmt
.
Println
(
duration
)
return
nil
}
...
...
internal/logic/bom_matching.go
View file @
6d1751dc
...
...
@@ -50,20 +50,18 @@ func BatchSaveMatchings(bomId int, matchingList []model.BomItemMatching) (err er
return
}
}
for
_
,
matching
:=
range
matchingList
{
now
:=
time
.
Now
()
.
Unix
()
if
matching
.
IsBuy
==
1
{
err
=
model
.
Db
.
Table
(
"lie_bom_item_"
+
tableEnd
)
.
Where
(
"bom_item_id = ?"
,
matching
.
BomItemID
)
.
Updates
(
map
[
string
]
interface
{}{
"item_status"
:
2
,
"update_time"
:
now
})
.
Error
if
err
!=
nil
{
return
}
}
else
{
err
=
model
.
Db
.
Table
(
"lie_bom_item_"
+
tableEnd
)
.
Where
(
"bom_item_id = ?"
,
matching
.
BomItemID
)
.
Updates
(
map
[
string
]
interface
{}{
"item_status"
:
3
,
"update_time"
:
now
})
.
Error
if
err
!=
nil
{
return
}
now
:=
time
.
Now
()
.
Unix
()
if
matching
.
IsBuy
==
1
{
err
=
model
.
Db
.
Table
(
"lie_bom_item_"
+
tableEnd
)
.
Where
(
"bom_item_id = ?"
,
matching
.
BomItemID
)
.
Updates
(
map
[
string
]
interface
{}{
"item_status"
:
2
,
"update_time"
:
now
})
.
Error
if
err
!=
nil
{
return
}
}
else
{
err
=
model
.
Db
.
Table
(
"lie_bom_item_"
+
tableEnd
)
.
Where
(
"bom_item_id = ?"
,
matching
.
BomItemID
)
.
Updates
(
map
[
string
]
interface
{}{
"item_status"
:
3
,
"update_time"
:
now
})
.
Error
if
err
!=
nil
{
return
}
}
}
...
...
server/main.go
View file @
6d1751dc
...
...
@@ -9,7 +9,7 @@ import (
func
main
()
{
var
path
string
flag
.
StringVar
(
&
path
,
"config"
,
"conf/config.ini"
,
"../conf/config.ini"
)
flag
.
StringVar
(
&
path
,
"config"
,
"
../
conf/config.ini"
,
"../conf/config.ini"
)
flag
.
Parse
()
configs
.
Setup
(
path
)
model
.
Setup
()
...
...
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