Commit 6d1751dc by mushishixian

修复

parent 30fbbbf7
......@@ -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
}
......
......@@ -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
}
}
}
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment